skmetrics.classification module#

Scikit-learn-compatible metrics for classification problems.

@author: David Diaz Vico @license: MIT

skmetrics.classification.g_score(y_true, y_pred, eps=None, sparse=False)[source]#

G-score

Calculates the G-score: sqrt(prod(true_rates)).

Parameters:
  • y_true (array-like, shape = [n_samples]) – Ground truth (correct) target values.

  • y_pred (array-like, shape = [n_samples]) – Estimated targets as returned by a classifier.

  • eps (None or float, optional.) – If a float, that value is added to all values in the contingency matrix. This helps to stop NaN propagation. If None, nothing is adjusted.

  • sparse (boolean, optional.) – If True, return a sparse CSR continency matrix. If eps is not None, and sparse is True, will throw ValueError.

Returns:

g – G-score.

Return type:

float

skmetrics.classification.geometric_roc_auc_score(y_true, y_score, pos_label=None, sample_weight=None, drop_intermediate=True, reorder=False)[source]#

Multiclass Geometric ROC AUC score

Calculates the multiclass geometric mean ROC AUC score: http://scikit-learn.org/stable/auto_examples/model_selection/plot_roc.html.

Parameters:
  • y_true (array-like, shape = [n_samples]) – Ground truth (correct) target values.

  • y_pred (array-like, shape = [n_samples]) – Estimated targets as returned by a classifier.

  • pos_label (int or str, default=None) – Label considered as positive and others are considered negative.

  • sample_weight (array-like of shape = [n_samples], optional) – Sample weights.

  • drop_intermediate (boolean, optional (default=True)) – Whether to drop some suboptimal thresholds which would not appear on a plotted ROC curve. This is useful in order to create lighter ROC curves.

  • reorder (boolean, optional (default=False)) – If True, assume that the curve is ascending in the case of ties, as for an ROC curve. If the curve is non-ascending, the result will be wrong.

Returns:

gaur – Multiclass Geometric ROC AUC score.

Return type:

float

skmetrics.classification.separability_score(y_true, y_pred)[source]#

Separability score

Calculates the separability score.

Parameters:
  • y_true (array-like, shape = [n_samples]) – Ground truth (correct) target values.

  • y_pred (array-like, shape = [n_samples]) – Projections returned by a transformer.

Returns:

s – Separability score.

Return type:

float