},
"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\")"
]
},
{
"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)"
]
},
{
"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"
"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"
]
},
"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\")"
]
},
{
"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",
"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"
]
"cell_type": "markdown",
"metadata": {},
"source": [
- "Bonnes performances de la persistence (par chance...)"
+ "Assez bonnes performances de la persistence (par chance...)"
]
},
{
"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."
]
},
{
"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": [
+ "<h2 style=\"color:blue;font-size:2em\">Semaine non polluée</h2>"
]
},
{
},
"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\")"
]
},
{
"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"
"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."
]
},
{
"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."
]
},
{