Feat: Début de la séquence sur l'inférence Bayésienne
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Bertrand Benjamin 2021-03-15 15:14:32 +01:00
parent a5d02e60f2
commit 59f78543ce
12 changed files with 508 additions and 0 deletions

Binary file not shown.

View File

@ -0,0 +1,109 @@
\documentclass[a4paper,10pt]{article}
\usepackage{myXsim}
\author{Benjamin Bertrand}
\title{Probabilités conditionnelles - Cours}
\date{Mars 2021}
\pagestyle{empty}
\begin{document}
\maketitle
\section{Notations}
\subsection*{Les ensembles}
Soit $E$ un ensemble et $A$ et $B$ deux sous ensemble de $E$.
\begin{center}
\includegraphics[ scale=0.6 ]{./fig/ensembles}
\end{center}
\begin{itemize}
\item \textbf{Complémentaire de $A$} contient tous les éléments qui n'ont pas les caractéristiques de $A$.
\begin{center}
\includegraphics[ scale=0.6 ]{./fig/Abar}
\end{center}
\item \textbf{Intersection de $A$ et $B$} contient tous les éléments qui ont les caractéristiques de $A$ \textbf{ET} de $B$.
\begin{center}
\includegraphics[ scale=0.6 ]{./fig/inter}
\end{center}
\item \textbf{Union de $A$ et $B$} contient tous les éléments qui ont les caractéristiques de $A$ \textbf{OU} de $B$.
\begin{center}
\includegraphics[ scale=0.6 ]{./fig/union}
\end{center}
\end{itemize}
\pagebreak
\subsection*{Les probabilités}
\begin{definition}{Probabilités conditionnelles}
Soit $A$ et $B$ deux ensembles d'un population totale $E$ avec $A$ un ensemble non vide.
\begin{itemize}
\item Probabilités de l'évènement $A$
\[
P(A) = \frac{\mbox{Effectif de $A$}}{\mbox{Effectif total}}
\]
\item Probabilités de l'évènement $B$ sachant $A$
\[
P_A(B) = \frac{\mbox{Effectif des éléments qui sont dans $A$ et $B$}}{\mbox{Effectifs des éléments qui sont dans $A$}}
\]
\begin{center}
\includegraphics[ scale=0.6 ]{./fig/condi_A}
\end{cente}
\end{itemize}
\end{definition}
\paragraph{Exemple}~\\
\begin{minipage}{0.5\linewidth}
\begin{tabular}{|*{4}{c|}}
\hline
& Homme & Femme & Total \\
\hline
Employé & 10 & 15 & 25 \\
\hline
Vacataire & 14 & 17 & 31 \\
\hline
Total & 24 & 32 & 56 \\
\hline
\end{tabular}
\end{minipage}
\begin{minipage}{0.5\linewidth}
On note
\[
A = \left\{ \mbox{Homme} \right\} \qquad
\]
\[
B = \left\{ \mbox{Employé} \right\} \qquad
\]
\end{minipage}
\bigskip
On choisit au hasard une personne de cette entreprise.
\[
P(A) =
\]
Interprétation:
\[
P_A(B) =
\]
Interprétation:
\bigskip
\afaire{}
\end{document}

View File

@ -0,0 +1,19 @@
\documentclass[a4paper,10pt]{article}
\usepackage{myXsim}
\author{Benjamin Bertrand}
\title{Probabilités conditionnelles - Cours}
\date{février 2021}
\DeclareExerciseCollection{banque}
\xsimsetup{
step=1,
}
\begin{document}
\input{exercises.tex}
\printcollection{banque}
\vfill
\end{document}

View File

