Précisions sur les IC (avec nouveau code séparé pour essai)

parent 67b34b0d
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 4
}
......@@ -385,7 +385,7 @@
"cell_type": "code",
"execution_count": 5,
"metadata": {
"hideCode": false,
"hideCode": true,
"hidePrompt": true
},
"outputs": [],
......@@ -492,11 +492,11 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: lmfit in /opt/conda/lib/python3.6/site-packages (1.0.0)\n",
"Requirement already satisfied: scipy>=1.2 in /opt/conda/lib/python3.6/site-packages (from lmfit) (1.4.1)\n",
"Requirement already satisfied: uncertainties>=3.0.1 in /opt/conda/lib/python3.6/site-packages (from lmfit) (3.1.2)\n",
"Requirement already satisfied: numpy>=1.16 in /opt/conda/lib/python3.6/site-packages (from lmfit) (1.18.2)\n",
"Requirement already satisfied: asteval>=0.9.16 in /opt/conda/lib/python3.6/site-packages (from lmfit) (0.9.18)\n"
"Requirement already satisfied: lmfit in /opt/conda/lib/python3.6/site-packages (1.0.0)\r\n",
"Requirement already satisfied: asteval>=0.9.16 in /opt/conda/lib/python3.6/site-packages (from lmfit) (0.9.18)\r\n",
"Requirement already satisfied: numpy>=1.16 in /opt/conda/lib/python3.6/site-packages (from lmfit) (1.18.2)\r\n",
"Requirement already satisfied: scipy>=1.2 in /opt/conda/lib/python3.6/site-packages (from lmfit) (1.4.1)\r\n",
"Requirement already satisfied: uncertainties>=3.0.1 in /opt/conda/lib/python3.6/site-packages (from lmfit) (3.1.2)\r\n"
]
}
],
......@@ -516,6 +516,7 @@
"source": [
"# Import des librairies\n",
"from lmfit.models import QuadraticModel, Model\n",
"import lmfit\n",
"from sklearn.metrics import r2_score"
]
},
......@@ -567,41 +568,58 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 37,
"metadata": {
"hideCode": false,
"hideOutput": true,
"hidePrompt": true
},
"outputs": [],
"source": [
"# Mise en dictionnaire des meilleures paramètres calculés\n",
"coeffs_long_trend = result_long_trend.params.valuesdict() "
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"hideCode": true,
"hidePrompt": true
},
"outputs": [
{
"data": {
"text/plain": [
"OrderedDict([('a', 0.012977452801551667),\n",
" ('b', 0.7677869942992783),\n",
" ('c', 314.5704951470056)])"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
"name": "stdout",
"output_type": "stream",
"text": [
"[[Variables]]\n",
" a: 0.01297745 +/- 1.4176e-04 (1.09%) (init = 0.01297745)\n",
" b: 0.76778699 +/- 0.00913468 (1.19%) (init = 0.767787)\n",
" c: 314.570495 +/- 0.12419930 (0.04%) (init = 314.5705)\n",
"[[Correlations]] (unreported correlations are < 0.100)\n",
" C(a, b) = -0.969\n",
" C(b, c) = -0.873\n",
" C(a, c) = 0.756\n"
]
}
],
"source": [
"# Affichage des meilleures paramètres calculés\n",
"coeffs_long_trend = result_long_trend.params.valuesdict()\n",
"coeffs_long_trend "
"#Affichage des meilleures paramètres calculés avec les intervalles de confiances\n",
"print(lmfit.fit_report(result_long_trend.params))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"hideCode": false,
"hidePrompt": true
},
"source": [
"Ci-dessus, les différents paramètres de la courbe d'ajustement à long terme (fonction quadratique)."
]
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 13,
"metadata": {
"hideCode": false,
"hidePrompt": true
......@@ -618,7 +636,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 14,
"metadata": {
"hideCode": false,
"hidePrompt": true
......@@ -631,7 +649,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 15,
"metadata": {
"hideCode": false,
"hidePrompt": true
......@@ -643,7 +661,7 @@
"0.9936252499490063"
]
},
"execution_count": 14,
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
......@@ -666,9 +684,9 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 16,
"metadata": {
"hideCode": true,
"hideCode": false,
"hidePrompt": true
},
"outputs": [
......@@ -714,6 +732,16 @@
"fig.tight_layout()"
]
},
{
"cell_type": "markdown",
"metadata": {
"hidePrompt": true
},
"source": [
"L'intervalle de confiance de la courbe ajustée n'est pas tracée sur les graphes précédents car il est très etroit. \n",
"Celui-ci dégraderait la lisibilité des graphiques."
]
},
{
"cell_type": "markdown",
"metadata": {
......@@ -736,7 +764,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 17,
"metadata": {
"hideCode": false,
"hidePrompt": true
......@@ -749,7 +777,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 18,
"metadata": {
"hideCode": true,
"hidePrompt": true
......@@ -758,10 +786,10 @@
{
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x7f4bee2fec88>"
"<matplotlib.axes._subplots.AxesSubplot at 0x7fa3f4fdc5c0>"
]
},
"execution_count": 17,
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
},
......@@ -810,7 +838,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 19,
"metadata": {
"hidePrompt": true
},
......@@ -823,7 +851,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 20,
"metadata": {
"hidePrompt": true
},
......@@ -838,28 +866,38 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 38,
"metadata": {
"hideOutput": true,
"hidePrompt": true
},
"outputs": [],
"source": [
"# Affichage des meilleures paramètres calculés\n",
"coeffs_seasonal_oscillation = result_seasonal_oscillation.params.valuesdict()"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {
"hidePrompt": true
},
"outputs": [
{
"data": {
"text/plain": [
"OrderedDict([('amp', 2.5022539354204705),\n",
" ('freq', 1.0044805631567757),\n",
" ('shift', 316.19947719002874)])"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
"name": "stdout",
"output_type": "stream",
"text": [
"[[Variables]]\n",
" amp: 2.50225394 +/- 0.03484620 (1.39%) (init = 7)\n",
" freq: 1.00448056 +/- 6.1469e-05 (0.01%) (init = 1)\n",
" shift: 316.199477 +/- 0.02463756 (0.01%) (init = 0)\n"
]
}
],
"source": [
"# Affichage des meilleures paramètres calculés\n",
"coeffs_seasonal_oscillation = result_seasonal_oscillation.params.valuesdict()\n",
"coeffs_seasonal_oscillation"
"#Affichage des meilleures paramètres calculés avec les intervalles de confiances\n",
"print(lmfit.fit_report(result_seasonal_oscillation.params))"
]
},
{
......@@ -871,12 +909,14 @@
"Avec ces résulats nous pouvons caractériser l'oscillation saisonnière comme suit :\n",
"- +/- 2.5 *ppm* sur une année.\n",
"- Une féquence de 1 année pour chaque oscillation. Ce qui conforme aux observations.\n",
"- Un décalage de 316.20 *ppm* qui correspond à la première mesure de la base de données."
"- Un décalage de 316.20 *ppm* qui correspond à la première mesure de la base de données. \n",
"\n",
"Les intervalles de confiance sont là aussi très restreints. Nous faisons le choix de ne pas les représenter sur les graphiques à venir."
]
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 23,
"metadata": {
"hidePrompt": true
},
......@@ -891,7 +931,7 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 24,
"metadata": {
"hidePrompt": true
},
......@@ -903,7 +943,7 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 25,
"metadata": {
"hideCode": true,
"hidePrompt": true
......@@ -912,10 +952,10 @@
{
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x7f4bea999f98>"
"<matplotlib.axes._subplots.AxesSubplot at 0x7fa3db000278>"
]
},
"execution_count": 23,
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
},
......@@ -977,7 +1017,7 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 26,
"metadata": {
"hidePrompt": true
},
......@@ -991,7 +1031,7 @@
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": 27,
"metadata": {
"hideCode": true,
"hidePrompt": true
......@@ -1000,10 +1040,10 @@
{
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x7f4c13b6dac8>"
"<matplotlib.axes._subplots.AxesSubplot at 0x7fa4041c7550>"
]
},
"execution_count": 25,
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
},
......@@ -1039,7 +1079,7 @@
},
{
"cell_type": "code",
"execution_count": 26,
"execution_count": 28,
"metadata": {
"hidePrompt": true
},
......@@ -1050,7 +1090,7 @@
"0.997596462036615"
]
},
"execution_count": 26,
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
......@@ -1090,7 +1130,7 @@
},
{
"cell_type": "code",
"execution_count": 27,
"execution_count": 29,
"metadata": {
"hideOutput": true,
"hidePrompt": true
......@@ -1102,7 +1142,7 @@
"(52,)"
]
},
"execution_count": 27,
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
......@@ -1116,7 +1156,7 @@
},
{
"cell_type": "code",
"execution_count": 28,
"execution_count": 30,
"metadata": {
"hidePrompt": true
},
......@@ -1128,7 +1168,7 @@
},
{
"cell_type": "code",
"execution_count": 29,
"execution_count": 31,
"metadata": {
"hidePrompt": true
},
......@@ -1146,7 +1186,7 @@
},
{
"cell_type": "code",
"execution_count": 30,
"execution_count": 32,
"metadata": {
"hidePrompt": true
},
......@@ -1157,7 +1197,7 @@
"425.0"
]
},
"execution_count": 30,
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
......@@ -1170,7 +1210,7 @@
},
{
"cell_type": "code",
"execution_count": 31,
"execution_count": 33,
"metadata": {
"hidePrompt": true
},
......@@ -1181,7 +1221,7 @@
"425.0"
]
},
"execution_count": 31,
"execution_count": 33,
"metadata": {},
"output_type": "execute_result"
}
......@@ -1203,7 +1243,7 @@
},
{
"cell_type": "code",
"execution_count": 32,
"execution_count": 34,
"metadata": {
"hideCode": true,
"hidePrompt": true
......@@ -1212,10 +1252,10 @@
{
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x7f4c13bd0710>"
"<matplotlib.axes._subplots.AxesSubplot at 0x7fa40643fdd8>"
]
},
"execution_count": 32,
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
},
......@@ -1266,7 +1306,7 @@
},
{
"cell_type": "code",
"execution_count": 33,
"execution_count": 35,
"metadata": {
"hidePrompt": true
},
......@@ -1281,7 +1321,7 @@
},
{
"cell_type": "code",
"execution_count": 34,
"execution_count": 36,
"metadata": {
"hideCode": true,
"hidePrompt": true
......@@ -1290,10 +1330,10 @@
{
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x7f4c1373e470>"
"<matplotlib.axes._subplots.AxesSubplot at 0x7fa4043843c8>"
]
},
"execution_count": 34,
"execution_count": 36,
"metadata": {},
"output_type": "execute_result"
},
......@@ -1335,7 +1375,8 @@
"hidePrompt": true
},
"source": [
"Ci-dessus la prédiction pour l'année 2025 complète (courbe verte) et sa tendance à long terme (courbe orange)."
"Ci-dessus la prédiction pour l'année 2025 complète (courbe verte) et sa tendance à long terme (courbe orange). \n",
"Pour assurer une bonne lisibilité du graphique, les intervalles de confiance (très étroits) ne sont pas représentés."
]
},
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment