imblearn.metrics.make_index_balanced_accuracy(alpha=0.1, squared=True)[source][source]

Balance any scoring function using the index balanced accuracy

This factory function wraps scoring function to express it as the index balanced accuracy (IBA). You need to use this function to decorate any scoring function.

Only metrics requiring y_pred can be corrected with the index balanced accuracy. y_score cannot be used since the dominance cannot be computed.

Read more in the User Guide.

alpha : float, optional (default=0.1)

Weighting factor.

squared : bool, optional (default=True)

If squared is True, then the metric computed will be squared before to be weighted.

iba_scoring_func : callable,

Returns the scoring metric decorated which will automatically compute the index balanced accuracy.


See Metrics specific to imbalanced learning.


[1]García, Vicente, Javier Salvador Sánchez, and Ramón Alberto Mollineda. “On the effectiveness of preprocessing methods when dealing with different levels of class imbalance.” Knowledge-Based Systems 25.1 (2012): 13-21.


>>> from imblearn.metrics import geometric_mean_score as gmean
>>> from imblearn.metrics import make_index_balanced_accuracy as iba
>>> gmean = iba(alpha=0.1, squared=True)(gmean)
>>> y_true = [1, 0, 0, 1, 0, 1]
>>> y_pred = [0, 0, 1, 1, 0, 1]
>>> print(gmean(y_true, y_pred, average=None))
[ 0.44444444  0.44444444]

Examples using imblearn.metrics.make_index_balanced_accuracy