nonlinear_chi2_penalty#

nonlinear_chi2_penalty(n_samples: int, n_features: int, n_params_per_feature: int = 1) ndarray[source][source]#

Create a nonlinear chi-square penalty.

The penalty is a piece of the default penalty for the MVCAPA algorithm. It is described as “penalty regime 3” in the MVCAPA article [1], suitable for detecting both sparse and dense anomalies in the data.

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 nonlinear chi-square penalty values. Element i is the penalty for i+1 features 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

>>> nonlinear_chi2_penalty(100, 3)
array([...])