Skip to content

Commit

Permalink
Accept a --metric for the classification CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
danlamanna committed Dec 20, 2020
1 parent 756e928 commit c5b8249
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions isic_challenge_scoring/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import click
import click_pathlib

from isic_challenge_scoring.classification import ClassificationScore
from isic_challenge_scoring.classification import ClassificationMetric, ClassificationScore
from isic_challenge_scoring.segmentation import SegmentationScore
from isic_challenge_scoring.types import ScoreException

Expand Down Expand Up @@ -40,11 +40,19 @@ def segmentation(ctx: click.Context, truth_dir: pathlib.Path, prediction_dir: pa
@click.pass_context
@click.argument('truth_file', type=FilePath)
@click.argument('prediction_file', type=FilePath)
@click.option(
'-m',
'--metric',
type=click.Choice([metric.value for metric in ClassificationMetric]),
default=ClassificationMetric.BALANCED_ACCURACY.value,
)
def classification(
ctx: click.Context, truth_file: pathlib.Path, prediction_file: pathlib.Path
ctx: click.Context, truth_file: pathlib.Path, prediction_file: pathlib.Path, metric: str
) -> None:
try:
score = ClassificationScore.from_file(truth_file, prediction_file)
score = ClassificationScore.from_file(
truth_file, prediction_file, ClassificationMetric(metric)
)
except ScoreException as e:
raise click.ClickException(str(e))

Expand Down

0 comments on commit c5b8249

Please sign in to comment.