Skip to content

Commit dbcd003

Browse files
author
Guillaume Lemaitre
committed
Add a single test for IBA
1 parent 4137bbf commit dbcd003

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

imblearn/metrics/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
from .classification import sensitivity_score
88
from .classification import specificity_score
99
from .classification import geometric_mean_score
10+
from .classification import indexed_balanced_accuracy_score
1011

1112
__all__ = [
12-
'sensitivity_specificity_support',
13-
'sensitivity_score',
14-
'specificity_score',
15-
'geometric_mean_score'
13+
'sensitivity_specificity_support', 'sensitivity_score',
14+
'specificity_score', 'geometric_mean_score',
15+
'indexed_balanced_accuracy_score'
1616
]

imblearn/metrics/classification.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ def indexed_balanced_accuracy_score(score_func,
547547
analysis of a performance measure for imbalanced data" ICPR (2010)
548548
"""
549549

550-
score = score_func(**kwargs)
550+
score = score_func(y_true, y_pred, **kwargs)
551551

552552
if squared:
553553
score = np.power(score, 2)

imblearn/metrics/tests/test_classification.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from imblearn.metrics import sensitivity_score
2323
from imblearn.metrics import specificity_score
2424
from imblearn.metrics import geometric_mean_score
25+
from imblearn.metrics import indexed_balanced_accuracy_score
2526

2627
RND_SEED = 42
2728

@@ -232,3 +233,13 @@ def test_geometric_mean_multiclass():
232233

233234
geo_mean = geometric_mean_score(y_true, y_pred, average='weighted')
234235
assert_array_almost_equal(geo_mean, 0.65, 2)
236+
237+
238+
def test_iba_geo_mean_binary():
239+
"""Test to test the iba using the geometric mean"""
240+
y_true, y_pred, _ = make_prediction(binary=True)
241+
242+
iba = indexed_balanced_accuracy_score(
243+
geometric_mean_score, y_true, y_pred, alpha=0.5, squared=True)
244+
245+
assert_almost_equal(iba, 0.54, 2)

0 commit comments

Comments
 (0)