@ -0,0 +1,98 @@
\collectexercises{banque}
\begin{exercise}[subtitle={Vrai-Faux}, step={1}, origin={Création}, topics={Probabilités conditionnelles}, tags={probabilité, simulation}]
Dans le tableau ci-dessous, on a trier les élèves en fonction de leur note au bac et au bac blanc.
\begin{center}
\begin{tabular}{|>{\columncolor{highlightbg}}c|*{2}{p{4cm}|}|p{4cm}|}
\hline
\rowcolor{highlightbg}
Bac \backslash Bac Blanc & Moins de la moyenne & Plus de moyenne & Total\\
\hline
Moins de la moyenne & 30 & 300 & 60\\
\hline
Plus de la moyenne & 20 & 70 & 90\\
\hline
Total & 50 & 100 & 150\\
\hline
\end{tabular}
\end{center}
On choisit au hasard un jeune parmi ceux interrogés. On note $A = \left\{ \mbox{Plus de la moyenne au bac blanc} \right\}$ et $B = \left\{ \mbox{Moins de la moyenne au bac blanc} \right\}$.
Pour chacune des phrases suivantes, justifier si elles sont vraies ou fausses.
\begin{enumerate}
\item La probabilité qu'un élève ait plus de moyenne au bac blanc est supérieur à 30\%.
\item La probabilité qu'il ait la moyenne au bac blanc mais pas au au bac est de moins de 0.1.
\item La probabilité qu'il n'ait pas la moyenne au bac et pas la moyenne au bac blanc est de $\frac{1}{5}$.
\item La probabilité qu'il ait la moyenne au bac blanc ou au bac est de plus de 70\%.
\item La probabilité qu'un élève qui a eu la moyenne au bac blanc ait ensuite la moyenne au bac est de 0.6.
\item La probabilité qu'un élève qui n'a pas eu la moyenne au bac blanc ne l'ait toujours pas au bac est de 50\%.
\end{enumerate}
\end{exercise}
\begin{exercise}[subtitle={Moyen de paiement}, step={1}, origin={Création}, topics={Probabilités conditionnelles}, tags={probabilité, simulation}]
Le gérant d'une grande enseigne de distribution a commandé une étude statistique des moyens de paiement de ses clients. Les résultats ont été représenté dans l'arbre ci-dessous.
\bigskip
\begin{tikzpicture}[sloped]
\node {.}
child {node {Moins de 20\euro}
child {node {Espèce}
edge from parent
node[above] {0.6}
}
child[missing] {}
child {node {Paiement sans contact}
edge from parent
node[above] {0.3}
}
child[missing] {}
child {node {Carte bleu}
edge from parent
node[above] {0.1}
}
edge from parent
node[above] {0.4}
}
child[missing] {}
child[missing] {}
child[missing] {}
child[missing] {}
child[missing] {}
child { node {Plus de 20\euro}
child {node {Espèce}
edge from parent
node[above] {0.4}
}
child[missing] {}
child {node {Paiement sans contact}
edge from parent
node[above] {0.1}
}
child[missing] {}
child {node {Carte bleu}
edge from parent
node[above] {0.5}
}
edge from parent
node[above] {0.6}
} ;
\end{tikzpicture}
\bigskip
On sélectionne un client de cette enseigne au hasard. On note
\[
M = \left\{ \mbox{ Moins de 20\euro } \right\} \qquad E = \left\{ \mbox{ Espèce }\right\} \qquad B = \left\{ \mbox{ carte bleu }\right\}
\]
Pour chacune des phrases suivantes, justifier si elles sont vraies ou fausses.
\begin{enumerate}
\item La probabilité qu'un client achète pour plus de 20\euro est de 0.6.
\item Si l'achat est de moins de 20\euro, il y a une probabilité de 10\% qu'il soit fait en paiement sans contact.
\item Si les achats sont de plus de 20\euro, la probabilité qu'il ait été fait avec de l'espèce est de 0.4.
\item La probabilité qu'un achat soit de plus de 20\euro et payé avec une carte bleu est de 90\%.
\item La probabilité qu'un achat soit de moins de 20\euro et payé avec une carte bleu est de 0.2.
\item La probabilité qu'un achat soit de moins de 20\euro et payé avec de l'espère est de 1.
\item La probabilité ait été payé avec le paiement sans contact est de 72\%.
\end{enumerate}
\end{exercise}
\collectexercisesstop{banque}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

