Generate the estimator tables from one source - #73
Merged
Conversation
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>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
TKDD'12, the table right below it saidTKDD2022. On the same page. The paper is TKDD 2012, so the matrix was right and the table wrong."Isolation Distribution Kernel for Trajectory Anomaly Detections"— that is IKAT's description, copy-pasted. It is a streaming hierarchical clustering algorithm."Distribution-based Tajectory Clustering"IsoDisKernel"IsodisKernel", and the classSTREAMKHC"StreaKHC".What can and cannot be generated
Only half of each table is in the code:
__all__of each module — derivedReferencessection, 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.pyholds 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: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:
Point Anomaly DetectionnotPoint Anomaly detection,Graph MiningnotGraph Data.__all__order, matching the API reference.<br>instead of spilling into blank rows with empty leading cells.i, ii, iii, IV, V, VI, VII, VIII).Verification
Four behaviours tested directly:
--checkwhen in sync--checkafter a hand edit to a table--checkafter re-aligning table pipes--checkwith an estimator removed fromESTIMATORSmkdocs build --strictpasses — 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