2

following the answer from of Steffen to the question below:

How to choose $\alpha$ in cost-complexity pruning?

and slide 10 in:

https://web.stanford.edu/class/stats202/content/lec19.pdf

I'm still unsure about the algorithm to determine the best alpha and thus pruned tree.

From the Stanford link: Using k-1 folds as our training set we construct the overall tree and pruned trees set, generating a series of alphas. We then validate each tree on the remaining fold (validation set) obtaining an accuracy for each tree and thus alpha.

However, when we now take the next fold as validation and our new training set k-1 folds surely we will create different set trees and a different series of alphas.

Hence how can we compute the overall score for the alphas as the average, if the alphas produced for each validation set in the k-fold are different?

Karolis Koncevičius
  • 4,282
  • 7
  • 30
  • 47
user541057
  • 21
  • 3
  • First you calculate the $\alpha$ sequence for the tree constructed with all the training set. Using cross-validation, for each $k$ you have a tree and the relative sequence of nested subtrees. Then for each of the $\alpha$s, you find the optimal subtree in each of the K folds and calculate the error of that subtree in the validation fold. – momomi Jul 21 '18 at 19:10
  • @momomi : this is precisely the "wrong way" according to the Stanford slides referenced by the OP. – Tanguy Apr 07 '20 at 16:23

0 Answers0