From: Benjamin Auder Date: Tue, 21 Feb 2017 01:13:27 +0000 (+0100) Subject: final report average 7h; TODO: others X-Git-Url: https://git.auder.net/variants/current/css/doc/html/Rlogo.svg?a=commitdiff_plain;h=69bcd8bcd649c53e456e7e1532b38d2fdb48d9e2;p=talweg.git final report average 7h; TODO: others --- diff --git a/reports/report_2017-03-01.7h_average.ipynb b/reports/report_2017-03-01.7h_average.ipynb index 6296e29..5da76eb 100644 --- a/reports/report_2017-03-01.7h_average.ipynb +++ b/reports/report_2017-03-01.7h_average.ipynb @@ -50,11 +50,11 @@ }, "outputs": [], "source": [ - "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_zz = getForecast(data, indices, \"Zero\", \"Zero\")" + "indices_ch = seq(as.Date(\"2015-01-18\"),as.Date(\"2015-01-24\"),\"days\")\n", + "p_ch_nn = getForecast(data,indices_ch,\"Neighbors\",\"Neighbors\",simtype=\"mix\",same_season=FALSE,mix_strategy=\"mult\")\n", + "p_ch_pz = getForecast(data, indices_ch, \"Persistence\", \"Zero\", same_day=TRUE)\n", + "p_ch_az = getForecast(data, indices_ch, \"Average\", \"Zero\") #, memory=183)\n", + "#p_ch_zz = getForecast(data, indices_ch, \"Zero\", \"Zero\")" ] }, { @@ -134,8 +134,8 @@ "outputs": [], "source": [ "par(mfrow=c(1,2))\n", - "f3 = computeFilaments(data, p_ch_nn$getIndexInData(3), plot=TRUE)\n", - "f4 = computeFilaments(data, p_ch_nn$getIndexInData(4), plot=TRUE)" + "f3_ch = computeFilaments(data, p_ch_nn$getIndexInData(3), plot=TRUE)\n", + "f4_ch = computeFilaments(data, p_ch_nn$getIndexInData(4), plot=TRUE)" ] }, { @@ -148,10 +148,10 @@ "source": [ "par(mfrow=c(2,2))\n", "options(repr.plot.width=9, repr.plot.height=7)\n", - "plotFilamentsBox(data, f3$indices)\n", - "plotFilamentsBox(data, f3$indices+1)\n", - "plotFilamentsBox(data, f4$indices)\n", - "plotFilamentsBox(data, f4$indices+1)\n", + "plotFilamentsBox(data, f3_ch$indices)\n", + "plotFilamentsBox(data, f3_ch$indices+1)\n", + "plotFilamentsBox(data, f4_ch$indices)\n", + "plotFilamentsBox(data, f4_ch$indices+1)\n", "\n", "#En haut : jour 3 + lendemain (4) ; en bas : jour 4 + lendemain (5)\n", "#À gauche : premières 24h ; à droite : 24h suivantes" @@ -174,8 +174,8 @@ "source": [ "par(mfrow=c(1,2))\n", "options(repr.plot.width=9, repr.plot.height=4)\n", - "plotRelativeVariability(data, f3$indices)\n", - "plotRelativeVariability(data, f4$indices)\n", + "plotRelativeVariability(data, f3_ch$indices)\n", + "plotRelativeVariability(data, f4_ch$indices)\n", "\n", "#Variabilité sur 60 courbes au hasard en rouge ; sur nos 60 voisins (+ lendemains) en noir" ] @@ -238,11 +238,11 @@ }, "outputs": [], "source": [ - "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_zz = getForecast(data, indices, \"Zero\", \"Zero\")" + "indices_ep = seq(as.Date(\"2015-03-15\"),as.Date(\"2015-03-21\"),\"days\")\n", + "p_ep_nn = getForecast(data,indices_ep,\"Neighbors\",\"Neighbors\",simtype=\"mix\",same_season=FALSE,mix_strategy=\"mult\")\n", + "p_ep_pz = getForecast(data, indices_ep, \"Persistence\", \"Zero\", same_day=TRUE)\n", + "p_ep_az = getForecast(data, indices_ep, \"Average\", \"Zero\") #, memory=183)\n", + "#p_ep_zz = getForecast(data, indices_ep, \"Zero\", \"Zero\")" ] }, { @@ -257,7 +257,6 @@ "e_ep_pz = getError(data, p_ep_pz)\n", "e_ep_az = getError(data, p_ep_az)\n", "#e_ep_zz = getError(data, p_ep_zz)\n", - "#e_ep_l = getError(data, p_ep_l)\n", "options(repr.plot.width=9, repr.plot.height=7)\n", "plotError(list(e_ep_nn, e_ep_pz, e_ep_az), cols=c(1,2,colors()[258]))\n", "\n", @@ -281,8 +280,8 @@ "source": [ "par(mfrow=c(1,2))\n", "options(repr.plot.width=9, repr.plot.height=4)\n", - "plotPredReal(data, p_ep_nn, 5)\n", - "plotPredReal(data, p_ep_nn, 2)\n", + "plotPredReal(data, p_ep_nn, 4)\n", + "plotPredReal(data, p_ep_nn, 6)\n", "\n", "#Bleu: prévue, noir: réalisée" ] @@ -311,7 +310,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Bonnes performances de la persistence (par chance...)" + "Assez bonnes performances de la persistence (par chance...)" ] }, { @@ -323,8 +322,34 @@ "outputs": [], "source": [ "par(mfrow=c(1,2))\n", - "plotFilaments(data, p_ep_nn$getIndexInData(5))\n", - "plotFilaments(data, p_ep_nn$getIndexInData(2))" + "f4_ep = computeFilaments(data, p_ep_nn$getIndexInData(4), plot=TRUE)\n", + "f6_ep = computeFilaments(data, p_ep_nn$getIndexInData(6), plot=TRUE)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "par(mfrow=c(2,2))\n", + "options(repr.plot.width=9, repr.plot.height=7)\n", + "plotFilamentsBox(data, f4_ep$indices)\n", + "plotFilamentsBox(data, f4_ep$indices+1)\n", + "plotFilamentsBox(data, f6_ep$indices)\n", + "plotFilamentsBox(data, f6_ep$indices+1)\n", + "\n", + "#En haut : jour 4 + lendemain (5) ; en bas : jour 6 + lendemain (7)\n", + "#À gauche : premières 24h ; à droite : 24h suivantes" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\"Voisinages\" catastrophiques : les jours 4 et 6 sont trop atypiques ; de façon étonnante les lendemains sont en revanche assez \"centraux\" parmi les lendemains des (mauvais) voisins." ] }, { @@ -336,22 +361,45 @@ "outputs": [], "source": [ "par(mfrow=c(1,2))\n", - "plotSimils(p_ep_nn, 5)\n", - "plotSimils(p_ep_nn, 2)" + "options(repr.plot.width=9, repr.plot.height=4)\n", + "plotRelativeVariability(data, f4_ep$indices)\n", + "plotRelativeVariability(data, f6_ep$indices)\n", + "\n", + "#Variabilité sur 60 courbes au hasard en rouge ; sur nos 60 voisins (+ lendemains) en noir" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "Même observation concernant les poids : concentrés près de zéro pour les prédictions avec peu de voisins." + "Dans la situation idéale, il faudrait que la courbe noire soit nettement plus basse que la courbe rouge. Ce n'est pas vérifié à J+1, sauf pour le jour 6 en début et fin de journée." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "par(mfrow=c(1,2))\n", + "plotSimils(p_ep_nn, 4)\n", + "plotSimils(p_ep_nn, 6)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "## Semaine non polluée" + "Poids très concentrés près de zéro pour les prédictions avec peu de voisins." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Semaine non polluée

