QNA > H > Come Trovare Un Esempio Reale Passo Dopo Passo Di Un Albero Di Decisione Per Superare L'overfitting
Domanda

Come trovare un esempio reale passo dopo passo di un albero di decisione per superare l'overfitting

Risposte
04/11/2022
Soph Susan

There is more than one way to perform pruning. The particular figure you have provided is an example of Quinlan's Reduced Error Pruning. Roughly this is how it works:

  1. Keep aside a part of the dataset for post-pruning of the tree. This is different from the test set and is known as the pruning set.
  2. For a subtree S of the tree, if replacing S by a leaf does not make more prediction errors on the pruning set than the original tree, replace S by a leaf.
  3. Perform step 2 only when no subtree of S possesses the property mentioned in 2.


Because of 3, you need to proceed in a bottom up manner - so that if there is a subtree of S, say S', that can be replaced by a leaf, then it must be replaced by a leaf first - so that after replacement, S does not have any subtree with this property, and can go ahead and potentially replace S if needed.

In the diagram, note that the pruning happens bottom-up and left-to-right. Every node notes the number of samples it misclassifies in parenthesis. For ex in fig 3.3 (a), the node in marked in red misclasssifies one example from the pruning set:

main-qimg-37d424f89ac2f26bb5731aefe6701b24.webp


Misclassified example in the pruning set:

main-qimg-f380ec5f6a5d19d2387608603d903886.webp

Starting from the bottom its easy to see that node 3 can be made into a leaf since it makes lesser errors (on the pruning set) than as a subtree - as a subtree the classification happens at nodes 4 and 5, and 5 makes one error, node 3 by itself makes no errors. Same goes for 6 and 9. However, 2 cannot be made into a leaf since it makes one error, while as a subtree, with the newly-created leaves 3 and 6 it makes no errors.

Albero finale:

main-qimg-6d78084047b0302c26c51f217cd405c8.webp

Per maggiori dettagli puoi consultare il documento Simplifying Decision Trees di Quinlan.

Dare una risposta
Com'era la vita del popolo Khitan? :: Qual è la differenza tra la potatura degli alberi e il taglio degli alberi?
Link utili