Pruning Decision Trees

后端 未结 4 1062
梦毁少年i
梦毁少年i 2020-12-13 07:14

Below is a snippet of the decision tree as it is pretty huge.

How to make the tree stop growing when the lowest value in a node is under 5. H

4条回答
  •  遥遥无期
    2020-12-13 07:51

    Edit : This is not correct as @SBylemans and @Viktor point out in the comments. I'm not deleting the answer since someone else may also think this is the solution.

    Set min_samples_leaf to 5.

    min_samples_leaf :

    The minimum number of samples required to be at a leaf node:

    Update : I think it cannot be done with min_impurity_decrease. Think of the following scenario :

          11/9
       /         \
      6/4       5/5
     /   \     /   \
    6/0  0/4  2/2  3/3
    

    According to your rule, you do not want to split node 6/4 since 4 is less than 5 but you want to split 5/5 node. However, splitting 6/4 node has 0.48 information gain and splitting 5/5 has 0 information gain.

提交回复
热议问题