Metrics catalogue¶
Every metric reduces a time series \(x = (x_1, \dots, x_N)\) of \(N\) observations to a single value. This page gives the formulation of each one. The live list is always available via metrics().
Basic family¶
| Name | Description | Definition |
|---|---|---|
max |
Maximum | \(\max_i x_i\) |
min |
Minimum | \(\min_i x_i\) |
mean |
Arithmetic mean | \(\bar{x} = \tfrac{1}{N}\sum_i x_i\) |
median |
Median | middle value (Hazen \(Q_2\)) |
sum |
Sum | \(\sum_i x_i\) |
std |
Standard deviation | \(\sqrt{\tfrac{1}{N-1}\sum_i (x_i-\bar{x})^2}\) |
skew |
Skewness | \(\dfrac{\sqrt{N(N-1)}}{N-2}\cdot\dfrac{m_3}{m_2^{3/2}}\) |
kurt |
Kurtosis (Pearson) | \(\dfrac{N\sum_i (x_i-\bar{x})^4}{\left(\sum_i (x_i-\bar{x})^2\right)^2}\) |
amplitude |
Range | \(\max_i x_i - \min_i x_i\) |
fslope |
Max. abs. first difference | \(\max_i \lvert x_{i+1}-x_i \rvert\) |
abs_sum |
Absolute sum | \(\sum_i \lvert x_i \rvert\) |
amd |
Mean abs. first difference | \(\tfrac{1}{N-1}\sum_i \lvert x_{i+1}-x_i \rvert\) |
mse |
Mean power spectrum | \(\tfrac{1}{N}\sum_k \lvert \hat{x}_k \rvert^2 = \sum_i x_i^2\) |
fqr |
First quartile | \(Q_1\) (Hazen) |
tqr |
Third quartile | \(Q_3\) (Hazen) |
iqr |
Interquartile range | \(Q_3 - Q_1\) |
In the moment-based definitions above, \(\bar{x}\) is the mean and \(m_k = \tfrac{1}{N}\sum_i (x_i-\bar{x})^k\) is the \(k\)-th central moment.
A few conventions are worth stating, since implementations differ on them. The standard deviation is the sample deviation, ddof = 1. Skewness is the adjusted Fisher–Pearson coefficient, matching scipy.stats.skew(..., bias=False). Kurtosis follows Pearson's non-excess definition, so a normal distribution gives \(3.0\). Quantiles use the Hazen plotting position, matching numpy.quantile(..., method="hazen").
mse
By Parseval's theorem, the mean of \(\lvert \text{FFT} \rvert^2\) over all
frequency bins equals the sum of squared samples, so mse is computed
directly as \(\sum_i x_i^2\), with no FFT.
Polar family¶
| Name | Description | Definition |
|---|---|---|
area_ts |
Polygon area | \(\tfrac{1}{2}\sin\!\left(\tfrac{2\pi}{N}\right)\sum_i r_i\, r_{i+1}\) |
angle |
Phase of the maximum | \(\theta_{\arg\max_i r_i}\), with \(\theta\) from \(\operatorname{linspace}(0, 2\pi, N)\) |
gyration_radius |
Spread of the shape | mean distance of \(P\)'s vertices to its area-centroid |
csi |
Cell shape index | \(\dfrac{\text{perimeter}(P)^2}{4\pi\,\text{area}(P)}\) |
area_q1…area_q4 |
Seasonal quadrant areas | area of \(P\) within each Cartesian quadrant |
polar_balance |
Seasonal balance | standard deviation of the four quadrant areas |
The polygon \(P\) these definitions refer to is the Körting polar plot representation used by stmetrics, against whose Shapely-based implementation these metrics are verified.
It is built by placing each observation on a circle: vertex \(i\) sits at angle \(\theta_i = \tfrac{2\pi i}{N}\) with radius \(r_i = \lvert x_i \rvert\), that is, at the Cartesian point \((r_i\cos\theta_i,\; r_i\sin\theta_i)\). Connecting consecutive vertices closes the polygon. Because radii are non-negative and the vertices are ordered by angle, \(P\) is star-shaped about the origin and therefore simple, never self-intersecting.
The quadrants partition the plane at the origin (area_q1 = upper-right, area_q2 = upper-left, area_q3 = lower-left, area_q4 = lower-right) and act as the four "seasons" of the cycle.
Not yet implemented
ecc_metric (eccentricity, via the minimum rotated rectangle) from
stmetrics is not yet available.