Consider error of hypothesis h over – training data (also TR): errorD (h) empirical…
- User
Consider error of hypothesis h over – training data (also TR): errorD (h) empirical error – entire distribution X of data: errorX (h) expected or true error • Hypothesis h overfits training data if there is an alternative hypothesis h' H such that errorD (h) < errorD (h’) and errorX (h’) < errorX (h) i.e. h’ behaves worse on TR data, better over unseen data
Spiega
- Assistant
Okay, questo concetto si riferisce all’overfitting (sovradattamento) nel contesto dell’apprendimento automatico e del riconoscimento di pattern. Overfitting è una situazione in cui un modello di ipotesi (h) si adatta troppo bene ai dati di addestramento (TR), a scapito delle sue prestazioni sui nuovi dati non visti (la distribuzione intera X di dati).
Quando diciamo "errorD(h)" si intende l'errore empirico o l'errore sui dati di addestramento. Questo è l'errore misurato quando il modello h viene testato sugli stessi dati su cui è stato addestrato.
D'altra parte, "errorX(h)" si riferisce all'errore atteso o vero, che è l'errore stimato quando il modello h viene testato su un nuovo set di dati, idealmente rappresentativo dell'intera distribuzione di dati X da cui i dati di addestramento sono stati originariamente campionati.
- User
“Avoiding”* overfitting in DT University of Pisa Two strategies:
- Stop growing the tree earlier, before perfect classification (“early stopping”, see the plot before)
- Allow the tree to overfit the data, and then post-prune the tree How to assess the effect? ▪ Training and validation set ▪ split the training set in two parts (training and validation sets) and use the validation set to assess the utility of 1 and 2 ▪ Other approaches ▪ Use a statistical test to estimate effect of expanding or pruning ▪ Minimum description length principle: uses a measure of complexity of encoding the DT and (misclassified) examples, and halt growing the tree when this encoding size is minimal
- “Avoiding” is not correct, we can see the methods to mitigate the overfitting, but we have still to control it by a conscious management (see the next lecture)
Spiega questo
- Assistant
- User
Each node is a candidate for pruning ▪ Pruning consists in removing a subtree rooted in a node: the node becomes a leaf and is assigned the most common classification ▪ Nodes are removed only if the resulting tree performs no worse on the validation set. ▪ Nodes are pruned iteratively: at each iteration the node whose removal most increases accuracy on the validation set is pruned ▪ Pruning stops when no pruning increases accuracy
SPiega
- Assistant
- User
Rule post University of Pisa -pruning
- Create the decision tree from the training set
- Convert the tree into an equivalent set of rules – Each path corresponds to a rule – Each node along a path corresponds to a pre-condition – Each leaf classification to the post-condition e.g. (Outlook=Sunny)(Humidity=High) ⇒ (PlayTennis=No)
- Prune (generalize) each rule by removing those preconditions whose removal improves accuracy … – … over validation set – … over training with a pessimistic, statistically inspired, measure (heuristic)
- Sort the rules in estimated order of accuracy, and consider them in sequence when classifying new instances
Spiega
- Assistant
- User
Each distinct path produces a different rule: a condition removal may be based on a local (contextual) criterion. ▪ Pruning of preconditions is rule specific (path), node pruning is global and affects all the rules (sub-tree) ▪ Converting to rules improves readability for humans (assuming a limited number of rules) ▪ Big topic: Explainable ML/AI (XAI), or Interpretable ML/AI → Trustworthy AI
Spiega
- Assistant
- User
Dealing with continuous-valued attributes ▪ So far discrete values for attributes and for outcome. ▪ Given a continuous-valued attribute A, dynamically create a new attribute Ac Ac = True if A < c, False otherwise ▪ How to determine threshold value c ? ▪ Example: Temperature in the PlayTennis example ▪ Sort the examples according to Temperature Temperature 40 48 | 60 72 80 | 90 PlayTennis No No 54 Yes Yes Yes 85 No ▪ Determine candidate thresholds by averaging consecutive values where there is a change in classification: (48+60)/2=54 and (80+90)/2=85 ▪ Evaluate candidate thresholds (attributes) according to information gain. The best is Temperature>54. Then, the new attribute competes with the other ones
Spiega
- Assistant
- User
Handling incomplete training data (imputation) ▪ How to cope with the problem that the value of some attribute may be missing? ▪ Example: Blood-Test-Result in a medical diagnosis problem ▪ The strategy: use other examples to guess attribute (within training data at a given node). Imputation:
- Most common. Assign the value that is most common among all the training examples at the node or those in the same class
- Assign a probability pi to each value vi , based on frequencies, and assign values to missing attribute, according to this probability distribution (adding more examples weighted by the prob., i.e. assigning fraction pi of example to each descendant tree)
- Classify the new example in the same fashion (weighting): and the most probable classification is chosen (C4.5 algorithm)
Spiega
- Assistant
- User
2. Assegnazione Basata su Probabilità (p_i)
Invece di scegliere un unico valore per sostituire i dati mancanti, questa strategia assegna una probabilità (p_i) a ogni possibile valore (v_i) sulla base delle loro frequenze all’interno del set di addestramento. Successivamente, questi valori vengono assegnati ai dati mancanti secondo questa distribuzione di probabilità. In pratica, ciò significa che un esempio con dati mancanti viene “rilasciato” nelle varie diramazioni dell’albero decisionale in proporzioni che rispecchiano le probabilità dei possibili valori dell’attributo mancante. Questo approccio può essere visto come un tentativo di considerare tutte le possibili interpretazioni dei dati mancanti anziché adottare una singola ipotesi.
Ma non ho capito se ho più percorsi basati sulla probabilità di un valore, ma come ne viene scelta un classificazione?
- Assistant
- User
1. Assegnazione Basata su Probabilità (p_i)
Invece di scegliere un unico valore per sostituire i dati mancanti, questa strategia assegna una probabilità (p_i) a ogni possibile valore (v_i) sulla base delle loro frequenze all’interno del set di addestramento. Successivamente, questi valori vengono assegnati ai dati mancanti secondo questa distribuzione di probabilità. In pratica, ciò significa che un esempio con dati mancanti viene “rilasciato” nelle varie diramazioni dell’albero decisionale in proporzioni che rispecchiano le probabilità dei possibili valori dell’attributo mancante. Questo approccio può essere visto come un tentativo di considerare tutte le possibili interpretazioni dei dati mancanti anziché adottare una singola ipotesi.
2. Classificazione Ponderata per Nuovi Esempi
Quando un nuovo esempio con dati mancanti viene classificato, si applica una strategia simile a quella dell’imputazione basata su probabilità: l’esempio viene guidato attraverso l’albero di decisione tenendo conto della distribuzione di probabilità dei possibili valori dell’attributo mancante. Questo significa che il nuovo esempio contribuisce in modo frazionario a diverse possibili classificazioni lungo l’albero. La classificazione finale viene poi determinata considerando la classificazione più probabile aggregata secondo questa logica ponderata. Questo metodo è stato utilizzato, ad esempio, dall’algoritmo di apprendimento degli alberi decisionali C4.5.
- Assistant
- User
Handling attributes with different costs • Instance attributes may have an associated cost: we would prefer decision trees that use low-cost attributes • ID3 can be modified to take into account costs:
- Tan and Schlimmer (1990) Gain2 (S, A) Cost(A)
- Nunez (1988) 2 Gain(S, A) − 1 (Cost(A) + 1)w w ∈ [0,1]
Spiega
- Assistant