mvcapa_penalty#

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

Create the default penalty for the MVCAPA algorithm.

The penalty is the pointwise minimum of the constant, linear, and nonlinear chi-square penalties: chi2_penalty, linear_chi2_penalty, and nonlinear_chi2_penalty. It is the recommended penalty for the MVCAPA algorithm [1].

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 pointwise minimum 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

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