r - Why are the cp values in plotcp() chart modified from the original table? -
what cp values on rpart plotcp() chart? expect these values match cp column in printcp(), instead following scale calculated (from plotcp code):
p.rpart <- x$cptable cp0 <- p.rpart[, 1l] cp <- sqrt(cp0 * c(inf, cp0[-length(cp0)]))
so each cp value cv table multiplied against following 1 in same column , square rooted. why?
according uwe's answer, can found here:re: [r] different cp values in rpart() using plotcp() , printcp()
printcp() gives minimal cp pruning happens.
plotcp() plots against geometric mean
actual relationship in source code provided below, cp0
cp value used in printcp while cp
cp value used in plotcp.
cp0 <- p.rpart[, 1l] cp <- sqrt(cp0 * c(inf, cp0[-length(cp0)]))
Comments
Post a Comment