Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOC] Add estimator overview table with capabilities #1426

Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 89 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,10 @@ def find_source():
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]
html_css_files = ["css/custom.css"]
html_css_files = [
"css/custom.css",
]
html_js_files = []
baraline marked this conversation as resolved.
Show resolved Hide resolved

html_show_sourcelink = False

Expand All @@ -288,7 +291,13 @@ def find_source():
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, "aeon.tex", "aeon Documentation", "aeon developers", "manual"),
(
master_doc,
"aeon.tex",
"aeon Documentation",
"aeon developers",
"manual",
),
]

# -- Options for manual page output ------------------------------------------
Expand All @@ -314,6 +323,84 @@ def find_source():
),
]


def _make_estimator_overview(app):
"""Make estimator overview table."""
import pandas as pd

from aeon.registry import all_estimators

def _does_not_start_with_underscore(input_string):
return not input_string.startswith("_")

# Columns for the output table
COLNAMES = ["Estimator name", "Module", "Family of method"]
baraline marked this conversation as resolved.
Show resolved Hide resolved
capabilities_to_include = [
"multivariate",
"unequal_length",
"missing_values",
]

for capability_name in capabilities_to_include:
_str = capability_name.replace("_", " ")
COLNAMES.append(f"Support {_str}")
baraline marked this conversation as resolved.
Show resolved Hide resolved

data = {k: [] for k in COLNAMES}

for estimator_name, estimator_class in all_estimators():
algorithm_type = "::".join(str(estimator_class).split(".")[1:-2])
# fetch tags
tag_dict = estimator_class.get_class_tags()

# includes part of class string
modpath = str(estimator_class)[8:-2]
path_parts = modpath.split(".")
# joins strings excluding starting with '_'
clean_path = ".".join(list(filter(_does_not_start_with_underscore, path_parts)))
# adds html link reference
estimator_name_as_link = str(
'<a href="https://www.aeon-toolkit.org/en/latest/api_reference'
+ "/auto_generated/"
baraline marked this conversation as resolved.
Show resolved Hide resolved
+ clean_path
+ '.html">'
+ estimator_name
+ "</a>"
)
algorithm_type = algorithm_type.split("::")
data["Estimator name"].append(estimator_name_as_link)
data["Module"].append(algorithm_type[0])
if len(algorithm_type) > 1:
data["Family of method"].append("/".join(algorithm_type[1:]))
baraline marked this conversation as resolved.
Show resolved Hide resolved
else:
data["Family of method"].append("N/A")
for capability_name in capabilities_to_include:
_val = tag_dict.get(f"capability:{capability_name}")
_str = capability_name.replace("_", " ")

# For case where tag is not included output as not supported.
if not _val or _val is None:
data[f"Support {_str}"].append("\u274C")
else:
data[f"Support {_str}"].append("\u2705")
baraline marked this conversation as resolved.
Show resolved Hide resolved

df = pd.DataFrame.from_dict(data).sort_values(
by=["Module", "Family of method", "Estimator name"]
baraline marked this conversation as resolved.
Show resolved Hide resolved
)
df_str = df.to_markdown(index=False, tablefmt="github")
with open("estimator_overview_table.md", "w", encoding="utf-8") as file:
file.write(df_str)


def setup(app):
"""Set up sphinx builder.

Parameters
----------
app : Sphinx application object
"""
app.connect("builder-inited", _make_estimator_overview)


# -- Extension configuration -------------------------------------------------

# -- Options for nbsphinx extension ---------------------------------------
Expand Down
6 changes: 6 additions & 0 deletions docs/estimator_overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Estimator Overview

The table below gives an overview of all estimators in aeon and their capabilities.

```{include} estimator_overview_table.md
```
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ code_of_conduct.md
:hidden:

glossary.md
estimator_overview.md
changelog.md
papers_using_aeon.md
```