With the help (tree) sklearn. Tree. _tree. can see most of the attributes provides a method, but didn't see about the mse,
CodePudding user response:
Use tree_reg. Tree_. Impurity,
Tree_reg=tree. DecisionTreeRegressor (max_depth=2)
Tree_reg. Fit (X_train y_train)
Extracted_MSEs=tree_reg. Tree_. Impurity # for MSE values
For independence idx, MSE in enumerate (tree_reg. Tree_. Impurity) :
Print (" Node from the MSE {} {} ". The format (independence idx, MSE))
Node 0 from the MSE 86.873403833
The Node from the MSE 40.3211827171 1
The Node from the MSE 25.6934820064 2
The Node 3 from the MSE 19.0053469592
The Node 4 from the MSE 74.6839429717
The Node 5 from the MSE 38.3057346817
Node 6 from the MSE 39.6709615385
Since a wave, or learning is not solid, of impurity on the decision tree does not reach the designated position,
CodePudding user response:
Want to ask next, the mse and the value in this figure is how to calculate