How mahmoudewida/decision-trees-cart-checked-against-scikit-learn works
This is a small educational CART walkthrough, not a deployed service. Running scaffold.py drives four stages: hand-built classification checked against scikit-learn, classification experiments on moons, regression-tree evaluation, and an Iris model save/reload followed by species prediction. model.py contains both the hand-built algorithm and scikit-learn-backed helpers. The graph follows documented calls and sampled source; external libraries and datasets are shown only where their use is explicit.
Main entry points: scaffold.py Run walkthrough · model.py Compare trees
Components 19
Walkthrough
- Run walkthrough
scaffold.py - Printed results
scaffold.py
CART Classification
- Gini impurity
model.py - Best split
model.py - Grow CART
model.py - Predict CART
model.py - Fit classifier
model.py - Compare trees
model.py
Model Experiments
- Moons split
model.py - Overfit comparison
model.py - Rotation sensitivity
model.py - Regression tree
model.py
Model Serving
- Export rules
model.py - Save and reload
model.py - Predict species
model.py
Other components
- Engineer
- Iris dataset
- scikit-learn
- Joblib
Connections 29
- Engineer → Run walkthrough: runs
- Run walkthrough → Iris dataset: loads
- Run walkthrough → Gini impurity: calls
- Run walkthrough → Best split: calls
- Run walkthrough → Compare trees: calls
- Run walkthrough → Fit classifier: calls
- Run walkthrough → Export rules: calls
- Run walkthrough → Moons split: calls
- Run walkthrough → Overfit comparison: calls
- Run walkthrough → Rotation sensitivity: calls
- Run walkthrough → Regression tree: calls
- Run walkthrough → Save and reload: calls
- Run walkthrough → Predict species: calls
- Run walkthrough → Printed results: prints
- Best split → Gini impurity: scores
- Grow CART → Best split: selects split
- Grow CART → Grow CART: recurses
- Predict CART → Predict CART: traverses
- Compare trees → Grow CART: builds
- Compare trees → Fit classifier: fits
- Compare trees → Predict CART: predicts
- Fit classifier → scikit-learn: fits classifier
- Moons split → scikit-learn: generates and splits data
- Overfit comparison → scikit-learn: fits classifiers
- Rotation sensitivity → Fit classifier: fits classifiers
- Regression tree → scikit-learn: fits regressor
- Export rules → scikit-learn: exports text
- Save and reload → Joblib: dumps and loads
- Predict species → scikit-learn: predicts