From 2f31e1a9d417f12440bd1789d7586883035d37f2 Mon Sep 17 00:00:00 2001
From: 39781cc7cca0dc30af9d6060ede9947c
<39781cc7cca0dc30af9d6060ede9947c@app-learninglab.inria.fr>
Date: Sun, 12 Apr 2020 07:33:05 +0000
Subject: [PATCH] =?UTF-8?q?Cr=C3=A9ation=20du=20projet=20CO2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
module2/exo5/.ipynb | 713 ++++++++++++++
module2/exo5/exo5_fr-Copy1.ipynb | 713 ++++++++++++++
module2/exo5/exo5_fr.ipynb | 2 +-
module3/exo3/exercice.ipynb | 1119 +++++++++++++++++++++-
module3/exo3/monthly_in_situ_co2_mlo.csv | 813 ++++++++++++++++
5 files changed, 3356 insertions(+), 4 deletions(-)
create mode 100644 module2/exo5/.ipynb
create mode 100644 module2/exo5/exo5_fr-Copy1.ipynb
create mode 100644 module3/exo3/monthly_in_situ_co2_mlo.csv
diff --git a/module2/exo5/.ipynb b/module2/exo5/.ipynb
new file mode 100644
index 0000000..0089406
--- /dev/null
+++ b/module2/exo5/.ipynb
@@ -0,0 +1,713 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Analyse du risque de défaillance des joints toriques de la navette Challenger"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Le 27 Janvier 1986, veille du décollage de la navette *Challenger*, eu\n",
+ "lieu une télé-conférence de trois heures entre les ingénieurs de la\n",
+ "Morton Thiokol (constructeur d'un des moteurs) et de la NASA. La\n",
+ "discussion portait principalement sur les conséquences de la\n",
+ "température prévue au moment du décollage de 31°F (juste en dessous de\n",
+ "0°C) sur le succès du vol et en particulier sur la performance des\n",
+ "joints toriques utilisés dans les moteurs. En effet, aucun test\n",
+ "n'avait été effectué à cette température.\n",
+ "\n",
+ "L'étude qui suit reprend donc une partie des analyses effectuées cette\n",
+ "nuit là et dont l'objectif était d'évaluer l'influence potentielle de\n",
+ "la température et de la pression à laquelle sont soumis les joints\n",
+ "toriques sur leur probabilité de dysfonctionnement. Pour cela, nous\n",
+ "disposons des résultats des expériences réalisées par les ingénieurs\n",
+ "de la NASA durant les 6 années précédant le lancement de la navette\n",
+ "Challenger.\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Chargement des données\n",
+ "Nous commençons donc par charger ces données:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "
\n",
+ "\n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
\n",
+ "
Date
\n",
+ "
Count
\n",
+ "
Temperature
\n",
+ "
Pressure
\n",
+ "
Malfunction
\n",
+ "
\n",
+ " \n",
+ " \n",
+ "
\n",
+ "
0
\n",
+ "
4/12/81
\n",
+ "
6
\n",
+ "
66
\n",
+ "
50
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
1
\n",
+ "
11/12/81
\n",
+ "
6
\n",
+ "
70
\n",
+ "
50
\n",
+ "
1
\n",
+ "
\n",
+ "
\n",
+ "
2
\n",
+ "
3/22/82
\n",
+ "
6
\n",
+ "
69
\n",
+ "
50
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
3
\n",
+ "
11/11/82
\n",
+ "
6
\n",
+ "
68
\n",
+ "
50
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
4
\n",
+ "
4/04/83
\n",
+ "
6
\n",
+ "
67
\n",
+ "
50
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
5
\n",
+ "
6/18/82
\n",
+ "
6
\n",
+ "
72
\n",
+ "
50
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
6
\n",
+ "
8/30/83
\n",
+ "
6
\n",
+ "
73
\n",
+ "
100
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
7
\n",
+ "
11/28/83
\n",
+ "
6
\n",
+ "
70
\n",
+ "
100
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
8
\n",
+ "
2/03/84
\n",
+ "
6
\n",
+ "
57
\n",
+ "
200
\n",
+ "
1
\n",
+ "
\n",
+ "
\n",
+ "
9
\n",
+ "
4/06/84
\n",
+ "
6
\n",
+ "
63
\n",
+ "
200
\n",
+ "
1
\n",
+ "
\n",
+ "
\n",
+ "
10
\n",
+ "
8/30/84
\n",
+ "
6
\n",
+ "
70
\n",
+ "
200
\n",
+ "
1
\n",
+ "
\n",
+ "
\n",
+ "
11
\n",
+ "
10/05/84
\n",
+ "
6
\n",
+ "
78
\n",
+ "
200
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
12
\n",
+ "
11/08/84
\n",
+ "
6
\n",
+ "
67
\n",
+ "
200
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
13
\n",
+ "
1/24/85
\n",
+ "
6
\n",
+ "
53
\n",
+ "
200
\n",
+ "
2
\n",
+ "
\n",
+ "
\n",
+ "
14
\n",
+ "
4/12/85
\n",
+ "
6
\n",
+ "
67
\n",
+ "
200
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
15
\n",
+ "
4/29/85
\n",
+ "
6
\n",
+ "
75
\n",
+ "
200
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
16
\n",
+ "
6/17/85
\n",
+ "
6
\n",
+ "
70
\n",
+ "
200
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
17
\n",
+ "
7/29/85
\n",
+ "
6
\n",
+ "
81
\n",
+ "
200
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
18
\n",
+ "
8/27/85
\n",
+ "
6
\n",
+ "
76
\n",
+ "
200
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
19
\n",
+ "
10/03/85
\n",
+ "
6
\n",
+ "
79
\n",
+ "
200
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
20
\n",
+ "
10/30/85
\n",
+ "
6
\n",
+ "
75
\n",
+ "
200
\n",
+ "
2
\n",
+ "
\n",
+ "
\n",
+ "
21
\n",
+ "
11/26/85
\n",
+ "
6
\n",
+ "
76
\n",
+ "
200
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
22
\n",
+ "
1/12/86
\n",
+ "
6
\n",
+ "
58
\n",
+ "
200
\n",
+ "
1
\n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " Date Count Temperature Pressure Malfunction\n",
+ "0 4/12/81 6 66 50 0\n",
+ "1 11/12/81 6 70 50 1\n",
+ "2 3/22/82 6 69 50 0\n",
+ "3 11/11/82 6 68 50 0\n",
+ "4 4/04/83 6 67 50 0\n",
+ "5 6/18/82 6 72 50 0\n",
+ "6 8/30/83 6 73 100 0\n",
+ "7 11/28/83 6 70 100 0\n",
+ "8 2/03/84 6 57 200 1\n",
+ "9 4/06/84 6 63 200 1\n",
+ "10 8/30/84 6 70 200 1\n",
+ "11 10/05/84 6 78 200 0\n",
+ "12 11/08/84 6 67 200 0\n",
+ "13 1/24/85 6 53 200 2\n",
+ "14 4/12/85 6 67 200 0\n",
+ "15 4/29/85 6 75 200 0\n",
+ "16 6/17/85 6 70 200 0\n",
+ "17 7/29/85 6 81 200 0\n",
+ "18 8/27/85 6 76 200 0\n",
+ "19 10/03/85 6 79 200 0\n",
+ "20 10/30/85 6 75 200 2\n",
+ "21 11/26/85 6 76 200 0\n",
+ "22 1/12/86 6 58 200 1"
+ ]
+ },
+ "execution_count": 1,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "import numpy as np\n",
+ "import pandas as pd\n",
+ "data = pd.read_csv(\"shuttle.csv\")\n",
+ "data"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Le jeu de données nous indique la date de l'essai, le nombre de joints\n",
+ "toriques mesurés (il y en a 6 sur le lançeur principal), la\n",
+ "température (en Farenheit) et la pression (en psi), et enfin le\n",
+ "nombre de dysfonctionnements relevés. "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Inspection graphique des données\n",
+ "Les vols où aucun incident n'est relevé n'apportant aucun information\n",
+ "sur l'influence de la température ou de la pression sur les\n",
+ "dysfonctionnements, nous nous concentrons sur les expériences où au\n",
+ "moins un joint a été défectueux.\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "
"
+ ]
+ },
+ "metadata": {
+ "needs_background": "light"
+ },
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "%matplotlib inline\n",
+ "pd.set_option('mode.chained_assignment',None) # this removes a useless warning from pandas\n",
+ "import matplotlib.pyplot as plt\n",
+ "\n",
+ "data[\"Frequency\"]=data.Malfunction/data.Count\n",
+ "data.plot(x=\"Temperature\",y=\"Frequency\",kind=\"scatter\",ylim=[0,1])\n",
+ "plt.grid(True)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "À première vue, ce n'est pas flagrant mais bon, essayons quand même\n",
+ "d'estimer l'impact de la température $t$ sur la probabilité de\n",
+ "dysfonctionnements d'un joint. \n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Estimation de l'influence de la température\n",
+ "\n",
+ "Supposons que chacun des 6 joints toriques est endommagé avec la même\n",
+ "probabilité et indépendamment des autres et que cette probabilité ne\n",
+ "dépend que de la température. Si on note $p(t)$ cette probabilité, le\n",
+ "nombre de joints $D$ dysfonctionnant lorsque l'on effectue le vol à\n",
+ "température $t$ suit une loi binomiale de paramètre $n=6$ et\n",
+ "$p=p(t)$. Pour relier $p(t)$ à $t$, on va donc effectuer une\n",
+ "régression logistique."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "
\n",
+ "
Generalized Linear Model Regression Results
\n",
+ "
\n",
+ "
Dep. Variable:
Frequency
No. Observations:
7
\n",
+ "
\n",
+ "
\n",
+ "
Model:
GLM
Df Residuals:
5
\n",
+ "
\n",
+ "
\n",
+ "
Model Family:
Binomial
Df Model:
1
\n",
+ "
\n",
+ "
\n",
+ "
Link Function:
logit
Scale:
1.0000
\n",
+ "
\n",
+ "
\n",
+ "
Method:
IRLS
Log-Likelihood:
-2.5250
\n",
+ "
\n",
+ "
\n",
+ "
Date:
Sat, 13 Apr 2019
Deviance:
0.22231
\n",
+ "
\n",
+ "
\n",
+ "
Time:
19:11:24
Pearson chi2:
0.236
\n",
+ "
\n",
+ "
\n",
+ "
No. Iterations:
4
Covariance Type:
nonrobust
\n",
+ "
\n",
+ "
\n",
+ "
\n",
+ "
\n",
+ "
coef
std err
z
P>|z|
[0.025
0.975]
\n",
+ "
\n",
+ "
\n",
+ "
Intercept
-1.3895
7.828
-0.178
0.859
-16.732
13.953
\n",
+ "
\n",
+ "
\n",
+ "
Temperature
0.0014
0.122
0.012
0.991
-0.238
0.240
\n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ "\n",
+ "\"\"\"\n",
+ " Generalized Linear Model Regression Results \n",
+ "==============================================================================\n",
+ "Dep. Variable: Frequency No. Observations: 7\n",
+ "Model: GLM Df Residuals: 5\n",
+ "Model Family: Binomial Df Model: 1\n",
+ "Link Function: logit Scale: 1.0000\n",
+ "Method: IRLS Log-Likelihood: -2.5250\n",
+ "Date: Sat, 13 Apr 2019 Deviance: 0.22231\n",
+ "Time: 19:11:24 Pearson chi2: 0.236\n",
+ "No. Iterations: 4 Covariance Type: nonrobust\n",
+ "===============================================================================\n",
+ " coef std err z P>|z| [0.025 0.975]\n",
+ "-------------------------------------------------------------------------------\n",
+ "Intercept -1.3895 7.828 -0.178 0.859 -16.732 13.953\n",
+ "Temperature 0.0014 0.122 0.012 0.991 -0.238 0.240\n",
+ "===============================================================================\n",
+ "\"\"\""
+ ]
+ },
+ "execution_count": 4,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "import statsmodels.api as sm\n",
+ "\n",
+ "data[\"Success\"]=data.Count-data.Malfunction\n",
+ "data[\"Intercept\"]=1\n",
+ "\n",
+ "logmodel=sm.GLM(data['Frequency'], data[['Intercept','Temperature']], family=sm.families.Binomial(sm.families.links.logit)).fit()\n",
+ "\n",
+ "logmodel.summary()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "L'estimateur le plus probable du paramètre de température est 0.0014\n",
+ "et l'erreur standard de cet estimateur est de 0.122, autrement dit on\n",
+ "ne peut pas distinguer d'impact particulier et il faut prendre nos\n",
+ "estimations avec des pincettes.\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Estimation de la probabilité de dysfonctionnant des joints toriques\n",
+ "La température prévue le jour du décollage est de 31°F. Essayons\n",
+ "d'estimer la probabilité de dysfonctionnement des joints toriques à\n",
+ "cette température à partir du modèle que nous venons de construire:\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAEKCAYAAAAcgp5RAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAGyFJREFUeJzt3X2UVPWd5/H3pxuQBhEjkhkFDWSWtHF9ABRQWZ3WqGhORLPrE2vGMRNCdmeMk83Knng2E43Rc2YHd2I26zgy6jgxiUo8iiSHCahjT2Y8PoCCILAIY4g2JEGND7Q2Snd/9497u6kuqunqpvqhfnxe5/Tpurd+de/3V7fvp27fuvUrRQRmZpaumsEuwMzM+peD3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90bEX3SZmY1UWHgU3U72rWYdtwv/zovflIoeltsS+RtZ+Zgx/xeYHhHbJd1CFviltLL3P+biNu8X9elPI+JJzPqJT91YNXkCuFzSkZBdndOH0xznK/uO2FFkY5k/3Yvl1pG9cLyZj+j5nwru2wWMKZjeRvbVfRS1K7YC+NOOYXWVfcdrXS/7ZLZfPqK3qhER6/PRCp+QVEM2ot9/oXfjjf8r8GPgD4D7O66SKWe5EfGWpH8gG6b5V8BzBXf/PXC3pBay9wFuAv5O0m+A5/dTz11koxCuzU8b7SR7ATKrGF9eaQeN/IqWEyLia4Ndi9lA8qkbM7PE+YjezCxxPqI3M0ucg97MLHEOejOzxDnozcwS56A3M0vc/wcowwoTqhaBUgAAAABJRU5ErkJggg==\n",
+ "text/plain": [
+ "
"
+ ]
+ },
+ "metadata": {
+ "needs_background": "light"
+ },
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "%matplotlib inline\n",
+ "data_pred = pd.DataFrame({'Temperature': np.linspace(start=30, stop=90, num=121), 'Intercept': 1})\n",
+ "data_pred['Frequency'] = logmodel.predict(data_pred[['Intercept','Temperature']])\n",
+ "data_pred.plot(x=\"Temperature\",y=\"Frequency\",kind=\"line\",ylim=[0,1])\n",
+ "plt.scatter(x=data[\"Temperature\"],y=data[\"Frequency\"])\n",
+ "plt.grid(True)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "hideCode": false,
+ "hidePrompt": false,
+ "scrolled": true
+ },
+ "source": [
+ "Comme on pouvait s'attendre au vu des données initiales, la\n",
+ "température n'a pas d'impact notable sur la probabilité d'échec des\n",
+ "joints toriques. Elle sera d'environ 0.2, comme dans les essais\n",
+ "précédents où nous il y a eu défaillance d'au moins un joint. Revenons\n",
+ "à l'ensemble des données initiales pour estimer la probabilité de\n",
+ "défaillance d'un joint:\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "0.06521739130434782\n"
+ ]
+ }
+ ],
+ "source": [
+ "data = pd.read_csv(\"shuttle.csv\")\n",
+ "print(np.sum(data.Malfunction)/np.sum(data.Count))"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Cette probabilité est donc d'environ $p=0.065$, sachant qu'il existe\n",
+ "un joint primaire un joint secondaire sur chacune des trois parties du\n",
+ "lançeur, la probabilité de défaillance des deux joints d'un lançeur\n",
+ "est de $p^2 \\approx 0.00425$. La probabilité de défaillance d'un des\n",
+ "lançeur est donc de $1-(1-p^2)^3 \\approx 1.2%$. Ça serait vraiment\n",
+ "pas de chance... Tout est sous contrôle, le décollage peut donc avoir\n",
+ "lieu demain comme prévu.\n",
+ "\n",
+ "Seulement, le lendemain, la navette Challenger explosera et emportera\n",
+ "avec elle ses sept membres d'équipages. L'opinion publique est\n",
+ "fortement touchée et lors de l'enquête qui suivra, la fiabilité des\n",
+ "joints toriques sera directement mise en cause. Au delà des problèmes\n",
+ "de communication interne à la NASA qui sont pour beaucoup dans ce\n",
+ "fiasco, l'analyse précédente comporte (au moins) un petit\n",
+ "problème... Saurez-vous le trouver ? Vous êtes libre de modifier cette\n",
+ "analyse et de regarder ce jeu de données sous tous les angles afin\n",
+ "d'expliquer ce qui ne va pas."
+ ]
+ }
+ ],
+ "metadata": {
+ "celltoolbar": "Hide code",
+ "kernelspec": {
+ "display_name": "Python 3",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.6.4"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}
diff --git a/module2/exo5/exo5_fr-Copy1.ipynb b/module2/exo5/exo5_fr-Copy1.ipynb
new file mode 100644
index 0000000..0089406
--- /dev/null
+++ b/module2/exo5/exo5_fr-Copy1.ipynb
@@ -0,0 +1,713 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Analyse du risque de défaillance des joints toriques de la navette Challenger"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Le 27 Janvier 1986, veille du décollage de la navette *Challenger*, eu\n",
+ "lieu une télé-conférence de trois heures entre les ingénieurs de la\n",
+ "Morton Thiokol (constructeur d'un des moteurs) et de la NASA. La\n",
+ "discussion portait principalement sur les conséquences de la\n",
+ "température prévue au moment du décollage de 31°F (juste en dessous de\n",
+ "0°C) sur le succès du vol et en particulier sur la performance des\n",
+ "joints toriques utilisés dans les moteurs. En effet, aucun test\n",
+ "n'avait été effectué à cette température.\n",
+ "\n",
+ "L'étude qui suit reprend donc une partie des analyses effectuées cette\n",
+ "nuit là et dont l'objectif était d'évaluer l'influence potentielle de\n",
+ "la température et de la pression à laquelle sont soumis les joints\n",
+ "toriques sur leur probabilité de dysfonctionnement. Pour cela, nous\n",
+ "disposons des résultats des expériences réalisées par les ingénieurs\n",
+ "de la NASA durant les 6 années précédant le lancement de la navette\n",
+ "Challenger.\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Chargement des données\n",
+ "Nous commençons donc par charger ces données:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "
\n",
+ "\n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
\n",
+ "
Date
\n",
+ "
Count
\n",
+ "
Temperature
\n",
+ "
Pressure
\n",
+ "
Malfunction
\n",
+ "
\n",
+ " \n",
+ " \n",
+ "
\n",
+ "
0
\n",
+ "
4/12/81
\n",
+ "
6
\n",
+ "
66
\n",
+ "
50
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
1
\n",
+ "
11/12/81
\n",
+ "
6
\n",
+ "
70
\n",
+ "
50
\n",
+ "
1
\n",
+ "
\n",
+ "
\n",
+ "
2
\n",
+ "
3/22/82
\n",
+ "
6
\n",
+ "
69
\n",
+ "
50
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
3
\n",
+ "
11/11/82
\n",
+ "
6
\n",
+ "
68
\n",
+ "
50
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
4
\n",
+ "
4/04/83
\n",
+ "
6
\n",
+ "
67
\n",
+ "
50
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
5
\n",
+ "
6/18/82
\n",
+ "
6
\n",
+ "
72
\n",
+ "
50
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
6
\n",
+ "
8/30/83
\n",
+ "
6
\n",
+ "
73
\n",
+ "
100
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
7
\n",
+ "
11/28/83
\n",
+ "
6
\n",
+ "
70
\n",
+ "
100
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
8
\n",
+ "
2/03/84
\n",
+ "
6
\n",
+ "
57
\n",
+ "
200
\n",
+ "
1
\n",
+ "
\n",
+ "
\n",
+ "
9
\n",
+ "
4/06/84
\n",
+ "
6
\n",
+ "
63
\n",
+ "
200
\n",
+ "
1
\n",
+ "
\n",
+ "
\n",
+ "
10
\n",
+ "
8/30/84
\n",
+ "
6
\n",
+ "
70
\n",
+ "
200
\n",
+ "
1
\n",
+ "
\n",
+ "
\n",
+ "
11
\n",
+ "
10/05/84
\n",
+ "
6
\n",
+ "
78
\n",
+ "
200
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
12
\n",
+ "
11/08/84
\n",
+ "
6
\n",
+ "
67
\n",
+ "
200
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
13
\n",
+ "
1/24/85
\n",
+ "
6
\n",
+ "
53
\n",
+ "
200
\n",
+ "
2
\n",
+ "
\n",
+ "
\n",
+ "
14
\n",
+ "
4/12/85
\n",
+ "
6
\n",
+ "
67
\n",
+ "
200
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
15
\n",
+ "
4/29/85
\n",
+ "
6
\n",
+ "
75
\n",
+ "
200
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
16
\n",
+ "
6/17/85
\n",
+ "
6
\n",
+ "
70
\n",
+ "
200
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
17
\n",
+ "
7/29/85
\n",
+ "
6
\n",
+ "
81
\n",
+ "
200
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
18
\n",
+ "
8/27/85
\n",
+ "
6
\n",
+ "
76
\n",
+ "
200
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
19
\n",
+ "
10/03/85
\n",
+ "
6
\n",
+ "
79
\n",
+ "
200
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
20
\n",
+ "
10/30/85
\n",
+ "
6
\n",
+ "
75
\n",
+ "
200
\n",
+ "
2
\n",
+ "
\n",
+ "
\n",
+ "
21
\n",
+ "
11/26/85
\n",
+ "
6
\n",
+ "
76
\n",
+ "
200
\n",
+ "
0
\n",
+ "
\n",
+ "
\n",
+ "
22
\n",
+ "
1/12/86
\n",
+ "
6
\n",
+ "
58
\n",
+ "
200
\n",
+ "
1
\n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " Date Count Temperature Pressure Malfunction\n",
+ "0 4/12/81 6 66 50 0\n",
+ "1 11/12/81 6 70 50 1\n",
+ "2 3/22/82 6 69 50 0\n",
+ "3 11/11/82 6 68 50 0\n",
+ "4 4/04/83 6 67 50 0\n",
+ "5 6/18/82 6 72 50 0\n",
+ "6 8/30/83 6 73 100 0\n",
+ "7 11/28/83 6 70 100 0\n",
+ "8 2/03/84 6 57 200 1\n",
+ "9 4/06/84 6 63 200 1\n",
+ "10 8/30/84 6 70 200 1\n",
+ "11 10/05/84 6 78 200 0\n",
+ "12 11/08/84 6 67 200 0\n",
+ "13 1/24/85 6 53 200 2\n",
+ "14 4/12/85 6 67 200 0\n",
+ "15 4/29/85 6 75 200 0\n",
+ "16 6/17/85 6 70 200 0\n",
+ "17 7/29/85 6 81 200 0\n",
+ "18 8/27/85 6 76 200 0\n",
+ "19 10/03/85 6 79 200 0\n",
+ "20 10/30/85 6 75 200 2\n",
+ "21 11/26/85 6 76 200 0\n",
+ "22 1/12/86 6 58 200 1"
+ ]
+ },
+ "execution_count": 1,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "import numpy as np\n",
+ "import pandas as pd\n",
+ "data = pd.read_csv(\"shuttle.csv\")\n",
+ "data"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Le jeu de données nous indique la date de l'essai, le nombre de joints\n",
+ "toriques mesurés (il y en a 6 sur le lançeur principal), la\n",
+ "température (en Farenheit) et la pression (en psi), et enfin le\n",
+ "nombre de dysfonctionnements relevés. "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Inspection graphique des données\n",
+ "Les vols où aucun incident n'est relevé n'apportant aucun information\n",
+ "sur l'influence de la température ou de la pression sur les\n",
+ "dysfonctionnements, nous nous concentrons sur les expériences où au\n",
+ "moins un joint a été défectueux.\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "
"
+ ]
+ },
+ "metadata": {
+ "needs_background": "light"
+ },
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "%matplotlib inline\n",
+ "pd.set_option('mode.chained_assignment',None) # this removes a useless warning from pandas\n",
+ "import matplotlib.pyplot as plt\n",
+ "\n",
+ "data[\"Frequency\"]=data.Malfunction/data.Count\n",
+ "data.plot(x=\"Temperature\",y=\"Frequency\",kind=\"scatter\",ylim=[0,1])\n",
+ "plt.grid(True)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "À première vue, ce n'est pas flagrant mais bon, essayons quand même\n",
+ "d'estimer l'impact de la température $t$ sur la probabilité de\n",
+ "dysfonctionnements d'un joint. \n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Estimation de l'influence de la température\n",
+ "\n",
+ "Supposons que chacun des 6 joints toriques est endommagé avec la même\n",
+ "probabilité et indépendamment des autres et que cette probabilité ne\n",
+ "dépend que de la température. Si on note $p(t)$ cette probabilité, le\n",
+ "nombre de joints $D$ dysfonctionnant lorsque l'on effectue le vol à\n",
+ "température $t$ suit une loi binomiale de paramètre $n=6$ et\n",
+ "$p=p(t)$. Pour relier $p(t)$ à $t$, on va donc effectuer une\n",
+ "régression logistique."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "
\n",
+ "
Generalized Linear Model Regression Results
\n",
+ "
\n",
+ "
Dep. Variable:
Frequency
No. Observations:
7
\n",
+ "
\n",
+ "
\n",
+ "
Model:
GLM
Df Residuals:
5
\n",
+ "
\n",
+ "
\n",
+ "
Model Family:
Binomial
Df Model:
1
\n",
+ "
\n",
+ "
\n",
+ "
Link Function:
logit
Scale:
1.0000
\n",
+ "
\n",
+ "
\n",
+ "
Method:
IRLS
Log-Likelihood:
-2.5250
\n",
+ "
\n",
+ "
\n",
+ "
Date:
Sat, 13 Apr 2019
Deviance:
0.22231
\n",
+ "
\n",
+ "
\n",
+ "
Time:
19:11:24
Pearson chi2:
0.236
\n",
+ "
\n",
+ "
\n",
+ "
No. Iterations:
4
Covariance Type:
nonrobust
\n",
+ "
\n",
+ "
\n",
+ "
\n",
+ "
\n",
+ "
coef
std err
z
P>|z|
[0.025
0.975]
\n",
+ "
\n",
+ "
\n",
+ "
Intercept
-1.3895
7.828
-0.178
0.859
-16.732
13.953
\n",
+ "
\n",
+ "
\n",
+ "
Temperature
0.0014
0.122
0.012
0.991
-0.238
0.240
\n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ "\n",
+ "\"\"\"\n",
+ " Generalized Linear Model Regression Results \n",
+ "==============================================================================\n",
+ "Dep. Variable: Frequency No. Observations: 7\n",
+ "Model: GLM Df Residuals: 5\n",
+ "Model Family: Binomial Df Model: 1\n",
+ "Link Function: logit Scale: 1.0000\n",
+ "Method: IRLS Log-Likelihood: -2.5250\n",
+ "Date: Sat, 13 Apr 2019 Deviance: 0.22231\n",
+ "Time: 19:11:24 Pearson chi2: 0.236\n",
+ "No. Iterations: 4 Covariance Type: nonrobust\n",
+ "===============================================================================\n",
+ " coef std err z P>|z| [0.025 0.975]\n",
+ "-------------------------------------------------------------------------------\n",
+ "Intercept -1.3895 7.828 -0.178 0.859 -16.732 13.953\n",
+ "Temperature 0.0014 0.122 0.012 0.991 -0.238 0.240\n",
+ "===============================================================================\n",
+ "\"\"\""
+ ]
+ },
+ "execution_count": 4,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "import statsmodels.api as sm\n",
+ "\n",
+ "data[\"Success\"]=data.Count-data.Malfunction\n",
+ "data[\"Intercept\"]=1\n",
+ "\n",
+ "logmodel=sm.GLM(data['Frequency'], data[['Intercept','Temperature']], family=sm.families.Binomial(sm.families.links.logit)).fit()\n",
+ "\n",
+ "logmodel.summary()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "L'estimateur le plus probable du paramètre de température est 0.0014\n",
+ "et l'erreur standard de cet estimateur est de 0.122, autrement dit on\n",
+ "ne peut pas distinguer d'impact particulier et il faut prendre nos\n",
+ "estimations avec des pincettes.\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Estimation de la probabilité de dysfonctionnant des joints toriques\n",
+ "La température prévue le jour du décollage est de 31°F. Essayons\n",
+ "d'estimer la probabilité de dysfonctionnement des joints toriques à\n",
+ "cette température à partir du modèle que nous venons de construire:\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAEKCAYAAAAcgp5RAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAGyFJREFUeJzt3X2UVPWd5/H3pxuQBhEjkhkFDWSWtHF9ABRQWZ3WqGhORLPrE2vGMRNCdmeMk83Knng2E43Rc2YHd2I26zgy6jgxiUo8iiSHCahjT2Y8PoCCILAIY4g2JEGND7Q2Snd/9497u6kuqunqpvqhfnxe5/Tpurd+de/3V7fvp27fuvUrRQRmZpaumsEuwMzM+peD3swscQ56M7PEOejNzBLnoDczS5yD3swscT0GvaR7Je2U9HI390vS/5G0VdI6SdMrX6aZmfVVOUf09wEX7Of+C4Ep+c8C4M4DL8vMzCqlx6CPiF8Av9tPk4uBH0TmWeBwSUdVqkAzMzswwyqwjAnA6wXTTfm8Xxc3lLSA7KifkSNHnnLsscdWYPVDU3t7OzU16b4FknL/Uu4buH/V7pVXXnkzIsb35jGVCHqVmFdyXIWIWAwsBqivr4/NmzdXYPVDU2NjIw0NDYNdRr9JuX8p9w3cv2on6Ve9fUwlXvaagGMKpicCOyqwXDMzq4BKBP0y4Or86pvTgHcjYp/TNmZmNjh6PHUj6QGgAThSUhNwIzAcICL+FlgOfBbYCnwAfLG/ijUzs97rMegjYl4P9wfwZxWryMyqwp49e2hqamL37t2DXUoXY8eOZdOmTYNdxgEbOXIkEydOZPjw4Qe8rEq8GWtmB6GmpibGjBnDpEmTkEpdkzE4du3axZgxYwa7jAMSEbz11ls0NTUxefLkA15eutcgmVm/2r17N+PGjRtSIZ8KSYwbN65i/y056M2szxzy/aeSz62D3swscT5Hb2ZVq7a2lhNPPLFzeunSpYwbN24QKxqaHPRmVrXq6upYu3Ztl3m7du3qvN3a2sqwYY45n7oxs6T86Ec/4rLLLuOiiy7i/PPPB2DRokXMmDGDk046iRtvvLGz7a233kp9fT3nnnsu8+bN47bbbgOgoaGB1atXA/Dmm28yadIkANra2li4cGHnsu666y5g77ALl156KccddxxXXXUV2ZXnsGrVKs444wxOPvlkZs6cya5duzjzzDO7vEDNnj2bdevW9dtz4pc6Mztg3/7pBjbueK+iyzz+6MO48aJ/v982LS0tTJ06FYDJkyfz6KOPAvDMM8+wbt06jjjiCFauXMmWLVt4/vnniQjmzp3LL37xC0aPHs2DDz7ImjVraG1tZfr06Zxyyin7Xd8999zD2LFjWbVqFR9++CGzZ8/ufDFZs2YNGzZs4Oijj2b27Nk8/fTTzJw5kyuuuIKHHnqIGTNm8N5771FXV8f8+fO57777uP3223nllVf48MMPOemkkyrwrJXmoDezqlXq1A3AeeedxxFHHAHAypUrWblyJdOmTQOgubmZLVu2sGvXLj7/+c8zatQoAObOndvj+lauXMm6det4+OGHAXj33XfZsmULI0aMYObMmUycOBGAqVOnsm3bNsaOHctRRx3FjBkzADjssMMAuOyyy/jOd77DokWLuPfee7nmmmsO7InogYPezA5YT0feA2306NGdtyOCG264ga985Std2tx+++3dXsI4bNgw2tvbAbpcyx4RfP/732fOnDld2jc2NnLIIYd0TtfW1tLa2kpElFzHqFGjOO+883jsscdYsmRJ52mi/uJz9GaWtDlz5nDvvffS3NwMwPbt29m5cydnnXUWjz76KC0tLezatYuf/vSnnY+ZNGkSL7zwAkDn0XvHsu6880727NkDwCuvvML777/f7bqPO+44duzYwapVq4DsjeLW1lYA5s+fz3XXXceMGTM6//voLz6iN7OknX/++WzatInTTz8dgEMPPZQf/vCHTJ8+nSuuuIKpU6fyiU98gjPPPLPzMddffz2XX345999/P+ecc07n/Pnz57Nt2zamT59ORDB+/HiWLl3a7bpHjBjBQw89xFe/+lVaWlqoq6vjiSee4NBDD+WUU07hsMMO44tfHIBxIC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AMyPio0EpbD8k/QmwPL8u32xI8eWVNqRJuglojojbhkAttRHR1s19/wpcGxFre7G8YQVjspj1G5+6saoi6Y+VfbfBWkl/I6lG0jBJ70haJOlFSSskzZL0z5JelfTZ/LHzJT2a379Z0jfLXO4tkp4HZkr6tqRV+Rjhf6vMFWTDbz+UP36EpKaCT4OfJumJ/PYtku6S9DjZQGrDJP11vu51kuYP/LNqqXPQW9XIx+f+PHBGPkDeMPZ+Ef1YYGU++NpHwE1kH4m/DLi5YDEz88dMB/6zpKllLPfFiJgZEc8A34uIGcCJ+X0XRMRDwFrgisjGfu/p1NI04KKI+CNgAdmgeDOBGWSDxh3bl+fHrDs+R2/V5FyyMFydDW1CHdlH+wFaIuLx/PZ64N2IaJW0HphUsIwVEfE2gKSlwH8g2w+6W+5H7B0CAuAzkhYCI4EjyYbF/cde9uOxiNid3z4f+LSkwheWKWQfbTerCAe9VRMB90bEX3SZmY1UWHgU3U72rWYdtwv/zovflIoeltsS+RtZ+Zgx/xeYHhHbJd1CFviltLL3P+biNu8X9elPI+JJzPqJT91YNXkCuFzSkZBdndOH0xznK/uO2FFkY5k/3Yvl1pG9cLyZj+j5nwru2wWMKZjeRvbVfRS1K7YC+NOOYXWVfcdrXS/7ZLZfPqK3qhER6/PRCp+QVEM2ot9/oXfjjf8r8GPgD4D7O66SKWe5EfGWpH8gG6b5V8BzBXf/PXC3pBay9wFuAv5O0m+A5/dTz11koxCuzU8b7SR7ATKrGF9eaQeN/IqWEyLia4Ndi9lA8qkbM7PE+YjezCxxPqI3M0ucg97MLHEOejOzxDnozcwS56A3M0vc/wcowwoTqhaBUgAAAABJRU5ErkJggg==\n",
+ "text/plain": [
+ "
"
+ ]
+ },
+ "metadata": {
+ "needs_background": "light"
+ },
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "%matplotlib inline\n",
+ "data_pred = pd.DataFrame({'Temperature': np.linspace(start=30, stop=90, num=121), 'Intercept': 1})\n",
+ "data_pred['Frequency'] = logmodel.predict(data_pred[['Intercept','Temperature']])\n",
+ "data_pred.plot(x=\"Temperature\",y=\"Frequency\",kind=\"line\",ylim=[0,1])\n",
+ "plt.scatter(x=data[\"Temperature\"],y=data[\"Frequency\"])\n",
+ "plt.grid(True)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "hideCode": false,
+ "hidePrompt": false,
+ "scrolled": true
+ },
+ "source": [
+ "Comme on pouvait s'attendre au vu des données initiales, la\n",
+ "température n'a pas d'impact notable sur la probabilité d'échec des\n",
+ "joints toriques. Elle sera d'environ 0.2, comme dans les essais\n",
+ "précédents où nous il y a eu défaillance d'au moins un joint. Revenons\n",
+ "à l'ensemble des données initiales pour estimer la probabilité de\n",
+ "défaillance d'un joint:\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "0.06521739130434782\n"
+ ]
+ }
+ ],
+ "source": [
+ "data = pd.read_csv(\"shuttle.csv\")\n",
+ "print(np.sum(data.Malfunction)/np.sum(data.Count))"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Cette probabilité est donc d'environ $p=0.065$, sachant qu'il existe\n",
+ "un joint primaire un joint secondaire sur chacune des trois parties du\n",
+ "lançeur, la probabilité de défaillance des deux joints d'un lançeur\n",
+ "est de $p^2 \\approx 0.00425$. La probabilité de défaillance d'un des\n",
+ "lançeur est donc de $1-(1-p^2)^3 \\approx 1.2%$. Ça serait vraiment\n",
+ "pas de chance... Tout est sous contrôle, le décollage peut donc avoir\n",
+ "lieu demain comme prévu.\n",
+ "\n",
+ "Seulement, le lendemain, la navette Challenger explosera et emportera\n",
+ "avec elle ses sept membres d'équipages. L'opinion publique est\n",
+ "fortement touchée et lors de l'enquête qui suivra, la fiabilité des\n",
+ "joints toriques sera directement mise en cause. Au delà des problèmes\n",
+ "de communication interne à la NASA qui sont pour beaucoup dans ce\n",
+ "fiasco, l'analyse précédente comporte (au moins) un petit\n",
+ "problème... Saurez-vous le trouver ? Vous êtes libre de modifier cette\n",
+ "analyse et de regarder ce jeu de données sous tous les angles afin\n",
+ "d'expliquer ce qui ne va pas."
+ ]
+ }
+ ],
+ "metadata": {
+ "celltoolbar": "Hide code",
+ "kernelspec": {
+ "display_name": "Python 3",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.6.4"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}
diff --git a/module2/exo5/exo5_fr.ipynb b/module2/exo5/exo5_fr.ipynb
index 26ad6d9..0089406 100644
--- a/module2/exo5/exo5_fr.ipynb
+++ b/module2/exo5/exo5_fr.ipynb
@@ -705,7 +705,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.7.3"
+ "version": "3.6.4"
}
},
"nbformat": 4,
diff --git a/module3/exo3/exercice.ipynb b/module3/exo3/exercice.ipynb
index 0bbbe37..d7b1a8c 100644
--- a/module3/exo3/exercice.ipynb
+++ b/module3/exo3/exercice.ipynb
@@ -1,5 +1,1119 @@
{
- "cells": [],
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "#
Concentration de CO2 dans l'atmosphère depuis 1958
"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### 1. Préambule"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Dès 1958, Charles David Keeling a débuté la mesure précise du taux de CO2 dans l'atmosphère à l'observatoire de Mauna Loa, Hawaii, États-Unis.\n",
+ "Ces mesures, qui continuent aujourd'hui, ont permis de montrer une évolution tout au long de l'année du taux de CO2 dans l'hémisphère Nord. Celle-ci étant provenant du cycle de vie des plantes.\n",
+ "De même, ces données ont montrés une évolution continue du taux de CO2 dans l'atmosphère depuis 1958."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### 2. Travail à faire"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Le but de l'exercide est de réaliser un document computationnel pour :\n",
+ "* Réalisez un graphique qui vous montrera une oscillation périodique superposée à une évolution systématique plus lente.\n",
+ "* Séparez ces deux phénomènes. Caractérisez l'oscillation périodique. Proposez un modèle simple de la contribution lente, estimez ses paramètres et tentez une extrapolation jusqu'à 2025 (dans le but de pouvoir valider le modèle par des observations futures).\n",
+ "* Déposer dans FUN votre résultat."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### 2. Données"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Les données sont disponibles sur le site Web de l'institut Scripps à l'adresse suivante :\n",
+ "\n",
+ "https://scrippsco2.ucsd.edu/data/atmospheric_co2/primary_mlo_co2_record.html\n",
+ "\n",
+ "Cette base de données est mise à jour régulièrement.\n",
+ "\n",
+ "Nous travaillerons sur une base locale (copiée sur le serveur Jupyter de l'INRIA) téléchargée le 12 avril 2020.\n",
+ "La totalité des documents nécessaires à cette étude seront committés sur le serveur GitLab de l'INRIA."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### 3. Exploration des données"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Nous commencerons par analyser le contenu du fichier de données (fichier structuré CSV) pour ensuite faire un premier tracé de l'ensemble de la base de données.\n",
+ "\n",
+ "Nous utiliserons les libraries *pandas* et *matplotlib* pour *python 3.6*."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Import des librairies\n",
+ "import pandas as pd\n",
+ "import matplotlib as plt"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "