Skip to content

Commit

Permalink
Merge pull request #110 from ImageMarkup/category-score-weight
Browse files Browse the repository at this point in the history
Refactor _category_score to take a single set of weights
  • Loading branch information
brianhelba authored Dec 2, 2020
2 parents 8fc465f + e780afa commit 39e9e2a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions isic_challenge_scoring/classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__(
self._category_score(
truth_probabilities[category],
prediction_probabilities[category],
truth_weights,
truth_weights.score_weight,
category,
)
for category in categories
Expand Down Expand Up @@ -69,7 +69,7 @@ def __init__(
def _category_score(
truth_category_probabilities: pd.Series,
prediction_category_probabilities: pd.Series,
truth_weights: pd.DataFrame,
truth_score_weights: pd.Series,
category: str,
) -> pd.Series:
truth_binary_values: pd.Series = truth_category_probabilities.gt(0.5)
Expand All @@ -78,7 +78,7 @@ def _category_score(
category_cm = create_binary_confusion_matrix(
truth_binary_values=truth_binary_values.to_numpy(),
prediction_binary_values=prediction_binary_values.to_numpy(),
weights=truth_weights.score_weight.to_numpy(),
weights=truth_score_weights.to_numpy(),
name=category,
)

Expand All @@ -93,18 +93,18 @@ def _category_score(
'auc': metrics.auc(
truth_category_probabilities,
prediction_category_probabilities,
truth_weights.score_weight,
truth_score_weights,
),
'auc_sens_80': metrics.auc_above_sensitivity(
truth_category_probabilities,
prediction_category_probabilities,
truth_weights.score_weight,
truth_score_weights,
0.80,
),
'ap': metrics.average_precision(
truth_category_probabilities,
prediction_category_probabilities,
truth_weights.score_weight,
truth_score_weights,
),
},
index=[
Expand Down

0 comments on commit 39e9e2a

Please sign in to comment.