Implementation:Scikit learn Scikit learn ApiReference
| Knowledge Sources | |
|---|---|
| Domains | Documentation, API Design |
| Last Updated | 2026-02-08 15:00 GMT |
Overview
Concrete tool for configuring the API reference documentation structure provided by scikit-learn.
Description
This module defines the complete API reference configuration for scikit-learn's documentation. It maps each sklearn module to a structured dictionary containing short summaries, descriptions, and organized sections with autosummary blocks. The configuration drives the generation of API reference pages for all public classes and functions across every sklearn submodule, from calibration to utils.
Usage
Use this configuration module when modifying the structure of scikit-learn's API reference documentation, adding new modules, or reorganizing how classes and functions are presented in the documentation.
Code Reference
Source Location
- Repository: scikit-learn
- File: doc/api_reference.py
Signature
def _get_guide(*refs, is_developer=False)
def _get_submodule(module_name, submodule_name)
# Main data structure:
API_REFERENCE = {
"sklearn.calibration": {...},
"sklearn.cluster": {...},
# ... all sklearn modules
}
Import
# Used internally by the Sphinx documentation build
from api_reference import API_REFERENCE
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| refs | str (variadic) | Yes | RST reference labels for user/developer guide links |
| is_developer | bool | No | Whether to link to developer guide instead of user guide (default: False) |
| module_name | str | Yes | Full module path (e.g., 'sklearn.feature_extraction') |
| submodule_name | str | Yes | Submodule name (e.g., 'image') |
Outputs
| Name | Type | Description |
|---|---|---|
| API_REFERENCE | dict | Complete mapping of module names to documentation structure |
| guide text | str | Formatted RST text for user/developer guide references |
| submodule text | str | RST automodule directives for submodule documentation |
Usage Examples
Basic Usage
# Helper function usage within the documentation build
from api_reference import _get_guide, _get_submodule
# Generate a user guide reference
guide_text = _get_guide("clustering", "kmeans")
# Returns: "**User guide.** See the :ref:`clustering` and :ref:`kmeans` sections ..."
# Generate submodule documentation hook
submodule_text = _get_submodule("sklearn.feature_extraction", "image")