linear_penalty#

linear_penalty(n_features: int, intercept: float, slope: float) ndarray[source][source]#

Create a linear penalty.

The penalty is given by intercept + slope * (1, 2, ..., n_features), where n_features is the number of features/columns in the data being analysed. The penalty is non-decreasing.

Parameters:
n_featuresint

Number of features/columns in the data being analysed.

interceptfloat

Intercept of the linear penalty.

slopefloat

Slope of the linear penalty.

Returns:
np.ndarray of shape (n_features,)

The non-decreasing linear penalty values. Element i is the penalty for i+1 features being affected by a change or anomaly.

Examples

>>> linear_penalty(3, 1.0, 2.0)
array([3., 5., 7.])