Skip to content

docs: add mkdocs-material site with API reference and GitHub Pages deployment (#16) - #24

Merged
adaumsilva merged 5 commits into
adaumsilva:mainfrom
prannoydidymus:feat/docs-mkdocs-site
Oct 4, 2026
Merged

adaumsilva merged 5 commits into
adaumsilva:mainfrom
prannoydidymus:feat/docs-mkdocs-site

Conversation

@prannoydidymus

Copy link
Copy Markdown
Contributor

What

Closes #16

Adds a documentation site built with mkdocs-material and mkdocstrings, documents mathematical formulations for each explainer, adds an extending guide and API reference, configures GitHub Pages deployment, and streamlines the README to focus on the quick start.

Why

The README was growing long. A dedicated documentation site separates the quick start from deep method explanations, mathematical details, and the full API reference generated from docstrings.

How

  • mkdocs.yml: Configured material theme with MathJax math rendering, code copy buttons, search, and mkdocstrings[python] handler with numpy docstring style.
  • Pages:
    • docs/index.md & docs/getting-started.md: Overview and step-by-step tutorial for local and global explanations.
    • docs/methods/: Explainer pages with concise mathematics for coalition (Shapley cooperative games, axioms, sampling), surrogate (local linear model, proximity kernel, weighted Ridge), and permutation (loss drops, smooth log-loss, held-out data).
    • docs/methods/consensus.md: Scale normalization, weighted mean / Borda rank aggregation, and Spearman rank agreement ($\rho$).
    • docs/extending.md: Guide on subclassing BaseExplainer and packaging custom explainers via entry points.
    • docs/api/: API reference pages for auto, explainers, explanation, model, and registry.
    • docs/changelog.md: Embedded changelog.
  • Workflows:
    • .github/workflows/docs.yml: Builds and deploys documentation to GitHub Pages on push to main.
    • .github/workflows/ci.yml: Added strict docs build validation (mkdocs build --strict).
  • README & CHANGELOG:
    • README.md: Streamlined to keep the quick start and added direct navigation links to the docs site.
    • pyproject.toml: Added docs optional dependencies.
    • CHANGELOG.md: Logged release notes under [Unreleased].

Checklist

  • Tests added / updated and pytest passes (91 passed)
  • ruff check and ruff format --check pass
  • Docs / README / CHANGELOG updated where relevant
  • Randomness goes through self.rng (reproducible with random_state)

…ployment (adaumsilva#16)

- Setup mkdocs.yml with mkdocs-material and mkdocstrings[python]

- Add pages: Getting started, Methods (coalition, surrogate, permutation, consensus), Extending, API reference, and Changelog

- Configure GitHub Actions workflow deploying to GitHub Pages on push to main and strict docs build check in CI

- Streamline README to focus on quick start and link to documentation site
@prannoydidymus

Copy link
Copy Markdown
Contributor Author

The work did take a lot of time and helps from various sources and I may be wrong in things that I have done but do review them and comment back if there is any error.

@prannoydidymus

Copy link
Copy Markdown
Contributor Author

Hello, is it accepted or changes needed ?

Updated permissions for contents and improved job steps for documentation build and deployment.
@adaumsilva

Copy link
Copy Markdown
Owner

Thanks for adding the documentation site @prannoydidymus ! The structure and API reference are useful, but several examples and formulas need corrections before merging:

  1. Fix the custom explainer example (docs/extending.md, lines 32–51). Running it raises AttributeError because ModelAdapter.predict_scalar() does not exist. Use self._predict_scalar(..., target)[0] to obtain each scalar prediction. Also replace instance=x with x=x in _make_explanation() and pass step_size=eps directly instead of nesting it inside metadata.

  2. Correct the Borda formula (docs/methods/consensus.md, lines 30–35). The implementation uses (n_features - rank + 1) / n_features, averages these scores using normalized method weights, and applies the mean direction. The documented formula instead gives larger scores to less important features and introduces a normalization absent from the implementation.

  3. Correct the surrogate description (docs/methods/surrogate.md, lines 13–38). Default perturbations are centered on the background mean; centering on the instance requires sample_around_instance=True. The kernel is exp(-D² / (2 * kernel_width²)). Continuous-feature contributions use standardized values, coef_i * (x_i - mean_i) / std_i, with categorical features handled through indicator encoding.

  4. Fix permutation metrics and uncertainty terminology (docs/methods/permutation.md, lines 24–39). Both metric="mse" and metric="roc_auc" raise ValueError. Document the supported names, including neg_mse and neg_mae; ROC AUC requires a custom callable. Also, importances_std is the population standard deviation across repeats (ddof=0), not a standard error or sample standard deviation.

Please also resolve the README conflict with current main, preserving the notebook link introduced by #23, and add executable smoke checks for the documentation examples.

The documentation builds pass, but these issues affect users following the guides, so I’m requesting changes.

@adaumsilva adaumsilva left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the documentation site! The structure and API reference are useful, but several examples and formulas need corrections before merging:

  1. Fix the custom explainer example (docs/extending.md, lines 32–51). Running it raises AttributeError because ModelAdapter.predict_scalar() does not exist. Use self._predict_scalar(..., target)[0] to obtain each scalar prediction. Also replace instance=x with x=x in _make_explanation() and pass step_size=eps directly instead of nesting it inside metadata.

  2. Correct the Borda formula (docs/methods/consensus.md, lines 30–35). The implementation uses (n_features - rank + 1) / n_features, averages these scores using normalized method weights, and applies the mean direction. The documented formula instead gives larger scores to less important features and introduces a normalization absent from the implementation.

  3. Correct the surrogate description (docs/methods/surrogate.md, lines 13–38). Default perturbations are centered on the background mean; centering on the instance requires sample_around_instance=True. The kernel is exp(-D² / (2 * kernel_width²)). Continuous-feature contributions use standardized values, coef_i * (x_i - mean_i) / std_i, with categorical features handled through indicator encoding.

  4. Fix permutation metrics and uncertainty terminology (docs/methods/permutation.md, lines 24–39). Both metric="mse" and metric="roc_auc" raise ValueError. Document the supported names, including neg_mse and neg_mae; ROC AUC requires a custom callable. Also, importances_std is the population standard deviation across repeats (ddof=0), not a standard error or sample standard deviation.

Please also resolve the README conflict with current main, preserving the notebook link introduced by #23, and add executable smoke checks for the documentation examples.

The documentation builds pass, but these issues affect users following the guides, so I’m requesting changes.

… smoke checks

- Fix custom explainer example in docs/extending.md using _predict_scalar and x=x

- Correct Borda formula and weighting in docs/methods/consensus.md

- Correct surrogate perturbations, proximity kernel, and standardized feature contributions in docs/methods/surrogate.md

- Correct permutation metrics, custom callable instructions, and population standard deviation in docs/methods/permutation.md

- Add executable smoke checks for documentation examples in tests/test_docs_smoke.py
@prannoydidymus

prannoydidymus commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor Author

Please review if the work done is enough @adaumsilva

@adaumsilva
adaumsilva merged commit cfd14ce into adaumsilva:main Oct 4, 2026
10 checks passed
@adaumsilva

Copy link
Copy Markdown
Owner

Thanks for contributing @prannoydidymus PR Merged! Good job! Remember to star the repo if you didn't yet.

@prannoydidymus

Copy link
Copy Markdown
Contributor Author

Thank you so much, @adaumsilva! It was a pleasure contributing to your repository. I really appreciate the opportunity and enjoyed working on it.

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.

Documentation site (mkdocs-material) with API reference

2 participants