# Decision Trees: Cost Complexity Parameter and $-\infty$

I am reading the book titled "An Introduction to Statistical Learning with Applications in R" by James et al. On page 326, we perform cross-validation to determine the optimal level of tree complexity (for a classification tree). Here, you can find an extract from the provided R-code. As you can notice one of the values of $$k$$ (which is actually the tuning parameter $$\alpha$$ for cost-complexity pruning) equals $$-\infty$$. I was wondering, how can one obtain $$-\infty$$ for the cost complexity parameter?

• @SycoraxsaysReinstateMonica: It's the tree package and unfortunately the documentation does not cover this point at all. Mar 9 '20 at 19:17
The value -Inf does not really relate to the cv.tree functionality but rather to the functionality around prune.tree/prune.misclass. Within those functions we examine a series of different complexity parameters $$k$$. These complexity parameters $$k$$ when starting their "grid-search" they are set to something ridiculously negative (small) so we can ensure that we do not penalise anything and we have the maximal tree possible. The real number is actually something like -1.0e+200. Then in a rather hammy way within prune.tree the first member of the sequence of $$k$$'s is set to minus infinity (literally: k[1L] <- -Inf).