Linearity Measures

Classification measures

l1(X, y)

Calculates the Sum of the error distance by linear programming (L1) metric.

l2(X, y)

Calculates the Error rate of linear classifier (L2) metric.

l3(X, y)

Calculates the Non linearity of linear classifier (L3) metric.

problexity.classification.l1(X, y)

Calculates the Sum of the error distance by linear programming (L1) metric.

Uses Linear SVM classifier. Measures distance of incorrectly classified samples from the SVM hyperplane.

\[L1=\frac{SumErrorDist}{1+SumErrorDist}\]
Parameters:
  • X (array-like, shape (n_samples, n_features)) – Dataset

  • y (array-like, shape (n_samples)) – Labels

Return type:

float

Returns:

L1 score

problexity.classification.l2(X, y)

Calculates the Error rate of linear classifier (L2) metric.

Returns error rate of Linear SVM classifer used within the dataset.

\[L2=\frac{\sum^{n}_{i=1}I(h(x_i)\neq y_i)}{n}\]
Parameters:
  • X (array-like, shape (n_samples, n_features)) – Dataset

  • y (array-like, shape (n_samples)) – Labels

Return type:

float

Returns:

L2 score

problexity.classification.l3(X, y)

Calculates the Non linearity of linear classifier (L3) metric.

Linearly interpolating instances of each class generate the additional instances of the problem, which are used to calculate this measure. The class of original instances determines the label of an augmented point. The Linear SVM classifier is used to classify the synthesized points of the dataset. The number of synthetic points is equal to the original dataset size.

\[L3=\frac{1}{l}\sum^{l}_{i=1}I(h_T(x'_i) \neq y'_i)\]
Parameters:
  • X (array-like, shape (n_samples, n_features)) – Dataset

  • y (array-like, shape (n_samples)) – Labels

Return type:

float

Returns:

L3 score

Regression measures

l1(X, y[, normalize])

Calculates the mean absolute error (L1) metric.

l2(X, y[, normalize])

Calculates the residuals variance (L2) metric.

problexity.regression.l1(X, y, normalize=True)

Calculates the mean absolute error (L1) metric.

Measure returns average error of linear regression model. By default performs a 0-1 interval normalization.

\[L1=\sum_{i=1}^{n}\frac{|\epsilon_i|}{n}\]
Parameters:
  • X (array-like, shape (n_samples, n_features)) – Dataset

  • y (array-like, shape (n_samples)) – Labels

Return type:

float

Returns:

L1 score

problexity.regression.l2(X, y, normalize=True)

Calculates the residuals variance (L2) metric.

Measure returns average of squared residuals of linear regression model. By default performs a 0-1 interval normalization.

\[L2=\sum_{i=1}^{n}\frac{\epsilon_i^2}{n}\]
Parameters:
  • X (array-like, shape (n_samples, n_features)) – Dataset

  • y (array-like, shape (n_samples)) – Labels

Return type:

float

Returns:

L2 score