quantile_forest/monotonic-cst-multi-samples-leaf
| Pack | Severity | Fix | Versions |
|---|---|---|---|
| Quantile Forest | error | none, edit by hand | All versions |
quantile-forest only supports monotonic_cst when each leaf keeps at most one target sample (max_samples_leaf=1), and raises ValueError during fit if max_samples_leaf is None, a float, or an integer other than 1.
reg = RandomForestQuantileRegressor(monotonic_cst=[1, 0], max_samples_leaf=None, random_state=0)reg = RandomForestQuantileRegressor(monotonic_cst=[1, 0], max_samples_leaf=1, random_state=0)What the rule reports
Section titled “What the rule reports”Calls to RandomForestQuantileRegressor or ExtraTreesQuantileRegressor that combine a non-None monotonic_cst with max_samples_leaf set to a value other than 1.
How to fix it
Section titled “How to fix it”Set max_samples_leaf=1 (the default) when using monotonic_cst, or remove monotonic_cst if you need all samples stored per leaf.
Diagnostic message
Section titled “Diagnostic message”Monotonicity constraints require max_samples_leaf=1 in quantile-forest and raise ValueError when max_samples_leaf is None or > 1. Set max_samples_leaf=1 or drop monotonic_cst.See all rules in the Quantile Forest pack.