linear_chi2_penalty#
- linear_chi2_penalty(n_samples: int, n_features: int, n_params_per_feature: int = 1) ndarray[source][source]#
Create a linear chi-square penalty.
The penalty is a piece of the default penalty for the MVCAPA algorithm. It is described as “penalty regime 2” in the MVCAPA article [1], suitable for detecting sparse anomalies in the data. Sparse anomalies only affect a few features.
- Parameters:
- n_samplesint
Sample size.
- n_featuresint
Number of features/columns in the data being analysed.
- n_params_per_featureint, default=1
Number of model parameters per feature and segment.
- Returns:
- np.ndarray of shape (n_features,)
The non-decreasing linear chi-square penalty values. Element
iis the penalty fori+1features being affected by a change or anomaly.
References
[1]Fisch, A. T., Eckley, I. A., & Fearnhead, P. (2022). Subset multivariate segment and point anomaly detection. Journal of Computational and Graphical Statistics, 31(2), 574-585.
Examples
>>> linear_chi2_penalty(100, 3) array([...])