Chapter I
Orientation: How scikit-learn is put together
scikit-learn is organized around one shared contract: every estimator (classifier, regressor, transformer, or meta-estimator) implements fit/predict/transform and inherits parameter get/set behavior from a common base class. Algorithm modules (tree, linear_model, cluster, ...) plug into that contract, meta-estimators like Pipeline and GridSearchCV compose or wrap any conforming estimator, and performance-critical inner loops drop down into compiled Cython extensions. A small global config module threads cross-cutting behavior (validation, output format, metadata routing) through every fit call.
scikit-learn estimator architecture
Pipeline / composite estimatorssklearn/pipeline.py
model_selection (GridSearchCV, ...)sklearn/model_selection/_search.py
Algorithm modules (tree, linear_model, ...)sklearn/tree/_classes.py
BaseEstimator / mixinssklearn/base.py
Compiled extensions (.pyx)sklearn/tree/_tree.pyx
utils.validation (check_array, validate_data)sklearn/utils/validation.py
_config global settingssklearn/_config.py