InsideForestClassRegionClusterer

Extracts one class-enriched region per selected physical leaf. The forest is only a branch generator; no class prediction or forest fallback is part of the contract.

from InsideForest import InsideForestClassRegionClusterer

model = InsideForestClassRegionClusterer(
    rf_params={"n_estimators": 50, "random_state": 42},
    leaf_percentile=95,
    min_support=2,
)
cluster_ids = model.fit_predict(X_train, y_train)
assignments = model.assign_regions(X_test)
quality = model.region_quality_report(X_test, y_test)

Uncovered rows receive -1. Use regions_for_class, ambiguous_regions, and class_coverage_report for class-aware diagnostics.

Selection and assignment

Each physical leaf is associated with only the class that maximizes the configured purity-lift-coverage objective. A selected leaf therefore produces at most one final region. Overlapping matches are resolved by region score, then lower entropy, higher support, and lower cluster ID.

classes_ is metadata for class distributions; it is not the output space of predict. branch_aggregation="none" is the supported default, so IoU branch clustering is not required.