InsideForestContinuousRegionClusterer
The canonical supervised clusterer for continuous targets. A RandomForestRegressor generates physical leaves; predict returns region IDs and score returns target variance explained (η²), including cluster -1.
from InsideForest import InsideForestContinuousRegionClusterer
model = InsideForestContinuousRegionClusterer(
rf_params={"n_estimators": 50, "max_depth": 6, "random_state": 42},
leaf_percentile=90,
min_support=3,
branch_aggregation="none",
)
cluster_ids = model.fit_predict(X_train, y_train)
assignments = model.assign_regions(X_test)
quality = model.region_quality_report(X_test, y_test)
Region objective
Every physical leaf is scored once using coverage, reduction in target variance, and normalized distance from the global target mean. Regions with the highest score are selected; overlap ties use lower target deviation, higher support, and lower cluster ID.
Output contract
predictnever returns numeric target estimates. Unmatched rows receive-1.transformreturns sample-by-region membership scores.assign_regionsincludes target mean, median, standard deviation, IQR, range, mean shift, and dispersion reduction.regions_,region_metrics_,labels_, andraw_regions_are the canonical fitted artifacts.forest_andfeature_importances_describe only the branch generator. Numeric estimates remain available throughforest_.predictas a separate diagnostic.