1
$\begingroup$

I generally understand the CART algorithm but the rpart.plot values are confusing me a bit. Below is a picture of my plot. What exactly is the root node value representing? I thought it would be the mean of the response variable for 100% of my observations but this doesn't hold true.

As you can see the mean value at the root node is -3.5e-18 but the mean for the response for all observations is actually 2.121501e-18. This average logic along other nodes deeper in the tree does hold true but for whatever reason the root node value doesn't actually correspond to my entire data's mean for the response.

So, what exactly is this value of my root node doing?

Below is my code:


library(rpart) 
library(rpart.plot) 

regression_tree1 <- rpart(Rented_Bike_Count ~., data = Train_set_standardized, method = "anova")
summary(regression_tree1)
rpart.plot(regression_tree1)

# this number  does not correspond correctly with the root node of the plot
> mean(Train_set_standardized$Rented_Bike_Count)
[1] 2.121501e-18

# this number corresponds with the rpart.plot perfectly
> sapply(Train_set_standardized[Train_set_standardized$Temperature < -0.074,"Rented_Bike_Count"], mean)
Rented_Bike_Count 
       -0.5214802 

enter image description here

$\endgroup$
1
  • $\begingroup$ Maybe just a computational precision thing? Those are extremely small, after all... $\endgroup$ Commented Nov 5, 2020 at 3:06

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.