@ -0,0 +1,274 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="210mm"
height="297mm"
viewBox="0 0 210 297"
version="1.1"
id="svg8"
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07, custom)"
sodipodi:docname="ensembles.svg">
<defs
id="defs2" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.5077062"
inkscape:cx="342.38855"
inkscape:cy="247.1513"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
inkscape:document-rotation="0"
showgrid="false"
showguides="false"
inkscape:window-width="1920"
inkscape:window-height="1054"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="opacity:0.382969;fill:#0000ff;stroke:#000000;stroke-width:0.304881;stop-color:#000000"
id="rect863"
width="78.540085"
height="14.654474"
x="112.35032"
y="28.559233"
ry="4.5616803" />
<rect
style="opacity:0.382969;fill:#b3b3b3;stroke:#000000;stroke-width:0.2329;stop-color:#000000"
id="rect833"
width="88.035439"
height="46.106461"
x="6.1855693"
y="7.1176796"
ry="5.7131782" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:4.23333px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583"
x="12.342381"
y="14.562019"
id="text837"><tspan
sodipodi:role="line"
id="tspan835"
x="12.342381"
y="14.562019"
style="stroke-width:0.264583">E</tspan></text>
<rect
style="opacity:0.382969;fill:#ff0000;stroke:#000000;stroke-width:0.312887;stop-color:#000000"
id="rect839"
width="23.032158"
height="38.189877"
x="25.814392"
y="11.452538"
ry="5.5030832" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:4.23333px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583"
x="29.626511"
y="17.945637"
id="text843"><tspan
sodipodi:role="line"
id="tspan841"
x="29.626511"
y="17.945637"
style="stroke-width:0.264583">A</tspan></text>
<rect
style="opacity:0.382969;fill:#0000ff;stroke:#000000;stroke-width:0.304881;stop-color:#000000"
id="rect845"
width="78.540085"
height="14.654474"
x="10.111814"
y="30.473827"
ry="4.5616803" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:4.23333px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583"
x="13.073805"
y="38.849197"
id="text849"><tspan
sodipodi:role="line"
id="tspan847"
x="13.073805"
y="38.849197"
style="stroke-width:0.264583">B</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:4.23333px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583"
x="114.58089"
y="12.647426"
id="text855"><tspan
sodipodi:role="line"
id="tspan853"
x="114.58089"
y="12.647426"
style="stroke-width:0.264583">E</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:4.23333px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583"
x="131.86502"
y="16.031042"
id="text861"><tspan
sodipodi:role="line"
id="tspan859"
x="131.86502"
y="16.031042"
style="stroke-width:0.264583">A</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:4.23333px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583"
x="115.31231"
y="36.934605"
id="text867"><tspan
sodipodi:role="line"
id="tspan865"
x="115.31231"
y="36.934605"
style="stroke-width:0.264583">B</tspan></text>
<rect
style="opacity:0.382969;fill:#ff0000;stroke:#000000;stroke-width:0.312888;stop-color:#000000"
id="rect839-7"
width="23.032158"
height="38.189877"
x="128.28906"
y="9.442317"
ry="5.5030832" />
<path
id="rect851"
style="opacity:0.69714844;fill:#00ff00;stroke:#000000;stroke-width:0.880252;stop-color:#000000"
d="M 431.38477 19.666016 C 419.42218 19.666016 409.79102 29.295226 409.79102 41.257812 L 409.79102 172.33203 C 409.79102 184.29462 419.42218 193.92578 431.38477 193.92578 L 720.93164 193.92578 C 732.89422 193.92578 742.52344 184.29462 742.52344 172.33203 L 742.52344 41.257812 C 742.52344 29.295226 732.89422 19.666016 720.93164 19.666016 L 431.38477 19.666016 z M 504.7793 36.048828 L 550.23047 36.048828 C 561.75311 36.048828 571.0293 45.32498 571.0293 56.847656 L 571.0293 159.58984 C 571.0293 171.11252 561.75311 180.38867 550.23047 180.38867 L 504.7793 180.38867 C 493.25661 180.38867 483.97852 171.11252 483.97852 159.58984 L 483.97852 56.847656 C 483.97852 45.32498 493.25661 36.048828 504.7793 36.048828 z "
transform="scale(0.26458333)" />
<rect
style="opacity:0.382969;fill:#b3b3b3;stroke:#000000;stroke-width:0.2329;stop-color:#000000"
id="rect833-6"
width="88.035439"
height="46.106461"
x="8.8498955"
y="60.605553"
ry="5.7131782" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:4.23333px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583"
x="15.006706"
y="68.049896"
id="text837-3"><tspan
sodipodi:role="line"
id="tspan835-1"
x="15.006706"
y="68.049896"
style="stroke-width:0.264583">E</tspan></text>
<rect
style="opacity:0.382969;fill:#ff0000;stroke:#000000;stroke-width:0.312888;stop-color:#000000"
id="rect839-75"
width="23.032158"
height="38.189877"
x="28.478718"
y="64.940414"
ry="5.5030832" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:4.23333px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583"
x="32.290836"
y="71.43351"
id="text843-9"><tspan
sodipodi:role="line"
id="tspan841-6"
x="32.290836"
y="71.43351"
style="stroke-width:0.264583">A</tspan></text>
<rect
style="opacity:0.382969;fill:#0000ff;stroke:#000000;stroke-width:0.304882;stop-color:#000000"
id="rect845-2"
width="78.540085"
height="14.654474"
x="12.776138"
y="83.9617"
ry="4.5616803" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:4.23333px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583"
x="15.738129"
y="92.337074"
id="text849-1"><tspan
sodipodi:role="line"
id="tspan847-7"
x="15.738129"
y="92.337074"
style="stroke-width:0.264583">B</tspan></text>
<path
id="rect839-75-8"
style="opacity:0.78253906;fill:#00ff00;stroke:#000000;stroke-width:0.312888;stop-color:#000000"
d="m 28.462112,83.883022 v 13.665317 c 0,0.337981 0.03161,0.668244 0.0894,0.989086 h 22.85287 c 0.05779,-0.320842 0.08992,-0.651105 0.08992,-0.989086 V 83.883022 Z" />
<rect
style="opacity:0.382969;fill:#b3b3b3;stroke:#000000;stroke-width:0.2329;stop-color:#000000"
id="rect833-5"
width="88.035439"
height="46.106461"
x="112.166"
y="61.70715"
ry="5.7131782" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:4.23333px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583"
x="118.32281"
y="69.151489"
id="text837-7"><tspan
sodipodi:role="line"
id="tspan835-4"
x="118.32281"
y="69.151489"
style="stroke-width:0.264583">E</tspan></text>
<path
id="rect839-1"
style="opacity:0.6215625;fill:#00ff00;stroke:#000000;stroke-width:1.18257;stop-color:#000000"
d="M 518.92188 249.60742 C 507.39923 249.60742 498.12305 258.88357 498.12305 270.40625 L 498.12305 321.5 L 456.01562 321.5 C 446.46412 321.5 438.77344 329.18873 438.77344 338.74023 L 438.77344 359.64453 C 438.77344 369.19604 446.46412 376.88672 456.01562 376.88672 L 498.46094 376.88672 C 500.2133 386.6118 508.67701 393.94727 518.92188 393.94727 L 564.37305 393.94727 C 574.61795 393.94727 583.08163 386.6118 584.83398 376.88672 L 718.37695 376.88672 C 727.92846 376.88672 735.61914 369.19604 735.61914 359.64453 L 735.61914 338.74023 C 735.61914 329.18873 727.92846 321.5 718.37695 321.5 L 585.17383 321.5 L 585.17383 270.40625 C 585.17383 258.88357 575.89573 249.60742 564.37305 249.60742 L 518.92188 249.60742 z "
transform="scale(0.26458333)" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:4.23333px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583"
x="135.60695"
y="72.535103"
id="text843-8"><tspan
sodipodi:role="line"
id="tspan841-5"
x="135.60695"
y="72.535103"
style="stroke-width:0.264583">A</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:4.23333px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583"
x="119.05424"
y="93.438667"
id="text849-7"><tspan
sodipodi:role="line"
id="tspan847-5"
x="119.05424"
y="93.438667"
style="stroke-width:0.264583">B</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

View File

@ -13,8 +13,16 @@ Inférence Bayésienne
Vrai/faux sur des données représentées sous forme d'un tableau puis d'un arbre
.. image:: ./1E_probabilite_conditionnelle.pdf
:height: 200px
:alt: Vrai/Faux sur un tableau et un arbre
Bilan: Notations ensemblistes et calculs de probabilités.
.. image:: ./1B_notation.pdf
:height: 200px
:alt: Bilan sur les notations ensemblistes et les calculs de probabilités
Étape 2: Étonnement sur les tests
=================================