machine-learning - scikit-learn 的决策树实现中如何保证 min_samples_leaf ?

标签 machine-learning scikit-learn random-forest decision-tree

决策树的实现checks that there are more than 2 * min_samples_leaf nodes在调用分离器之前,这一切都很好。

然后,在分割器的实现中,按所选功能排序后,我们有一个 while 循环,它运行所有可能的分割,并根据杂质选择最好的分割:

https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/tree/_splitter.pyx#L401

在我看来,这是完全有可能的——due to this while loop ——我们没有找到任何合适的分割。一个例子是:

Xf = [0,0,0,1]
min_samples_leaf = 2

在这种情况下,我们找不到任何合适的分割,“最佳位置”默认为“结束位置”。我在这里遗漏了什么吗?

最佳答案

找到了我自己的答案哈-

如果我们找不到任何合适的分割,“最佳位置”默认为“结束位置”,但“结束位置”不是有效位置,分割器的调用者将检查这一点并将其自身标记为叶子如果发生这种情况。

关于machine-learning - scikit-learn 的决策树实现中如何保证 min_samples_leaf ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59783957/

相关文章:

machine-learning - DBSCAN 算法可以创建少于 minPts 的簇吗?

machine-learning - 我应该先执行交叉验证然后再进行网格搜索吗?

r - RandomForest 包中的负 %IncMSE 是什么意思?

random-forest - 构建决策树模型时处理分类特征

python - 使用 Tensorflow 多项式回归给出错误答案

machine-learning - ROC曲线和精确召回曲线

python - sklearn.preprocessing.StandardScaler ValueError : Expected 2D array, 得到一维数组

python - 将 GridSearchCV 用于 RandomForestRegressor

python - 经过一些迭代后,损失突然变成了 Nan

python - 如何防止一个高度相关的变量淹没 scikit-learn 中的其余变量?