M1

TD n°3

Exerice 1

On réaliser le tableau des 1-itemsets:

Set Fréquence
{Pain} 7/10
{Coca} 4/10
{Lait} 7/10
{Bière} 7/10
{Couches} 7/10
{Oeufs} 5/10

On voit que tous les itemsets sont tous fréquents (i.e. supérieurs à 35%).

On construit alors ensuite les 2-itemsets:

Set Fréquence
{Pain, Coca} 2/10
{Pain, Lait} 5/10
{Pain, Bière} 5/10
{Pain, Couches} 6/10
{Pain, Oeufs} 3/10
{Coca, Lait} 3/10
{Coca, Bière} 2/10
{Coca, Couches} 2/10
{Coca, oeufs} 3/10
{Lait, Bière} 4/10
{Lait, Couches} 6/10
{Lait, oeufs} 3/10
{Bière, couches} 5/10
{Bière, oeufs} 3/10
{Couches, oeufs} 2/10

On construit ensuite les 3-itemsets à partir des 2-itemsets fréquents:

Set Fréquence
{Pain, lait, bière} 3/10
{Pain, lait, couches} 5/10
{Pain, bière, couches} 4/10
{Lait, bière, couches} 4/10

On construit finalement les 4-itemsets:

Set Fréquence
{Pain, lait, bière, couches} 3/10

On arrête car l'itemset n'est pas fréquent et qu'on ne peut plus réaliser d'autres combinaisons.

On construit ensuite les règles:

Pain => Lait
Lait => Pain

Confiance : 5/10 ÷ 7/10 = 5/7 = 71%

Règle Fréquence
Pain => Couches 86%
Couches => Pain 86%
Lait => Couches 86%
Couches => Lait 86%
Règle Fréquence
Pain ^ Lait => Couches 100%
Pain ^ Couches => Lait 83%
Lait ^ Couches => Pain 83%
Pain => Lait ^ Couches 71%
Lait => Pain ^ Couches
Couches => Lait ^ Pain

On calcul le Lift qui a pour formule, si on a A => B :

spport(A ^ B) / support(A) × support(B)

On a donc :

5/10 ÷ (5/10 × 4/10) = 2.5

Exercice 2

On calcule la similarité entre clients :

Recommendations sociales :

Recommandations individuelles :

On calcul la moyenne des notes de chaque client puis le coefficient de Pearson entre chaque client, on obtient :

c1 c2 c3 c4 c5 c6 c7 c8 c9 c10
c1 0.28 1.63 0.89 0.25 2.15 1.43 0.03 0.64 0.96
c2 0.28 1.04 1.97 1.58 0.56 1.27 1.86 1.00 1.06
c3 1.63 1.04 1.78 0.11 1.97 0.44 0.72 1.32 2.57
c4 0.89 1.97 1.78 1.00 0.87 1.46 1.51 1.59 1.34
c5 0.25 1.58 0.11 1.00 0.75 0.59 2.31 1.56 0.37
c6 2.15 0.56 1.97 0.87 0.75 1.29 0.69 0.49 1.11
c7 1.43 1.27 0.44 1.46 0.59 1.29 1.07 1.34 0.03
c8 0.03 1.86 0.72 1.51 2.31 0.69 1.07 2.04 0.71
c9 0.64 1.00 1.32 1.59 1.56 0.49 1.34 2.04 0.82
c10 0.96 1.06 2.57 1.34 0.37 1.11 0.03 0.71 0.82