" ] }, { @@ -362,12 +410,11 @@ }, "outputs": [], "source": [ - "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_zz = getForecast(data, indices, \"Zero\", \"Zero\")\n", - "#p_np_l = getForecast(data, indices, \"Level\", same_day=FALSE)" + "indices_np = seq(as.Date(\"2015-04-26\"),as.Date(\"2015-05-02\"),\"days\")\n", + "p_np_nn = getForecast(data,indices_np,\"Neighbors\",\"Neighbors\",simtype=\"mix\",same_season=FALSE,mix_strategy=\"mult\")\n", + "p_np_pz = getForecast(data, indices_np, \"Persistence\", \"Zero\", same_day=FALSE)\n", + "p_np_az = getForecast(data, indices_np, \"Average\", \"Zero\") #, memory=183)\n", + "#p_np_zz = getForecast(data, indices_np, \"Zero\", \"Zero\")" ] }, { @@ -382,8 +429,7 @@ "e_np_pz = getError(data, p_np_pz)\n", "e_np_az = getError(data, p_np_az)\n", "#e_np_zz = getError(data, p_np_zz)\n", - "#e_np_l = getError(data, p_np_l)\n", - "options(repr.plot.width=9, repr.plot.height=6)\n", + "options(repr.plot.width=9, repr.plot.height=7)\n", "plotError(list(e_np_nn, e_np_pz, e_np_az), cols=c(1,2,colors()[258]))\n", "\n", "#Noir: neighbors, rouge: persistence, vert: moyenne" @@ -436,7 +482,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Légèrement meilleur ajustement par la méthode \"Average\" ; très net à droite." + "Légèrement meilleur ajustement par la méthode \"Average\" ; plutôt net à droite." ] }, { @@ -448,15 +494,57 @@ "outputs": [], "source": [ "par(mfrow=c(1,2))\n", - "plotFilaments(data, p_np_nn$getIndexInData(3))\n", - "plotFilaments(data, p_np_nn$getIndexInData(6))" + "f3_np = computeFilaments(data, p_np_nn$getIndexInData(3), plot=TRUE)\n", + "f6_np = computeFilaments(data, p_np_nn$getIndexInData(6), plot=TRUE)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "par(mfrow=c(2,2))\n", + "options(repr.plot.width=9, repr.plot.height=7)\n", + "plotFilamentsBox(data, f3_np$indices)\n", + "plotFilamentsBox(data, f3_np$indices+1)\n", + "plotFilamentsBox(data, f6_np$indices)\n", + "plotFilamentsBox(data, f6_np$indices+1)\n", + "\n", + "#En haut : jour 3 + lendemain (4) ; en bas : jour 6 + lendemain (7)\n", + "#À gauche : premières 24h ; à droite : 24h suivantes" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Jours \"typiques\", donc beaucoup de voisins. En revanche les lendemains des jours similaires sont très variables." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "par(mfrow=c(1,2))\n", + "options(repr.plot.width=9, repr.plot.height=4)\n", + "plotRelativeVariability(data, f3_np$indices)\n", + "plotRelativeVariability(data, f6_np$indices)\n", + "\n", + "#Variabilité sur 60 courbes au hasard en rouge ; sur nos 60 voisins (+ lendemains) en noir" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "Jours \"typiques\", donc beaucoup de voisins." + "Situation quasi-idéale : la courbe noire est toujours assez nettement en dessous." ] }, {