Skip to content

Generate the estimator tables from one source - #73

Merged
xhan97 merged 1 commit into
mainfrom
docs/single-source-tables
Aug 16, 2026
Merged

Generate the estimator tables from one source#73
xhan97 merged 1 commit into
mainfrom
docs/single-source-tables

Conversation

@xhan97

@xhan97 xhan97 commented Aug 16, 2026

Copy link
Copy Markdown
Collaborator

The tables listing what IKPyKit implements existed in three places: the root README.md, docs/README.md, and — since the API reference became generated — api/index.md. The two READMEs share 120 identical lines.

The drift this was hiding

Comparing the copies turned up four errors that had been sitting there:

IForest publication The summary matrix said TKDD'12, the table right below it said TKDD2022. On the same page. The paper is TKDD 2012, so the matrix was right and the table wrong.
STREAMKHC description "Isolation Distribution Kernel for Trajectory Anomaly Detections" — that is IKAT's description, copy-pasted. It is a streaming hierarchical clustering algorithm.
TIDKC "Distribution-based Tajectory Clustering"
Names The matrix called IsoDisKernel "IsodisKernel", and the class STREAMKHC "StreaKHC".

What can and cannot be generated

Only half of each table is in the code:

Column Source
Abbr + link __all__ of each module — derived
Algorithm Often the paper title, not the docstring summary — not derivable
Application Not in the code
Publication The venue is in the docstring References section, but as free-form prose ("In Proceedings of the AAAI Conference on Artificial Intelligence, Vol. 33, 2019, July, pp. 4755-4762"AAAI2019). Parsing that would be fragile.

So scripts/estimators.py holds what the code does not state, one entry per estimator, and renders all the tables from it. Three copies become one. Not zero maintenance, but adding an estimator is now one entry instead of three tables.

check_complete() fails the build when a public class has no entry, or an entry has no class:

No entry in ESTIMATORS for INNE. Add one in scripts/estimators.py so the tables include it.

That is the part the old setup lacked entirely — a missing estimator just silently wasn't in the tables.

Keeping the root README in step

The root README never passes through MkDocs, so no plugin can reach it. Both READMEs carry the tables between markers, filled in by scripts/sync_readme_tables.py.

The lint job runs it with --check — that is the real gate, since the pre-commit hook only helps people who installed it. Both are wired up.

The comparison ignores padding around table pipes, so an editor or formatter realigning a table does not read as drift and start a rewrite war with the generator.

Other content changes

Single-sourcing means everything now agrees, which moves some things:

  • Sections use the names the docs navigation already uses — Point Anomaly Detection not Point Anomaly detection, Graph Mining not Graph Data.
  • Rows follow __all__ order, matching the API reference.
  • Estimators sharing a summary-matrix cell are joined with <br> instead of spilling into blank rows with empty leading cells.
  • The API overview gained a publication column from the same data.
  • Roman numerals are consistently lowercase (they ran i, ii, iii, IV, V, VI, VII, VIII).

Verification

Four behaviours tested directly:

Test Result
--check when in sync exit 0
--check after a hand edit to a table exit 1, names the file
--check after re-aligning table pipes exit 0 (padding tolerated)
--check with an estimator removed from ESTIMATORS exit 1, names the class

mkdocs build --strict passes — which also validates that every relative link in the docs README resolves to a generated API page. All pre-commit hooks pass.

🤖 Generated with Claude Code

The tables listing what IKPyKit implements existed in three places: the root
README, docs/README.md, and, since the API reference became generated,
api/index.md. They had drifted, and the drift is the kind nobody notices:

  - IForest was published at TKDD in 2012. The summary matrix said TKDD'12 and
    the table below it said TKDD2022, on the same page.
  - STREAMKHC was described as "Isolation Distribution Kernel for Trajectory
    Anomaly Detections", which is IKAT's description, copied.
  - TIDKC's said "Tajectory".
  - The matrix called IsoDisKernel "IsodisKernel", and the class STREAMKHC
    "StreaKHC".

Only half of each table can come from the code. The class names come from the
__all__ of each module and the descriptions from the docstrings, but the
application label and the publication venue are nowhere in the package. So
scripts/estimators.py holds those, one entry per estimator, and renders every
table from them. Adding an estimator means one entry instead of three tables,
and check_complete() fails the build when a public class has no entry, rather
than leaving it silently absent the way the old tables did.

The root README never passes through MkDocs, so no plugin can reach it. Both
READMEs carry the tables between markers instead, filled in by
scripts/sync_readme_tables.py. The lint job runs it with --check; a pre-commit
hook runs the same check for anyone who installed the hooks. The comparison
ignores the padding around table pipes, so a formatter realigning them does not
read as drift.

Content that changes as a result, beyond the fixes above: sections use the
names the docs navigation already uses ("Point Anomaly Detection" rather than
"Point Anomaly detection", "Graph Mining" rather than "Graph Data"), rows
follow __all__ order, and estimators sharing a cell in the summary matrix are
separated by <br> rather than spilling into blank rows. The API overview gained
a publication column from the same data.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@xhan97
xhan97 merged commit c982398 into main Aug 16, 2026
17 checks passed
@xhan97
xhan97 deleted the docs/single-source-tables branch August 16, 2026 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant