Possible bug in Random Forest Learner (Regression): Hidden XML parameter causes major R² differen...
Hello KNIME team,
I am using KNIME Analytics Platform 5.12.0 for a machine learning exercise with the public Walmart weekly sales dataset (6,435 rows).
I encountered a large discrepancy between KNIME's Random Forest Learner (Regression) and a comparable scikit-learn model. After investigating the saved workflow configuration, I found that changing a setting that is not exposed in the Random Forest Learner dialog dramatically improves the result.
The experiment uses 4,500 rows from 2010–2011 for training and 1,935 rows from 2012 for testing. The model predicts Weekly_Sales from 52 input features, including 44 one-hot-encoded store indicators.
Initial test-set R² scores:
- KNIME Linear Regression: 0.946
- Python/scikit-learn Linear Regression: 0.946 (same MAE and RMSE as KNIME)
- KNIME Random Forest (Regression): 0.235
- Python/scikit-learn Random Forest with one-hot encoding: approximately 0.92
In the Random Forest Learner node's settings.xml, I found:
<entry key="isUseDifferentAttributesAtEachNode" type="xboolean" value="false"/>
I changed only this entry from false to true, reopened the workflow, reset the affected nodes and reran the prediction and scoring steps. The KNIME Random Forest test-set R² rose from 0.235 to 0.898. No dataset, workflow connections or other model settings were intentionally changed.
As an additional cross-check, I ran a Python experiment comparing a new random subset of features at each split against a fixed random subset for an entire tree. The corresponding R² values were approximately 0.922 and 0.267, respectively. This is consistent with the feature-sampling strategy being important here, although it does not establish exactly how KNIME interprets the XML entry.
I noticed that the Tree Ensemble Learner (Regression) exposes controls for the feature-sampling strategy, whereas I cannot find the equivalent option in the Random Forest Learner (Regression) configuration dialog, even under advanced settings.
Could you please clarify:
1. Does isUseDifferentAttributesAtEachNode control whether candidate features are resampled at each split in the Random Forest Learner, or is it interpreted differently?
2. Is false an expected saved value for this node in KNIME 5.12.0? If so, why?
3. Is the absence of this setting from the Random Forest Learner interface intentional, given that a corresponding option is available in Tree Ensemble Learner?
4. If Random Forest is intended to resample features at each node, could the default/saved setting or its handling be a bug?
I can share the workflow archive, sample data and Python comparison scripts if useful for reproduction.
Thanks in advance for your help!
Best regards