---
# System prepended metadata

title: TD 7 -- Introduction a l'Intelligence Artificielle et à la Theorie des Jeux
tags: [M1 S1, IA, TD]

---

# TD 7 -- Introduction a l'Intelligence Artificielle et à la Theorie des Jeux

###### tags `TD` `M1 S1`  `IA`
[Sommaire](/8Sa-Z4QBS1ep0xPwtzigJA)
> [time= 20 nov 2020]

## Exercice 1
![](https://i.imgur.com/2xnCNcY.png)
$$
\begin{align}
P(A) &= \frac{2}{3} \\
P(B) &= \frac{1}{3} \\
\\
\widehat P(T_1=0 | A) &= \frac{2}{6} = \frac{1}{3}\\
\widehat P(T_1=1 | A) &= \frac{2}{3} \\
\widehat P(T_1=0 | B) &= 1           \\
\widehat P(T_1=1 | B) &= 0           \\
\\
\widehat P(T_2=V | A) &= \frac{5}{6} \\
\widehat P(T_2=F | A) &= \frac{1}{6} \\
\widehat P(T_2=V | B) &= 0           \\
\widehat P(T_2=F | B) &= 1           \\
\\
\widehat P(T_3=O | A) &= \frac{1}{6} \\
\widehat P(T_3=I | A) &= \frac{1}{3} \\
\widehat P(T_3=N | A) &= \frac{1}{2} \\
\widehat P(T_3=O | B) &= \frac{2}{3} \\
\widehat P(T_3=I | B) &= 0           \\
P(T_3=N | B) &= \frac{1}{3} \\
\end{align}
$$

11: Pour les entré 1, F, O
$$
P(A|(1, F, O)) = P(1|A) \times P(F|A) \times P(O|A) = 
\frac{2}{3} \times \frac{1}{6} \times \frac{1}{6} = 
\frac{2}{108} = \frac{1}{54}\\
P(B|(1, F, O)) = P(1|B) \times P(F|B) \times P(O|B) = 
0 \times 1 \times \frac{2}{3} = 0\\
$$

Donc $C_{Bayes}(1, F, 0) = A$

Meme chose pour les autres.

t1: 
```graphviz
Digraph g
{
    t3 [label="T3 (6, 3)"]
    t3_n [label="T2 (3, 1)"]
    t3_i [label="A (2, 0)" color=green]
    t3_o [label="T2 (1, 2)"]
    
    t3 -> t3_n [label="N"]
    t3 -> t3_i [label="I"]
    t3 -> t3_o [label="O"]
    
    t2n_v [label="A (2, 0)" color=green]
    t2n_f [label="T1 (1, 1)"]


    t3_n -> t2n_v [label="V"]
    t3_n -> t2n_f [label="F"]
    
    t2o_v [label="A (1, 0)" color=green]
    t2o_f [label="B (0, 1)" color=blue]

    
    t3_o -> t2o_v [label="V"]
    t3_o -> t2o_f [label="F"]
    
    t1v_0 [label="A (1, 0)" color=green]
    t1v_1 [label="B (0, 1)" color=blue]
    
    t2n_f -> t1v_0
    t2n_f -> t1v_1
}
```
t1 est un arbre est bien parfait

```graphviz
Digraph g
{
    t1 [label="T1 (6, 3)"]
    t1_0 [label="T2 (2, 3)"]
    t1_1 [label="A (4, 0)" color=green]
    
    t1 -> t1_0 [label="0"]
    t1 -> t1_1 [label="1"]
    
    t2_0V [label="A (2, 0)" color=green]
    t2_0F [label="B (0, 3)" color=red]
    
    t1_0 -> t2_0V
    t1_0 -> t2_0F
}
```
t2 est un arbre est bien parfait

$$
Gini((6, 3)) = 1 - (6/9)^2 - (3/9)^2 = 1 - \frac{4}{9} - \frac{1}{9} = \frac{6}{9}\\
Gini((2, 3)) = 1 - (2/5)^2 - (3/5)^2) = \frac{12}{25}\\
Gini((4, 0)) = 1 - (4/4)^2 - 0 = 0\\
Grain(T1, A) = \frac{6}{9} - \frac{12}{25} \times \frac{5}{9}
$$
...

On compare tout les gain et on obtiens:
- T2
- T1
- T3

Avec entropie:


