From 4c59ec9aefef8ea5464723a293b3aa39ee02dc60 Mon Sep 17 00:00:00 2001 From: Benjamin Auder Date: Thu, 16 Feb 2017 17:18:43 +0100 Subject: [PATCH] 'update' --- ....ipynb => report_2017-03-01.average.ipynb} | 74 +++++++++++++++++-- reports/report_2017-03-01.zero.ipynb | 55 +++++++++++++- 2 files changed, 121 insertions(+), 8 deletions(-) rename reports/{report_2017-03-01.nbconvert.ipynb => report_2017-03-01.average.ipynb} (86%) diff --git a/reports/report_2017-03-01.nbconvert.ipynb b/reports/report_2017-03-01.average.ipynb similarity index 86% rename from reports/report_2017-03-01.nbconvert.ipynb rename to reports/report_2017-03-01.average.ipynb index bd2e25e..4f563cc 100644 --- a/reports/report_2017-03-01.nbconvert.ipynb +++ b/reports/report_2017-03-01.average.ipynb @@ -53,7 +53,7 @@ "indices = seq(as.Date(\"2015-01-18\"),as.Date(\"2015-01-24\"),\"days\")\n", "p_ch_nn = getForecast(data,indices,\"Neighbors\",\"Neighbors\",simtype=\"mix\",same_season=FALSE,mix_strategy=\"mult\")\n", "p_ch_pz = getForecast(data, indices, \"Persistence\", \"Zero\", same_day=TRUE)\n", - "p_ch_az = getForecast(data, indices, \"Average\", \"Zero\", memory=183)\n", + "p_ch_az = getForecast(data, indices, \"Average\", \"Zero\") #, memory=183)\n", "#p_ch_zz = getForecast(data, indices, \"Zero\", \"Zero\")\n", "#p_ch_l = getForecast(data, indices, \"Level\", same_day=FALSE)" ] @@ -107,6 +107,26 @@ "Prédictions d'autant plus lisses que le jour à prévoir est atypique (pollué)." ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "par(mfrow=c(1,2))\n", + "plotPredReal(data, p_ch_az, 3)\n", + "plotPredReal(data, p_ch_az, 4)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Les erreurs sont proches, mais les courbes prédites très différentes : avantage à \"Neighbors\"" + ] + }, { "cell_type": "code", "execution_count": null, @@ -181,7 +201,7 @@ "indices = seq(as.Date(\"2015-03-15\"),as.Date(\"2015-03-21\"),\"days\")\n", "p_ep_nn = getForecast(data,indices,\"Neighbors\",\"Neighbors\",simtype=\"mix\",same_season=FALSE,mix_strategy=\"mult\")\n", "p_ep_pz = getForecast(data, indices, \"Persistence\", \"Zero\", same_day=TRUE)\n", - "p_ep_az = getForecast(data, indices, \"Average\", \"Zero\", memory=183)\n", + "p_ep_az = getForecast(data, indices, \"Average\", \"Zero\") #, memory=183)\n", "#p_ep_zz = getForecast(data, indices, \"Zero\", \"Zero\")\n", "#p_ep_l = getForecast(data, indices, \"Level\", same_day=TRUE)" ] @@ -223,7 +243,9 @@ "par(mfrow=c(1,2))\n", "options(repr.plot.width=9, repr.plot.height=4)\n", "plotPredReal(data, p_ep_nn, 4)\n", - "plotPredReal(data, p_ep_nn, 6)" + "plotPredReal(data, p_ep_nn, 6)\n", + "\n", + "#Bleu: prévue, noir: réalisée" ] }, { @@ -233,6 +255,26 @@ "À gauche un jour \"bien\" prévu, à droite le pic d'erreur (jour 6)." ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "par(mfrow=c(1,2))\n", + "plotPredReal(data, p_ep_pz, 4)\n", + "plotPredReal(data, p_ep_pz, 6)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Bonnes performances de la persistence (par chance...)" + ] + }, { "cell_type": "code", "execution_count": null, @@ -284,7 +326,7 @@ "indices = seq(as.Date(\"2015-04-26\"),as.Date(\"2015-05-02\"),\"days\")\n", "p_np_nn = getForecast(data,indices,\"Neighbors\",\"Neighbors\",simtype=\"mix\",same_season=FALSE,mix_strategy=\"mult\")\n", "p_np_pz = getForecast(data, indices, \"Persistence\", \"Zero\", same_day=FALSE)\n", - "p_np_az = getForecast(data, indices, \"Average\", \"Zero\", memory=183)\n", + "p_np_az = getForecast(data, indices, \"Average\", \"Zero\") #, memory=183)\n", "#p_np_zz = getForecast(data, indices, \"Zero\", \"Zero\")\n", "#p_np_l = getForecast(data, indices, \"Level\", same_day=FALSE)" ] @@ -326,7 +368,9 @@ "par(mfrow=c(1,2))\n", "options(repr.plot.width=9, repr.plot.height=4)\n", "plotPredReal(data, p_np_nn, 3)\n", - "plotPredReal(data, p_np_nn, 6)" + "plotPredReal(data, p_np_nn, 6)\n", + "\n", + "#Bleu: prévue, noir: réalisée" ] }, { @@ -336,6 +380,26 @@ "Les \"bonnes\" prédictions (à gauche) sont tout de même trop lissées." ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "par(mfrow=c(1,2))\n", + "plotPredReal(data, p_np_az, 3)\n", + "plotPredReal(data, p_np_az, 6)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Légèrement meilleur ajustement par la méthode \"Average\" ; très net à droite." + ] + }, { "cell_type": "code", "execution_count": null, diff --git a/reports/report_2017-03-01.zero.ipynb b/reports/report_2017-03-01.zero.ipynb index 26f4682..cf51e90 100644 --- a/reports/report_2017-03-01.zero.ipynb +++ b/reports/report_2017-03-01.zero.ipynb @@ -107,6 +107,21 @@ "Prédictions d'autant plus lisses que le jour à prévoir est atypique (pollué)." ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "par(mfrow=c(1,2))\n", + "plotPredReal(data, p_ch_zz, 3)\n", + "plotPredReal(data, p_ch_zz, 6)\n", + "\n", + "#Méthode \"zero\" :" + ] + }, { "cell_type": "code", "execution_count": null, @@ -223,7 +238,9 @@ "par(mfrow=c(1,2))\n", "options(repr.plot.width=9, repr.plot.height=4)\n", "plotPredReal(data, p_ep_nn, 4)\n", - "plotPredReal(data, p_ep_nn, 6)" + "plotPredReal(data, p_ep_nn, 6)\n", + "\n", + "#Bleu: prévue, noir: réalisée" ] }, { @@ -233,6 +250,21 @@ "À gauche un jour \"bien\" prévu, à droite le pic d'erreur (jour 6)." ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "par(mfrow=c(1,2))\n", + "plotPredReal(data, p_ep_zz, 4)\n", + "plotPredReal(data, p_ep_zz, 6)\n", + "\n", + "#Méthode \"zero\" :" + ] + }, { "cell_type": "code", "execution_count": null, @@ -326,7 +358,9 @@ "par(mfrow=c(1,2))\n", "options(repr.plot.width=9, repr.plot.height=4)\n", "plotPredReal(data, p_np_nn, 3)\n", - "plotPredReal(data, p_np_nn, 6)" + "plotPredReal(data, p_np_nn, 6)\n", + "\n", + "#Bleu: prévue, noir: réalisée" ] }, { @@ -336,6 +370,21 @@ "Les \"bonnes\" prédictions (à gauche) sont tout de même trop lissées." ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "par(mfrow=c(1,2))\n", + "plotPredReal(data, p_np_zz, 4)\n", + "plotPredReal(data, p_np_zz, 6)\n", + "\n", + "#Méthode \"zero\" :" + ] + }, { "cell_type": "code", "execution_count": null, @@ -383,7 +432,7 @@ "source": [ "## Bilan\n", "\n", - "Problème difficile : on ne fait guère mieux qu'une naïve moyenne des lendemains des jours similaires dans le passé, ce qui est à peu près équivalent à prédire une série constante égale à la dernière valeur observée (méthode \"zéro\"). La persistence donne parfois de bons résultats mais est trop instable (sensibilité à l'argument same_day).\n", + "Problème difficile : en terme d'erreur moyenne, on ne fait guère mieux que de prédire une série constante égale à la dernière valeur observée (méthode \"zéro\"). La persistence donne parfois de bons résultats mais est trop instable (sensibilité à l'argument same_day).\n", "\n", "Comment améliorer la méthode ?" ] -- 2.44.0