The document describes the construction of a decision tree using a dataset of customer purchases, focusing on predicting whether a new client will buy based on attributes like Age, Salary, and Student status. It explains the process of calculating information gain to determine the root attribute, which is identified as 'Age' due to its maximum information gain. The document also outlines the subsequent steps for building the rest of the tree and classifying new data points.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0 ratings0% found this document useful (0 votes)
53 views2 pages
exam2
The document describes the construction of a decision tree using a dataset of customer purchases, focusing on predicting whether a new client will buy based on attributes like Age, Salary, and Student status. It explains the process of calculating information gain to determine the root attribute, which is identified as 'Age' due to its maximum information gain. The document also outlines the subsequent steps for building the rest of the tree and classifying new data points.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 2
Exercice 1.— Arbres de décision #/0%)
d'une base de données d'achats des clients d'une entreprise.
OU: mest le nombre de classes présentes dans D, vest le nombre de valeurs
nt le gain d'information maximal, déterminer uniquement l'attribut racine de
Considérons le tableau suivant, qui présente un ensemble d’apprentissage tiré aléatoirement
Id
1
2
3
4
5
6
7
8
9
10
n
12
13
14
Age
Petit
Petit
Moyen
sénior
Sénior
Senior
Moyen
Petit
Petit
Sénior
Petit
Moyen
Moyen
Sénior
Salaire
Haut
Haut
Haut
Moyen
Bas
Bas
Bas
Moyen
Bas
Moyen
Moyen
Moyen
Haut.
Moyen
Etudiant
Non
Non
Non
Non
Oui
Oui
Oui
Non
Oui
Oui
Oui
Non
Oui
Non
Aacheté
Non
Non
Oui
Oui
Oui
Non
oui
Oui
Oui
Non
On veut construire un arbre de décision pour prédire la classe (A acheté) d'un nouvel client, en
se basant sur ce tableau. Utiliser la technique du gain d'information pour choisir lattribut a la racine de
Varbre.
Q
|— En uti
tes d'un attribut A.
arbre (ayant le maximum de gain) puis en déduire arbre final sans faire de calculs
supplémentaires.
Q.
de test suivant :
Age
Petit
Sénior
Moyen
Petit
Moyen
Sénior
Salaire
Haut
Bas
Bas
Bas
Moyen
Moyen
Etudiant
Non
Oui
Oui
Oui
Non
Non
— Utiliser l'arbre de décision construit pour classifier et calculer la précision sur l'ensemble
Aacheté
Non
Non
Oui
Oui
Oui
Non
NB:
Linformation avant le partitionnement d'un ensemble D
Info(D) = — Spi x loga(pi)
information aprés e partitionnement en utilisant un attribut un A
i
( > Dsl )
Infoa(D) = >“! x Info(D;)
jai [PI
Gain d'information
Info (D)— Infox(D)
veCorrigé type
Exercice 1.—Arbres de Décision 0"
4+ Construction de I'arbre
A. Attribut au neeud racine :
Les atributscandiats Age ‘Sai, "Etdlant 7”
Uellsetion dela technique dt gala dinfarmation pou choisi Voteibu
Commenzant par ealeiarhfo(), esl que O est ensemble c apprentiesage, ayant 1 inctances at (m=
2 dasses
Info(D) =
= (0/14)1090/14)-(/14)*109, (5/14). = 0.940 bits (os pts)
iniug = 5 nga)
14) fa) + (4/14 fof) (5/1) fot)
+= (5/14) inFo(l2.3)) + (4/14) inFoi(4,0)) + (5/14) InFo({3.2))
shia) sos reo. wri BaF
Sos bts ops)
Infosaiie = Db InfokD;)
BI
2/14) fot) 14] o(09 (4/8) foto)
(a) nedaap (ote) woes = (e/a nt)
Tihast velo seateeia/) “oat
coisas oss)
Inforeadiont? = y e Info(Dj)
= (7/18 lfotD) + (7/14 FAO)
17/14) fod.) + 7/19) fol.)
rte) 059 (7/14) 0988
767 bes (os pts)
‘On peut alors cleuler les gains pour tous les atrbuts
Cain(age) = 0.540 ~ 0.683, 20287
‘aln(slare) = 0940-0910 = 0050
ain(2tudian®} =0940-0757 = 0.153
Le gain dinfermation est maximal enutlsaneateibut ‘Age’ pour le parttionnement la racine de
[arbre de cecision L'attribut Age possede troevaleurs/modalte Pet, Mayer, Sesion donc on
39a branches 3 partirde le racine, une pa al
(os pts)
B: Daduve le reste de tarbve
‘on proce exploration, en excluant cee fois ateribut ‘age’. La deuxléme branche est pure, donc
pes besoin de Texplorer. Pour la premiere branche (AgesPetit), on peat remarquer que la separation
fn se basa sur Tattribut‘Eeudlant permet davar deux branches pures.
our la Uolkitme branche (agessérior), on peut remarquer cue la séparation en se basant sur
attbut ‘Salar’ ov sur Fatsibut ‘Eeudlant’ ne permettront pas donner des ensembles pures. On
fut déider darter Texplartion. La casee chow dan cette branche est “Our pueque Cesta
{lasse majorkaire.
arbre de déeision ext lors le suivant