Skip to content

Commit

Permalink
updates evaluate_classifications
Browse files Browse the repository at this point in the history
  • Loading branch information
lizgehret committed Oct 2, 2024
1 parent 4bede4d commit c4e2302
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
11 changes: 6 additions & 5 deletions rescript/cross_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def evaluate_classifications(ctx,
expected_taxonomies,
observed_taxonomies,
labels=None):
volatility = ctx.get_action('longitudinal', 'volatility')
lineplot = ctx.get_action('vizard', 'lineplot')
# Validate inputs.
if len(expected_taxonomies) != len(observed_taxonomies):
raise ValueError('Expected and Observed Taxonomies do not match. '
Expand Down Expand Up @@ -201,10 +201,11 @@ def evaluate_classifications(ctx,
# convert index to strings
precision_recall.index = pd.Index(
[str(i) for i in range(1, len(precision_recall.index) + 1)], name='id')
plots, = volatility(metadata=q2.Metadata(precision_recall),
state_column='Level',
default_group_column='Dataset',
default_metric='F-Measure')
plots, = lineplot(metadata=q2.Metadata(precision_recall),
x_measure='Level',
y_measure='F-Measure',
group_by='Dataset',
title='RESCRIPt Evaluate Classifications')
return plots


Expand Down
6 changes: 3 additions & 3 deletions rescript/plugin_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
'CC BY-SA 4.0. To learn more, please visit https://unite.ut.ee/cite.php '
'and https://creativecommons.org/licenses/by-sa/4.0/.')

VOLATILITY_PLOT_XAXIS_INTERPRETATION = (
LINEPLOT_XAXIS_INTERPRETATION = (
'The x-axis in these plots represents the taxonomic '
'levels present in the input taxonomies so are labeled numerically '
'instead of by rank, but typically for 7-level taxonomies these will '
Expand Down Expand Up @@ -225,7 +225,7 @@
'sets of true taxonomic labels to the predicted taxonomies for the '
'same set(s) of features. Output an interactive line plot of '
'classification accuracy for each pair of expected/observed '
'taxonomies. ' + VOLATILITY_PLOT_XAXIS_INTERPRETATION),
'taxonomies. ' + LINEPLOT_XAXIS_INTERPRETATION),
citations=[citations['bokulich2018optimizing'],
citations['bokulich2017q2']]
)
Expand Down Expand Up @@ -395,7 +395,7 @@
'unique labels, taxonomic entropy, and the number of features that '
'are (un)classified at each taxonomic level. This action is useful '
'for both reference taxonomies and classification results. ' +
VOLATILITY_PLOT_XAXIS_INTERPRETATION),
LINEPLOT_XAXIS_INTERPRETATION),
citations=[citations['bokulich2017q2']]
)

Expand Down

0 comments on commit c4e2302

Please sign in to comment.