-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[REF] Refactor
performance_metrics
into benchmarking.metrics
and …
…use a local version of `sphinx-remove-toctrees` (#2353) * refactor metrics * doc fixes * suggested changes * fix
- Loading branch information
1 parent
344c831
commit 78f025e
Showing
27 changed files
with
224 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Performance metrics.""" |
38 changes: 19 additions & 19 deletions
38
...nce_metrics/anomaly_detection/__init__.py → ...ing/metrics/anomaly_detection/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,37 @@ | ||
"""Metrics for anomaly detection.""" | ||
|
||
from aeon.performance_metrics.anomaly_detection._binary import ( | ||
__all__ = [ | ||
"range_precision", | ||
"range_recall", | ||
"range_f_score", | ||
"roc_auc_score", | ||
"pr_auc_score", | ||
"rp_rr_auc_score", | ||
"f_score_at_k_points", | ||
"f_score_at_k_ranges", | ||
"range_pr_roc_auc_support", | ||
"range_roc_auc_score", | ||
"range_pr_auc_score", | ||
"range_pr_vus_score", | ||
"range_roc_vus_score", | ||
] | ||
|
||
from aeon.benchmarking.metrics.anomaly_detection._binary import ( | ||
range_f_score, | ||
range_precision, | ||
range_recall, | ||
) | ||
from aeon.performance_metrics.anomaly_detection._continuous import ( | ||
from aeon.benchmarking.metrics.anomaly_detection._continuous import ( | ||
f_score_at_k_points, | ||
f_score_at_k_ranges, | ||
pr_auc_score, | ||
roc_auc_score, | ||
rp_rr_auc_score, | ||
) | ||
from aeon.performance_metrics.anomaly_detection._vus_metrics import ( | ||
from aeon.benchmarking.metrics.anomaly_detection._vus_metrics import ( | ||
range_pr_auc_score, | ||
range_pr_roc_auc_support, | ||
range_pr_vus_score, | ||
range_roc_auc_score, | ||
range_roc_vus_score, | ||
) | ||
|
||
__all__ = [ | ||
"range_precision", | ||
"range_recall", | ||
"range_f_score", | ||
"roc_auc_score", | ||
"pr_auc_score", | ||
"rp_rr_auc_score", | ||
"f_score_at_k_points", | ||
"f_score_at_k_ranges", | ||
"range_pr_roc_auc_support", | ||
"range_roc_auc_score", | ||
"range_pr_auc_score", | ||
"range_pr_vus_score", | ||
"range_roc_vus_score", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
"top_k_ranges_threshold", | ||
] | ||
|
||
|
||
import numpy as np | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
4 changes: 1 addition & 3 deletions
4
..._metrics/tests/test_clustering_metrics.py → ...hmarking/metrics/tests/test_clustering.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
"""A small sphinx extension to remove toctrees. | ||
Original extension: | ||
https://github.com/executablebooks/sphinx-remove-toctrees | ||
This file was adapted by the developers of the MNE-LSL project, this is just | ||
a copy for use in the aeon documentation. | ||
https://github.com/mne-tools/mne-lsl | ||
https://github.com/mne-tools/mne-lsl/blob/main/doc/_sphinxext/sphinx_remove_toctrees.py | ||
""" | ||
|
||
from pathlib import Path | ||
|
||
from sphinx import addnodes | ||
|
||
|
||
def remove_toctrees(app, env): | ||
"""Remove toctrees from pages a user provides. | ||
This happens at the end of the build process, so even though the toctrees | ||
are removed, it won't raise sphinx warnings about unreferenced pages. | ||
""" | ||
patterns = app.config.remove_from_toctrees | ||
if isinstance(patterns, str): | ||
patterns = [patterns] | ||
|
||
# figure out the list of patterns to remove from all toctrees | ||
to_remove = [] | ||
for pattern in patterns: | ||
# inputs should either be a glob pattern or a direct path so just use glob | ||
srcdir = Path(env.srcdir) | ||
for matched in srcdir.glob(pattern): | ||
to_remove.append( | ||
str(matched.relative_to(srcdir).with_suffix("").as_posix()) | ||
) | ||
|
||
# loop through all tocs and remove the ones that match our pattern | ||
for _, tocs in env.tocs.items(): | ||
for toctree in tocs.traverse(addnodes.toctree): | ||
new_entries = [] | ||
for entry in toctree.attributes.get("entries", []): | ||
if entry[1] not in to_remove: | ||
new_entries.append(entry) | ||
# if there are no more entries just remove the toctree | ||
if len(new_entries) == 0: | ||
toctree.parent.remove(toctree) | ||
else: | ||
toctree.attributes["entries"] = new_entries | ||
|
||
|
||
def setup(app): # noqa: D103 | ||
app.add_config_value("remove_from_toctrees", [], "html") | ||
app.connect("env-updated", remove_toctrees) | ||
return {"parallel_read_safe": True, "parallel_write_safe": True} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.