Skip to content

Commit 39e9e2a

Browse files
authored
Merge pull request #110 from ImageMarkup/category-score-weight
Refactor _category_score to take a single set of weights
2 parents 8fc465f + e780afa commit 39e9e2a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

isic_challenge_scoring/classification.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def __init__(
3232
self._category_score(
3333
truth_probabilities[category],
3434
prediction_probabilities[category],
35-
truth_weights,
35+
truth_weights.score_weight,
3636
category,
3737
)
3838
for category in categories
@@ -69,7 +69,7 @@ def __init__(
6969
def _category_score(
7070
truth_category_probabilities: pd.Series,
7171
prediction_category_probabilities: pd.Series,
72-
truth_weights: pd.DataFrame,
72+
truth_score_weights: pd.Series,
7373
category: str,
7474
) -> pd.Series:
7575
truth_binary_values: pd.Series = truth_category_probabilities.gt(0.5)
@@ -78,7 +78,7 @@ def _category_score(
7878
category_cm = create_binary_confusion_matrix(
7979
truth_binary_values=truth_binary_values.to_numpy(),
8080
prediction_binary_values=prediction_binary_values.to_numpy(),
81-
weights=truth_weights.score_weight.to_numpy(),
81+
weights=truth_score_weights.to_numpy(),
8282
name=category,
8383
)
8484

@@ -93,18 +93,18 @@ def _category_score(
9393
'auc': metrics.auc(
9494
truth_category_probabilities,
9595
prediction_category_probabilities,
96-
truth_weights.score_weight,
96+
truth_score_weights,
9797
),
9898
'auc_sens_80': metrics.auc_above_sensitivity(
9999
truth_category_probabilities,
100100
prediction_category_probabilities,
101-
truth_weights.score_weight,
101+
truth_score_weights,
102102
0.80,
103103
),
104104
'ap': metrics.average_precision(
105105
truth_category_probabilities,
106106
prediction_category_probabilities,
107-
truth_weights.score_weight,
107+
truth_score_weights,
108108
),
109109
},
110110
index=[

0 commit comments

Comments
 (0)