InsideForest
Current release: 0.4.3.
InsideForest turns decision forests into region explorers. The library performs supervised clustering to uncover label-guided segments and explain them with concise rules.
Deploy InsideForest to surface meaningful regions without relying on manual feature engineering. Explore how supervised clustering reveals patterns that traditional tree ensembles hide.
Try it in a notebook
Fit a supervised region clusterer, assign cluster IDs, and inspect region quality in a few lines.
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from InsideForest import InsideForestRegionClusterer
X, y = load_iris(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(
X, y, train_size=0.35, stratify=y, random_state=15
)
clf = InsideForestRegionClusterer(auto_fast=True, auto_feature_reduce=True)
clf.fit(X_train, y_train)
labels = clf.predict(X_test)
assignments = clf.assign_regions(X_test)
quality = clf.region_quality_report(X_test, y_test)
importances = clf.feature_importances_
labels are region IDs; -1 means that no region matched. Head to the Quick API for the general, class-aware, and continuous region clusterers.
What makes InsideForest different?
- Guided segmentation: combines the predictive power of random forests with heuristics that prioritize high-value regions.
- Interpretable descriptions: generates rule sets with clear limits for each cluster.
- Flexible integration: works with
scikit-learn, PySpark, and custom forest backends. - Analysis-ready toolkit: includes metrics, visualizations, and export helpers for production workflows.
Start here
Use these core resources to build your workflow:
- Installation: steps for installing from PyPI or from source.
- How It Works: walk through trees, regions, and labels.
- Performance Tips: tune parameters for large datasets.
- Reproducibility: fix seeds and track versions to repeat results.
Explore the API surface
Each component ships with detailed documentation:
- InsideForestRegionClusterer, InsideForestClassRegionClusterer, and InsideForestContinuousRegionClusterer — canonical supervised clusterers.
- Trees, Regions, and Labels — extraction, prioritization, and labeling.
- Models and Metadata helpers — utilities for diagnostics and persistence.
- Cluster selector helpers — utilities to rebalance and consolidate segments.
Guides & tutorials
Dig into real scenarios and best practices:
- Architecture: understand how internal modules connect.
- Configuration: customize automatic parameters.
- Interpretation: share results with business teams.
- Tutorials: step-by-step notebooks for common tasks.
Stay up to date
Check the Changelog, explore the Roadmap, and resolve questions in the FAQ. If you want to contribute, follow the recommendations in Reproducibility and share your improvements on GitHub.
Community & credits
InsideForest is developed by José Carlos Del Valle. Connect on LinkedIn or explore his portfolio. Have ideas? Add them to the Roadmap.