From: Benjamin Auder Date: Thu, 16 Mar 2017 13:26:20 +0000 (+0100) Subject: name instead of year; ipynb generator debugged, with logging X-Git-Url: https://git.auder.net/app_dev.php/doc/html/current/git-favicon.png?a=commitdiff_plain;h=ff5df8e310b73883565761ab4b1aa5a0672e9f27;p=talweg.git name instead of year; ipynb generator debugged, with logging --- diff --git a/NOTES b/NOTES index f9f9f26..96967a5 100644 --- a/NOTES +++ b/NOTES @@ -50,3 +50,5 @@ http://hplgit.github.io/doconce/doc/pub/ipynb/ipynb_generator.html Essayer :: juste PM10, PM10 et PA ... + +use subtree here for pkgs... diff --git a/talweg/DESCRIPTION b/pkg/DESCRIPTION similarity index 100% rename from talweg/DESCRIPTION rename to pkg/DESCRIPTION diff --git a/talweg/LICENSE b/pkg/LICENSE similarity index 100% rename from talweg/LICENSE rename to pkg/LICENSE diff --git a/talweg/R/Data.R b/pkg/R/Data.R similarity index 100% rename from talweg/R/Data.R rename to pkg/R/Data.R diff --git a/talweg/R/F_Average.R b/pkg/R/F_Average.R similarity index 100% rename from talweg/R/F_Average.R rename to pkg/R/F_Average.R diff --git a/talweg/R/F_Neighbors.R b/pkg/R/F_Neighbors.R similarity index 100% rename from talweg/R/F_Neighbors.R rename to pkg/R/F_Neighbors.R diff --git a/talweg/R/F_Persistence.R b/pkg/R/F_Persistence.R similarity index 100% rename from talweg/R/F_Persistence.R rename to pkg/R/F_Persistence.R diff --git a/talweg/R/F_Zero.R b/pkg/R/F_Zero.R similarity index 100% rename from talweg/R/F_Zero.R rename to pkg/R/F_Zero.R diff --git a/talweg/R/Forecast.R b/pkg/R/Forecast.R similarity index 100% rename from talweg/R/Forecast.R rename to pkg/R/Forecast.R diff --git a/talweg/R/Forecaster.R b/pkg/R/Forecaster.R similarity index 100% rename from talweg/R/Forecaster.R rename to pkg/R/Forecaster.R diff --git a/talweg/R/J_Neighbors.R b/pkg/R/J_Neighbors.R similarity index 100% rename from talweg/R/J_Neighbors.R rename to pkg/R/J_Neighbors.R diff --git a/talweg/R/J_Persistence.R b/pkg/R/J_Persistence.R similarity index 100% rename from talweg/R/J_Persistence.R rename to pkg/R/J_Persistence.R diff --git a/talweg/R/J_Zero.R b/pkg/R/J_Zero.R similarity index 100% rename from talweg/R/J_Zero.R rename to pkg/R/J_Zero.R diff --git a/talweg/R/computeError.R b/pkg/R/computeError.R similarity index 100% rename from talweg/R/computeError.R rename to pkg/R/computeError.R diff --git a/talweg/R/computeForecast.R b/pkg/R/computeForecast.R similarity index 100% rename from talweg/R/computeForecast.R rename to pkg/R/computeForecast.R diff --git a/talweg/R/getData.R b/pkg/R/getData.R similarity index 100% rename from talweg/R/getData.R rename to pkg/R/getData.R diff --git a/talweg/R/plot.R b/pkg/R/plot.R similarity index 100% rename from talweg/R/plot.R rename to pkg/R/plot.R diff --git a/talweg/R/utils.R b/pkg/R/utils.R similarity index 100% rename from talweg/R/utils.R rename to pkg/R/utils.R diff --git a/talweg/inst/extdata/meteo_extra_noNAs.csv b/pkg/inst/extdata/meteo_extra_noNAs.csv similarity index 100% rename from talweg/inst/extdata/meteo_extra_noNAs.csv rename to pkg/inst/extdata/meteo_extra_noNAs.csv diff --git a/talweg/inst/extdata/pm10_mesures_H_loc.csv b/pkg/inst/extdata/pm10_mesures_H_loc.csv similarity index 100% rename from talweg/inst/extdata/pm10_mesures_H_loc.csv rename to pkg/inst/extdata/pm10_mesures_H_loc.csv diff --git a/talweg/inst/extdata/pm10_mesures_H_loc_report.csv b/pkg/inst/extdata/pm10_mesures_H_loc_report.csv similarity index 100% rename from talweg/inst/extdata/pm10_mesures_H_loc_report.csv rename to pkg/inst/extdata/pm10_mesures_H_loc_report.csv diff --git a/talweg/inst/testdata/exo_test.csv b/pkg/inst/testdata/exo_test.csv similarity index 100% rename from talweg/inst/testdata/exo_test.csv rename to pkg/inst/testdata/exo_test.csv diff --git a/talweg/inst/testdata/ts_test.csv b/pkg/inst/testdata/ts_test.csv similarity index 100% rename from talweg/inst/testdata/ts_test.csv rename to pkg/inst/testdata/ts_test.csv diff --git a/talweg/man/talweg-package.Rd b/pkg/man/talweg-package.Rd similarity index 100% rename from talweg/man/talweg-package.Rd rename to pkg/man/talweg-package.Rd diff --git a/talweg/tests/testthat.R b/pkg/tests/testthat.R similarity index 100% rename from talweg/tests/testthat.R rename to pkg/tests/testthat.R diff --git a/talweg/tests/testthat/test.Forecaster.R b/pkg/tests/testthat/test.Forecaster.R similarity index 100% rename from talweg/tests/testthat/test.Forecaster.R rename to pkg/tests/testthat/test.Forecaster.R diff --git a/talweg/tests/testthat/test.computeFilaments.R b/pkg/tests/testthat/test.computeFilaments.R similarity index 100% rename from talweg/tests/testthat/test.computeFilaments.R rename to pkg/tests/testthat/test.computeFilaments.R diff --git a/talweg/tests/testthat/test.dateIndexToInteger.R b/pkg/tests/testthat/test.dateIndexToInteger.R similarity index 100% rename from talweg/tests/testthat/test.dateIndexToInteger.R rename to pkg/tests/testthat/test.dateIndexToInteger.R diff --git a/talweg/vignettes/talweg.Rmd b/pkg/vignettes/talweg.Rmd similarity index 100% rename from talweg/vignettes/talweg.Rmd rename to pkg/vignettes/talweg.Rmd diff --git a/reports/ipynb_generator.py b/reports/ipynb_generator.py old mode 100644 new mode 100755 index a89ec40..4e47063 --- a/reports/ipynb_generator.py +++ b/reports/ipynb_generator.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python + import sys, os, re, logging # Languages mapping as used by markdown/pandoc @@ -44,7 +46,7 @@ def read(text, argv=sys.argv[2:]): from mako.template import Template from mako.lookup import TemplateLookup lookup = TemplateLookup(directories=[os.curdir]) - text = text.encode('utf-8') +# text = text.encode('utf-8') temp = Template(text=text, lookup=lookup, strict_undefined=True) logging.info('******* mako_kwargs: {}'.format(str(mako_kwargs))) text = temp.render(**mako_kwargs) @@ -146,7 +148,7 @@ def driver(): if __name__ == '__main__': logfile = 'tmp.log' - if os.path.isfile: + if os.path.isfile(logfile): os.remove(logfile) logging.basicConfig(format='%(message)s', level=logging.DEBUG, filename=logfile) diff --git a/reports/report.gj b/reports/report.gj index a9f10d0..b901075 100644 --- a/reports/report.gj +++ b/reports/report.gj @@ -1,6 +1,5 @@ ----- - -## Introduction +

Introduction

J'ai fait quelques essais dans différentes configurations pour la méthode "Neighbors" (la seule dont on a parlé).
Il semble que le mieux soit @@ -22,9 +21,7 @@ lendemains : ce sont donc les voisinages tels qu'utilisés dans l'algorithme. list_titles = ['Pollution par chauffage', 'Pollution par épandage', 'Semaine non polluée'] list_indices = ['indices_ch', 'indices_ep', 'indices_np'] %> - -----r - library(talweg) ts_data = read.csv(system.file("extdata","pm10_mesures_H_loc_report.csv",package="talweg")) @@ -34,19 +31,14 @@ data = getData(ts_data, exo_data, input_tz = "Europe/Paris", working_tz="Europe/ indices_ch = seq(as.Date("2015-01-18"),as.Date("2015-01-24"),"days") indices_ep = seq(as.Date("2015-03-15"),as.Date("2015-03-21"),"days") indices_np = seq(as.Date("2015-04-26"),as.Date("2015-05-02"),"days") - -% for loop in range(3): - +% for i in range(3): ----- - -

${list_titles[loop]}

- +

${list_titles[i]}

-----r -p_nn_exo = computeForecast(data, ${list_indices[loop]}, "Neighbors", "Neighbors", simtype="exo", horizon=H) -p_nn_mix = computeForecast(data, ${list_indices[loop]}, "Neighbors", "Neighbors", simtype="mix", horizon=H) -p_az = computeForecast(data, ${list_indices[loop]}, "Average", "Zero", horizon=H) #, memory=183) -p_pz = computeForecast(data, ${list_indices[loop]}, "Persistence", "Zero", horizon=H, same_day=TRUE) - +p_nn_exo = computeForecast(data, ${list_indices[i]}, "Neighbors", "Neighbors", simtype="exo", horizon=H) +p_nn_mix = computeForecast(data, ${list_indices[i]}, "Neighbors", "Neighbors", simtype="mix", horizon=H) +p_az = computeForecast(data, ${list_indices[i]}, "Average", "Zero", horizon=H) #, memory=183) +p_pz = computeForecast(data, ${list_indices[i]}, "Persistence", "Zero", horizon=H, same_day=TRUE) -----r e_nn_exo = computeError(data, p_nn_exo) e_nn_mix = computeError(data, p_nn_mix) @@ -55,11 +47,10 @@ e_pz = computeError(data, p_pz) options(repr.plot.width=9, repr.plot.height=7) plotError(list(e_nn_mix, e_pz, e_az, e_nn_exo), cols=c(1,2,colors()[258], 4)) -#Noir: neighbors_mix, bleu: neighbors_exo, vert: moyenne, rouge: persistence +# Noir: neighbors_mix, bleu: neighbors_exo, vert: moyenne, rouge: persistence i_np = which.min(e_nn_exo$abs$indices) i_p = which.max(e_nn_exo$abs$indices) - -----r options(repr.plot.width=9, repr.plot.height=4) par(mfrow=c(1,2)) @@ -73,8 +64,7 @@ plotPredReal(data, p_nn_mix, i_p); title(paste("PredReal nn mix day",i_p)) plotPredReal(data, p_az, i_np); title(paste("PredReal az day",i_np)) plotPredReal(data, p_az, i_p); title(paste("PredReal az day",i_p)) -#Bleu: prévue, noir: réalisée - +# Bleu: prévue, noir: réalisée -----r par(mfrow=c(1,2)) f_np_exo = computeFilaments(data, p_nn_exo, i_np, plot=TRUE); title(paste("Filaments nn exo day",i_np)) @@ -82,7 +72,6 @@ f_p_exo = computeFilaments(data, p_nn_exo, i_p, plot=TRUE); title(paste("Filamen f_np_mix = computeFilaments(data, p_nn_mix, i_np, plot=TRUE); title(paste("Filaments nn mix day",i_np)) f_p_mix = computeFilaments(data, p_nn_mix, i_p, plot=TRUE); title(paste("Filaments nn mix day",i_p)) - -----r par(mfrow=c(1,2)) plotFilamentsBox(data, f_np_exo); title(paste("FilBox nn exo day",i_np)) @@ -90,7 +79,6 @@ plotFilamentsBox(data, f_p_exo); title(paste("FilBox nn exo day",i_p)) plotFilamentsBox(data, f_np_mix); title(paste("FilBox nn mix day",i_np)) plotFilamentsBox(data, f_p_mix); title(paste("FilBox nn mix day",i_p)) - -----r par(mfrow=c(1,2)) plotRelVar(data, f_np_exo); title(paste("StdDev nn exo day",i_np)) @@ -99,8 +87,7 @@ plotRelVar(data, f_p_exo); title(paste("StdDev nn exo day",i_p)) plotRelVar(data, f_np_mix); title(paste("StdDev nn mix day",i_np)) plotRelVar(data, f_p_mix); title(paste("StdDev nn mix day",i_p)) -#Variabilité globale en rouge ; sur les 60 voisins (+ lendemains) en noir - +# Variabilité globale en rouge ; sur les 60 voisins (+ lendemains) en noir -----r par(mfrow=c(1,2)) plotSimils(p_nn_exo, i_np); title(paste("Weights nn exo day",i_np)) @@ -109,20 +96,17 @@ plotSimils(p_nn_exo, i_p); title(paste("Weights nn exo day",i_p)) plotSimils(p_nn_mix, i_np); title(paste("Weights nn mix day",i_np)) plotSimils(p_nn_mix, i_p); title(paste("Weights nn mix day",i_p) -#- pollué à gauche, + pollué à droite - +# - pollué à gauche, + pollué à droite -----r -#Fenêtres sélectionnées dans ]0,10] / endo à gauche, exo à droite +# Fenêtres sélectionnées dans ]0,10] / endo à gauche, exo à droite p_nn_exo$getParams(i_np)$window p_nn_exo$getParams(i_p)$window p_nn_mix$getParams(i_np)$window p_nn_mix$getParams(i_p)$window - % endfor - ----- -## Bilan +

Bilan

Problème difficile : on ne fait guère mieux qu'une naïve moyenne des lendemains des jours similaires dans le passé, ce qui n'est pas loin de prédire une série constante égale à la diff --git a/reports/report.ipynb b/reports/report.ipynb new file mode 100644 index 0000000..05f51de --- /dev/null +++ b/reports/report.ipynb @@ -0,0 +1,535 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\n", + "\n", + "

Introduction

\n", + "\n", + "J'ai fait quelques essais dans différentes configurations pour la méthode \"Neighbors\"\n", + "(la seule dont on a parlé).
Il semble que le mieux soit\n", + "\n", + " * simtype=\"exo\" ou \"mix\" : similarités exogènes avec/sans endogènes (fenêtre optimisée par VC)\n", + " * same_season=FALSE : les indices pour la validation croisée ne tiennent pas compte des saisons\n", + " * mix_strategy=\"mult\" : on multiplie les poids (au lieu d'en éteindre)\n", + "\n", + "J'ai systématiquement comparé à une approche naïve : la moyennes des lendemains des jours\n", + "\"similaires\" dans tout le passé ; à chaque fois sans prédiction du saut (sauf pour Neighbors :\n", + "prédiction basée sur les poids calculés).\n", + "\n", + "Ensuite j'affiche les erreurs, quelques courbes prévues/mesurées, quelques filaments puis les\n", + "histogrammes de quelques poids. Concernant les graphes de filaments, la moitié gauche du graphe\n", + "correspond aux jours similaires au jour courant, tandis que la moitié droite affiche les\n", + "lendemains : ce sont donc les voisinages tels qu'utilisés dans l'algorithme.\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "library(talweg)\n", + "\n", + "ts_data = read.csv(system.file(\"extdata\",\"pm10_mesures_H_loc_report.csv\",package=\"talweg\"))\n", + "exo_data = read.csv(system.file(\"extdata\",\"meteo_extra_noNAs.csv\",package=\"talweg\"))\n", + "data = getData(ts_data, exo_data, input_tz = \"Europe/Paris\", working_tz=\"Europe/Paris\", predict_at=13)\n", + "\n", + "indices_ch = seq(as.Date(\"2015-01-18\"),as.Date(\"2015-01-24\"),\"days\")\n", + "indices_ep = seq(as.Date(\"2015-03-15\"),as.Date(\"2015-03-21\"),\"days\")\n", + "indices_np = seq(as.Date(\"2015-04-26\"),as.Date(\"2015-05-02\"),\"days\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\n", + "\n", + "

Pollution par chauffage

" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "p_nn_exo = computeForecast(data, indices_ch, \"Neighbors\", \"Neighbors\", simtype=\"exo\", horizon=H)\n", + "p_nn_mix = computeForecast(data, indices_ch, \"Neighbors\", \"Neighbors\", simtype=\"mix\", horizon=H)\n", + "p_az = computeForecast(data, indices_ch, \"Average\", \"Zero\", horizon=H) #, memory=183)\n", + "p_pz = computeForecast(data, indices_ch, \"Persistence\", \"Zero\", horizon=H, same_day=TRUE)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "e_nn_exo = computeError(data, p_nn_exo)\n", + "e_nn_mix = computeError(data, p_nn_mix)\n", + "e_az = computeError(data, p_az)\n", + "e_pz = computeError(data, p_pz)\n", + "options(repr.plot.width=9, repr.plot.height=7)\n", + "plotError(list(e_nn_mix, e_pz, e_az, e_nn_exo), cols=c(1,2,colors()[258], 4))\n", + "\n", + "# Noir: neighbors_mix, bleu: neighbors_exo, vert: moyenne, rouge: persistence\n", + "\n", + "i_np = which.min(e_nn_exo$abs$indices)\n", + "i_p = which.max(e_nn_exo$abs$indices)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "options(repr.plot.width=9, repr.plot.height=4)\n", + "par(mfrow=c(1,2))\n", + "\n", + "plotPredReal(data, p_nn_exo, i_np); title(paste(\"PredReal nn exo day\",i_np))\n", + "plotPredReal(data, p_nn_exo, i_p); title(paste(\"PredReal nn exo day\",i_p))\n", + "\n", + "plotPredReal(data, p_nn_mix, i_np); title(paste(\"PredReal nn mix day\",i_np))\n", + "plotPredReal(data, p_nn_mix, i_p); title(paste(\"PredReal nn mix day\",i_p))\n", + "\n", + "plotPredReal(data, p_az, i_np); title(paste(\"PredReal az day\",i_np))\n", + "plotPredReal(data, p_az, i_p); title(paste(\"PredReal az day\",i_p))\n", + "\n", + "# Bleu: prévue, noir: réalisée" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "par(mfrow=c(1,2))\n", + "f_np_exo = computeFilaments(data, p_nn_exo, i_np, plot=TRUE); title(paste(\"Filaments nn exo day\",i_np))\n", + "f_p_exo = computeFilaments(data, p_nn_exo, i_p, plot=TRUE); title(paste(\"Filaments nn exo day\",i_p))\n", + "\n", + "f_np_mix = computeFilaments(data, p_nn_mix, i_np, plot=TRUE); title(paste(\"Filaments nn mix day\",i_np))\n", + "f_p_mix = computeFilaments(data, p_nn_mix, i_p, plot=TRUE); title(paste(\"Filaments nn mix day\",i_p))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "par(mfrow=c(1,2))\n", + "plotFilamentsBox(data, f_np_exo); title(paste(\"FilBox nn exo day\",i_np))\n", + "plotFilamentsBox(data, f_p_exo); title(paste(\"FilBox nn exo day\",i_p))\n", + "\n", + "plotFilamentsBox(data, f_np_mix); title(paste(\"FilBox nn mix day\",i_np))\n", + "plotFilamentsBox(data, f_p_mix); title(paste(\"FilBox nn mix day\",i_p))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "par(mfrow=c(1,2))\n", + "plotRelVar(data, f_np_exo); title(paste(\"StdDev nn exo day\",i_np))\n", + "plotRelVar(data, f_p_exo); title(paste(\"StdDev nn exo day\",i_p))\n", + "\n", + "plotRelVar(data, f_np_mix); title(paste(\"StdDev nn mix day\",i_np))\n", + "plotRelVar(data, f_p_mix); title(paste(\"StdDev nn mix day\",i_p))\n", + "\n", + "# Variabilité globale en rouge ; sur les 60 voisins (+ lendemains) en noir" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "par(mfrow=c(1,2))\n", + "plotSimils(p_nn_exo, i_np); title(paste(\"Weights nn exo day\",i_np))\n", + "plotSimils(p_nn_exo, i_p); title(paste(\"Weights nn exo day\",i_p))\n", + "\n", + "plotSimils(p_nn_mix, i_np); title(paste(\"Weights nn mix day\",i_np))\n", + "plotSimils(p_nn_mix, i_p); title(paste(\"Weights nn mix day\",i_p)\n", + "\n", + "# - pollué à gauche, + pollué à droite" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "# Fenêtres sélectionnées dans ]0,10] / endo à gauche, exo à droite\n", + "p_nn_exo$getParams(i_np)$window\n", + "p_nn_exo$getParams(i_p)$window\n", + "\n", + "p_nn_mix$getParams(i_np)$window\n", + "p_nn_mix$getParams(i_p)$window" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\n", + "\n", + "

Pollution par épandage

" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "p_nn_exo = computeForecast(data, indices_ep, \"Neighbors\", \"Neighbors\", simtype=\"exo\", horizon=H)\n", + "p_nn_mix = computeForecast(data, indices_ep, \"Neighbors\", \"Neighbors\", simtype=\"mix\", horizon=H)\n", + "p_az = computeForecast(data, indices_ep, \"Average\", \"Zero\", horizon=H) #, memory=183)\n", + "p_pz = computeForecast(data, indices_ep, \"Persistence\", \"Zero\", horizon=H, same_day=TRUE)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "e_nn_exo = computeError(data, p_nn_exo)\n", + "e_nn_mix = computeError(data, p_nn_mix)\n", + "e_az = computeError(data, p_az)\n", + "e_pz = computeError(data, p_pz)\n", + "options(repr.plot.width=9, repr.plot.height=7)\n", + "plotError(list(e_nn_mix, e_pz, e_az, e_nn_exo), cols=c(1,2,colors()[258], 4))\n", + "\n", + "# Noir: neighbors_mix, bleu: neighbors_exo, vert: moyenne, rouge: persistence\n", + "\n", + "i_np = which.min(e_nn_exo$abs$indices)\n", + "i_p = which.max(e_nn_exo$abs$indices)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "options(repr.plot.width=9, repr.plot.height=4)\n", + "par(mfrow=c(1,2))\n", + "\n", + "plotPredReal(data, p_nn_exo, i_np); title(paste(\"PredReal nn exo day\",i_np))\n", + "plotPredReal(data, p_nn_exo, i_p); title(paste(\"PredReal nn exo day\",i_p))\n", + "\n", + "plotPredReal(data, p_nn_mix, i_np); title(paste(\"PredReal nn mix day\",i_np))\n", + "plotPredReal(data, p_nn_mix, i_p); title(paste(\"PredReal nn mix day\",i_p))\n", + "\n", + "plotPredReal(data, p_az, i_np); title(paste(\"PredReal az day\",i_np))\n", + "plotPredReal(data, p_az, i_p); title(paste(\"PredReal az day\",i_p))\n", + "\n", + "# Bleu: prévue, noir: réalisée" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "par(mfrow=c(1,2))\n", + "f_np_exo = computeFilaments(data, p_nn_exo, i_np, plot=TRUE); title(paste(\"Filaments nn exo day\",i_np))\n", + "f_p_exo = computeFilaments(data, p_nn_exo, i_p, plot=TRUE); title(paste(\"Filaments nn exo day\",i_p))\n", + "\n", + "f_np_mix = computeFilaments(data, p_nn_mix, i_np, plot=TRUE); title(paste(\"Filaments nn mix day\",i_np))\n", + "f_p_mix = computeFilaments(data, p_nn_mix, i_p, plot=TRUE); title(paste(\"Filaments nn mix day\",i_p))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "par(mfrow=c(1,2))\n", + "plotFilamentsBox(data, f_np_exo); title(paste(\"FilBox nn exo day\",i_np))\n", + "plotFilamentsBox(data, f_p_exo); title(paste(\"FilBox nn exo day\",i_p))\n", + "\n", + "plotFilamentsBox(data, f_np_mix); title(paste(\"FilBox nn mix day\",i_np))\n", + "plotFilamentsBox(data, f_p_mix); title(paste(\"FilBox nn mix day\",i_p))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "par(mfrow=c(1,2))\n", + "plotRelVar(data, f_np_exo); title(paste(\"StdDev nn exo day\",i_np))\n", + "plotRelVar(data, f_p_exo); title(paste(\"StdDev nn exo day\",i_p))\n", + "\n", + "plotRelVar(data, f_np_mix); title(paste(\"StdDev nn mix day\",i_np))\n", + "plotRelVar(data, f_p_mix); title(paste(\"StdDev nn mix day\",i_p))\n", + "\n", + "# Variabilité globale en rouge ; sur les 60 voisins (+ lendemains) en noir" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "par(mfrow=c(1,2))\n", + "plotSimils(p_nn_exo, i_np); title(paste(\"Weights nn exo day\",i_np))\n", + "plotSimils(p_nn_exo, i_p); title(paste(\"Weights nn exo day\",i_p))\n", + "\n", + "plotSimils(p_nn_mix, i_np); title(paste(\"Weights nn mix day\",i_np))\n", + "plotSimils(p_nn_mix, i_p); title(paste(\"Weights nn mix day\",i_p)\n", + "\n", + "# - pollué à gauche, + pollué à droite" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "# Fenêtres sélectionnées dans ]0,10] / endo à gauche, exo à droite\n", + "p_nn_exo$getParams(i_np)$window\n", + "p_nn_exo$getParams(i_p)$window\n", + "\n", + "p_nn_mix$getParams(i_np)$window\n", + "p_nn_mix$getParams(i_p)$window" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\n", + "\n", + "

Semaine non polluée

" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "p_nn_exo = computeForecast(data, indices_np, \"Neighbors\", \"Neighbors\", simtype=\"exo\", horizon=H)\n", + "p_nn_mix = computeForecast(data, indices_np, \"Neighbors\", \"Neighbors\", simtype=\"mix\", horizon=H)\n", + "p_az = computeForecast(data, indices_np, \"Average\", \"Zero\", horizon=H) #, memory=183)\n", + "p_pz = computeForecast(data, indices_np, \"Persistence\", \"Zero\", horizon=H, same_day=TRUE)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "e_nn_exo = computeError(data, p_nn_exo)\n", + "e_nn_mix = computeError(data, p_nn_mix)\n", + "e_az = computeError(data, p_az)\n", + "e_pz = computeError(data, p_pz)\n", + "options(repr.plot.width=9, repr.plot.height=7)\n", + "plotError(list(e_nn_mix, e_pz, e_az, e_nn_exo), cols=c(1,2,colors()[258], 4))\n", + "\n", + "# Noir: neighbors_mix, bleu: neighbors_exo, vert: moyenne, rouge: persistence\n", + "\n", + "i_np = which.min(e_nn_exo$abs$indices)\n", + "i_p = which.max(e_nn_exo$abs$indices)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "options(repr.plot.width=9, repr.plot.height=4)\n", + "par(mfrow=c(1,2))\n", + "\n", + "plotPredReal(data, p_nn_exo, i_np); title(paste(\"PredReal nn exo day\",i_np))\n", + "plotPredReal(data, p_nn_exo, i_p); title(paste(\"PredReal nn exo day\",i_p))\n", + "\n", + "plotPredReal(data, p_nn_mix, i_np); title(paste(\"PredReal nn mix day\",i_np))\n", + "plotPredReal(data, p_nn_mix, i_p); title(paste(\"PredReal nn mix day\",i_p))\n", + "\n", + "plotPredReal(data, p_az, i_np); title(paste(\"PredReal az day\",i_np))\n", + "plotPredReal(data, p_az, i_p); title(paste(\"PredReal az day\",i_p))\n", + "\n", + "# Bleu: prévue, noir: réalisée" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "par(mfrow=c(1,2))\n", + "f_np_exo = computeFilaments(data, p_nn_exo, i_np, plot=TRUE); title(paste(\"Filaments nn exo day\",i_np))\n", + "f_p_exo = computeFilaments(data, p_nn_exo, i_p, plot=TRUE); title(paste(\"Filaments nn exo day\",i_p))\n", + "\n", + "f_np_mix = computeFilaments(data, p_nn_mix, i_np, plot=TRUE); title(paste(\"Filaments nn mix day\",i_np))\n", + "f_p_mix = computeFilaments(data, p_nn_mix, i_p, plot=TRUE); title(paste(\"Filaments nn mix day\",i_p))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "par(mfrow=c(1,2))\n", + "plotFilamentsBox(data, f_np_exo); title(paste(\"FilBox nn exo day\",i_np))\n", + "plotFilamentsBox(data, f_p_exo); title(paste(\"FilBox nn exo day\",i_p))\n", + "\n", + "plotFilamentsBox(data, f_np_mix); title(paste(\"FilBox nn mix day\",i_np))\n", + "plotFilamentsBox(data, f_p_mix); title(paste(\"FilBox nn mix day\",i_p))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "par(mfrow=c(1,2))\n", + "plotRelVar(data, f_np_exo); title(paste(\"StdDev nn exo day\",i_np))\n", + "plotRelVar(data, f_p_exo); title(paste(\"StdDev nn exo day\",i_p))\n", + "\n", + "plotRelVar(data, f_np_mix); title(paste(\"StdDev nn mix day\",i_np))\n", + "plotRelVar(data, f_p_mix); title(paste(\"StdDev nn mix day\",i_p))\n", + "\n", + "# Variabilité globale en rouge ; sur les 60 voisins (+ lendemains) en noir" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "par(mfrow=c(1,2))\n", + "plotSimils(p_nn_exo, i_np); title(paste(\"Weights nn exo day\",i_np))\n", + "plotSimils(p_nn_exo, i_p); title(paste(\"Weights nn exo day\",i_p))\n", + "\n", + "plotSimils(p_nn_mix, i_np); title(paste(\"Weights nn mix day\",i_np))\n", + "plotSimils(p_nn_mix, i_p); title(paste(\"Weights nn mix day\",i_p)\n", + "\n", + "# - pollué à gauche, + pollué à droite" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "# Fenêtres sélectionnées dans ]0,10] / endo à gauche, exo à droite\n", + "p_nn_exo$getParams(i_np)$window\n", + "p_nn_exo$getParams(i_p)$window\n", + "\n", + "p_nn_mix$getParams(i_np)$window\n", + "p_nn_mix$getParams(i_p)$window" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\n", + "\n", + "

Bilan

\n", + "\n", + "Problème difficile : on ne fait guère mieux qu'une naïve moyenne des lendemains des jours\n", + "similaires dans le passé, ce qui n'est pas loin de prédire une série constante égale à la\n", + "dernière valeur observée (méthode \"zéro\"). La persistence donne parfois de bons résultats\n", + "mais est trop instable (sensibilité à l'argument same_day).\n", + "\n", + "Comment améliorer la méthode ?" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "R", + "language": "R", + "name": "ir" + }, + "language_info": { + "codemirror_mode": "r", + "file_extension": ".r", + "mimetype": "text/x-r-source", + "name": "R", + "pygments_lexer": "r", + "version": "3.3.3" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/reports/tmp.log b/reports/tmp.log new file mode 100644 index 0000000..39629a7 --- /dev/null +++ b/reports/tmp.log @@ -0,0 +1,768 @@ +******* text after include: +----- +

Introduction

+ +J'ai fait quelques essais dans différentes configurations pour la méthode "Neighbors" +(la seule dont on a parlé).
Il semble que le mieux soit + + * simtype="exo" ou "mix" : similarités exogènes avec/sans endogènes (fenêtre optimisée par VC) + * same_season=FALSE : les indices pour la validation croisée ne tiennent pas compte des saisons + * mix_strategy="mult" : on multiplie les poids (au lieu d'en éteindre) + +J'ai systématiquement comparé à une approche naïve : la moyennes des lendemains des jours +"similaires" dans tout le passé ; à chaque fois sans prédiction du saut (sauf pour Neighbors : +prédiction basée sur les poids calculés). + +Ensuite j'affiche les erreurs, quelques courbes prévues/mesurées, quelques filaments puis les +histogrammes de quelques poids. Concernant les graphes de filaments, la moitié gauche du graphe +correspond aux jours similaires au jour courant, tandis que la moitié droite affiche les +lendemains : ce sont donc les voisinages tels qu'utilisés dans l'algorithme. + +<% +list_titles = ['Pollution par chauffage', 'Pollution par épandage', 'Semaine non polluée'] +list_indices = ['indices_ch', 'indices_ep', 'indices_np'] +%> +-----r +library(talweg) + +ts_data = read.csv(system.file("extdata","pm10_mesures_H_loc_report.csv",package="talweg")) +exo_data = read.csv(system.file("extdata","meteo_extra_noNAs.csv",package="talweg")) +data = getData(ts_data, exo_data, input_tz = "Europe/Paris", working_tz="Europe/Paris", predict_at=13) + +indices_ch = seq(as.Date("2015-01-18"),as.Date("2015-01-24"),"days") +indices_ep = seq(as.Date("2015-03-15"),as.Date("2015-03-21"),"days") +indices_np = seq(as.Date("2015-04-26"),as.Date("2015-05-02"),"days") +% for i in range(3): +----- +

${list_titles[i]}

+-----r +p_nn_exo = computeForecast(data, ${list_indices[i]}, "Neighbors", "Neighbors", simtype="exo", horizon=H) +p_nn_mix = computeForecast(data, ${list_indices[i]}, "Neighbors", "Neighbors", simtype="mix", horizon=H) +p_az = computeForecast(data, ${list_indices[i]}, "Average", "Zero", horizon=H) #, memory=183) +p_pz = computeForecast(data, ${list_indices[i]}, "Persistence", "Zero", horizon=H, same_day=TRUE) +-----r +e_nn_exo = computeError(data, p_nn_exo) +e_nn_mix = computeError(data, p_nn_mix) +e_az = computeError(data, p_az) +e_pz = computeError(data, p_pz) +options(repr.plot.width=9, repr.plot.height=7) +plotError(list(e_nn_mix, e_pz, e_az, e_nn_exo), cols=c(1,2,colors()[258], 4)) + +# Noir: neighbors_mix, bleu: neighbors_exo, vert: moyenne, rouge: persistence + +i_np = which.min(e_nn_exo$abs$indices) +i_p = which.max(e_nn_exo$abs$indices) +-----r +options(repr.plot.width=9, repr.plot.height=4) +par(mfrow=c(1,2)) + +plotPredReal(data, p_nn_exo, i_np); title(paste("PredReal nn exo day",i_np)) +plotPredReal(data, p_nn_exo, i_p); title(paste("PredReal nn exo day",i_p)) + +plotPredReal(data, p_nn_mix, i_np); title(paste("PredReal nn mix day",i_np)) +plotPredReal(data, p_nn_mix, i_p); title(paste("PredReal nn mix day",i_p)) + +plotPredReal(data, p_az, i_np); title(paste("PredReal az day",i_np)) +plotPredReal(data, p_az, i_p); title(paste("PredReal az day",i_p)) + +# Bleu: prévue, noir: réalisée +-----r +par(mfrow=c(1,2)) +f_np_exo = computeFilaments(data, p_nn_exo, i_np, plot=TRUE); title(paste("Filaments nn exo day",i_np)) +f_p_exo = computeFilaments(data, p_nn_exo, i_p, plot=TRUE); title(paste("Filaments nn exo day",i_p)) + +f_np_mix = computeFilaments(data, p_nn_mix, i_np, plot=TRUE); title(paste("Filaments nn mix day",i_np)) +f_p_mix = computeFilaments(data, p_nn_mix, i_p, plot=TRUE); title(paste("Filaments nn mix day",i_p)) +-----r +par(mfrow=c(1,2)) +plotFilamentsBox(data, f_np_exo); title(paste("FilBox nn exo day",i_np)) +plotFilamentsBox(data, f_p_exo); title(paste("FilBox nn exo day",i_p)) + +plotFilamentsBox(data, f_np_mix); title(paste("FilBox nn mix day",i_np)) +plotFilamentsBox(data, f_p_mix); title(paste("FilBox nn mix day",i_p)) +-----r +par(mfrow=c(1,2)) +plotRelVar(data, f_np_exo); title(paste("StdDev nn exo day",i_np)) +plotRelVar(data, f_p_exo); title(paste("StdDev nn exo day",i_p)) + +plotRelVar(data, f_np_mix); title(paste("StdDev nn mix day",i_np)) +plotRelVar(data, f_p_mix); title(paste("StdDev nn mix day",i_p)) + +# Variabilité globale en rouge ; sur les 60 voisins (+ lendemains) en noir +-----r +par(mfrow=c(1,2)) +plotSimils(p_nn_exo, i_np); title(paste("Weights nn exo day",i_np)) +plotSimils(p_nn_exo, i_p); title(paste("Weights nn exo day",i_p)) + +plotSimils(p_nn_mix, i_np); title(paste("Weights nn mix day",i_np)) +plotSimils(p_nn_mix, i_p); title(paste("Weights nn mix day",i_p) + +# - pollué à gauche, + pollué à droite +-----r +# Fenêtres sélectionnées dans ]0,10] / endo à gauche, exo à droite +p_nn_exo$getParams(i_np)$window +p_nn_exo$getParams(i_p)$window + +p_nn_mix$getParams(i_np)$window +p_nn_mix$getParams(i_p)$window +% endfor +----- +

Bilan

+ +Problème difficile : on ne fait guère mieux qu'une naïve moyenne des lendemains des jours +similaires dans le passé, ce qui n'est pas loin 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). + +Comment améliorer la méthode ? +******* mako_kwargs: {} +******* text after mako: +----- +

Introduction

+ +J'ai fait quelques essais dans différentes configurations pour la méthode "Neighbors" +(la seule dont on a parlé).
Il semble que le mieux soit + + * simtype="exo" ou "mix" : similarités exogènes avec/sans endogènes (fenêtre optimisée par VC) + * same_season=FALSE : les indices pour la validation croisée ne tiennent pas compte des saisons + * mix_strategy="mult" : on multiplie les poids (au lieu d'en éteindre) + +J'ai systématiquement comparé à une approche naïve : la moyennes des lendemains des jours +"similaires" dans tout le passé ; à chaque fois sans prédiction du saut (sauf pour Neighbors : +prédiction basée sur les poids calculés). + +Ensuite j'affiche les erreurs, quelques courbes prévues/mesurées, quelques filaments puis les +histogrammes de quelques poids. Concernant les graphes de filaments, la moitié gauche du graphe +correspond aux jours similaires au jour courant, tandis que la moitié droite affiche les +lendemains : ce sont donc les voisinages tels qu'utilisés dans l'algorithme. + + +-----r +library(talweg) + +ts_data = read.csv(system.file("extdata","pm10_mesures_H_loc_report.csv",package="talweg")) +exo_data = read.csv(system.file("extdata","meteo_extra_noNAs.csv",package="talweg")) +data = getData(ts_data, exo_data, input_tz = "Europe/Paris", working_tz="Europe/Paris", predict_at=13) + +indices_ch = seq(as.Date("2015-01-18"),as.Date("2015-01-24"),"days") +indices_ep = seq(as.Date("2015-03-15"),as.Date("2015-03-21"),"days") +indices_np = seq(as.Date("2015-04-26"),as.Date("2015-05-02"),"days") +----- +

Pollution par chauffage

+-----r +p_nn_exo = computeForecast(data, indices_ch, "Neighbors", "Neighbors", simtype="exo", horizon=H) +p_nn_mix = computeForecast(data, indices_ch, "Neighbors", "Neighbors", simtype="mix", horizon=H) +p_az = computeForecast(data, indices_ch, "Average", "Zero", horizon=H) #, memory=183) +p_pz = computeForecast(data, indices_ch, "Persistence", "Zero", horizon=H, same_day=TRUE) +-----r +e_nn_exo = computeError(data, p_nn_exo) +e_nn_mix = computeError(data, p_nn_mix) +e_az = computeError(data, p_az) +e_pz = computeError(data, p_pz) +options(repr.plot.width=9, repr.plot.height=7) +plotError(list(e_nn_mix, e_pz, e_az, e_nn_exo), cols=c(1,2,colors()[258], 4)) + +# Noir: neighbors_mix, bleu: neighbors_exo, vert: moyenne, rouge: persistence + +i_np = which.min(e_nn_exo$abs$indices) +i_p = which.max(e_nn_exo$abs$indices) +-----r +options(repr.plot.width=9, repr.plot.height=4) +par(mfrow=c(1,2)) + +plotPredReal(data, p_nn_exo, i_np); title(paste("PredReal nn exo day",i_np)) +plotPredReal(data, p_nn_exo, i_p); title(paste("PredReal nn exo day",i_p)) + +plotPredReal(data, p_nn_mix, i_np); title(paste("PredReal nn mix day",i_np)) +plotPredReal(data, p_nn_mix, i_p); title(paste("PredReal nn mix day",i_p)) + +plotPredReal(data, p_az, i_np); title(paste("PredReal az day",i_np)) +plotPredReal(data, p_az, i_p); title(paste("PredReal az day",i_p)) + +# Bleu: prévue, noir: réalisée +-----r +par(mfrow=c(1,2)) +f_np_exo = computeFilaments(data, p_nn_exo, i_np, plot=TRUE); title(paste("Filaments nn exo day",i_np)) +f_p_exo = computeFilaments(data, p_nn_exo, i_p, plot=TRUE); title(paste("Filaments nn exo day",i_p)) + +f_np_mix = computeFilaments(data, p_nn_mix, i_np, plot=TRUE); title(paste("Filaments nn mix day",i_np)) +f_p_mix = computeFilaments(data, p_nn_mix, i_p, plot=TRUE); title(paste("Filaments nn mix day",i_p)) +-----r +par(mfrow=c(1,2)) +plotFilamentsBox(data, f_np_exo); title(paste("FilBox nn exo day",i_np)) +plotFilamentsBox(data, f_p_exo); title(paste("FilBox nn exo day",i_p)) + +plotFilamentsBox(data, f_np_mix); title(paste("FilBox nn mix day",i_np)) +plotFilamentsBox(data, f_p_mix); title(paste("FilBox nn mix day",i_p)) +-----r +par(mfrow=c(1,2)) +plotRelVar(data, f_np_exo); title(paste("StdDev nn exo day",i_np)) +plotRelVar(data, f_p_exo); title(paste("StdDev nn exo day",i_p)) + +plotRelVar(data, f_np_mix); title(paste("StdDev nn mix day",i_np)) +plotRelVar(data, f_p_mix); title(paste("StdDev nn mix day",i_p)) + +# Variabilité globale en rouge ; sur les 60 voisins (+ lendemains) en noir +-----r +par(mfrow=c(1,2)) +plotSimils(p_nn_exo, i_np); title(paste("Weights nn exo day",i_np)) +plotSimils(p_nn_exo, i_p); title(paste("Weights nn exo day",i_p)) + +plotSimils(p_nn_mix, i_np); title(paste("Weights nn mix day",i_np)) +plotSimils(p_nn_mix, i_p); title(paste("Weights nn mix day",i_p) + +# - pollué à gauche, + pollué à droite +-----r +# Fenêtres sélectionnées dans ]0,10] / endo à gauche, exo à droite +p_nn_exo$getParams(i_np)$window +p_nn_exo$getParams(i_p)$window + +p_nn_mix$getParams(i_np)$window +p_nn_mix$getParams(i_p)$window +----- +

Pollution par épandage

+-----r +p_nn_exo = computeForecast(data, indices_ep, "Neighbors", "Neighbors", simtype="exo", horizon=H) +p_nn_mix = computeForecast(data, indices_ep, "Neighbors", "Neighbors", simtype="mix", horizon=H) +p_az = computeForecast(data, indices_ep, "Average", "Zero", horizon=H) #, memory=183) +p_pz = computeForecast(data, indices_ep, "Persistence", "Zero", horizon=H, same_day=TRUE) +-----r +e_nn_exo = computeError(data, p_nn_exo) +e_nn_mix = computeError(data, p_nn_mix) +e_az = computeError(data, p_az) +e_pz = computeError(data, p_pz) +options(repr.plot.width=9, repr.plot.height=7) +plotError(list(e_nn_mix, e_pz, e_az, e_nn_exo), cols=c(1,2,colors()[258], 4)) + +# Noir: neighbors_mix, bleu: neighbors_exo, vert: moyenne, rouge: persistence + +i_np = which.min(e_nn_exo$abs$indices) +i_p = which.max(e_nn_exo$abs$indices) +-----r +options(repr.plot.width=9, repr.plot.height=4) +par(mfrow=c(1,2)) + +plotPredReal(data, p_nn_exo, i_np); title(paste("PredReal nn exo day",i_np)) +plotPredReal(data, p_nn_exo, i_p); title(paste("PredReal nn exo day",i_p)) + +plotPredReal(data, p_nn_mix, i_np); title(paste("PredReal nn mix day",i_np)) +plotPredReal(data, p_nn_mix, i_p); title(paste("PredReal nn mix day",i_p)) + +plotPredReal(data, p_az, i_np); title(paste("PredReal az day",i_np)) +plotPredReal(data, p_az, i_p); title(paste("PredReal az day",i_p)) + +# Bleu: prévue, noir: réalisée +-----r +par(mfrow=c(1,2)) +f_np_exo = computeFilaments(data, p_nn_exo, i_np, plot=TRUE); title(paste("Filaments nn exo day",i_np)) +f_p_exo = computeFilaments(data, p_nn_exo, i_p, plot=TRUE); title(paste("Filaments nn exo day",i_p)) + +f_np_mix = computeFilaments(data, p_nn_mix, i_np, plot=TRUE); title(paste("Filaments nn mix day",i_np)) +f_p_mix = computeFilaments(data, p_nn_mix, i_p, plot=TRUE); title(paste("Filaments nn mix day",i_p)) +-----r +par(mfrow=c(1,2)) +plotFilamentsBox(data, f_np_exo); title(paste("FilBox nn exo day",i_np)) +plotFilamentsBox(data, f_p_exo); title(paste("FilBox nn exo day",i_p)) + +plotFilamentsBox(data, f_np_mix); title(paste("FilBox nn mix day",i_np)) +plotFilamentsBox(data, f_p_mix); title(paste("FilBox nn mix day",i_p)) +-----r +par(mfrow=c(1,2)) +plotRelVar(data, f_np_exo); title(paste("StdDev nn exo day",i_np)) +plotRelVar(data, f_p_exo); title(paste("StdDev nn exo day",i_p)) + +plotRelVar(data, f_np_mix); title(paste("StdDev nn mix day",i_np)) +plotRelVar(data, f_p_mix); title(paste("StdDev nn mix day",i_p)) + +# Variabilité globale en rouge ; sur les 60 voisins (+ lendemains) en noir +-----r +par(mfrow=c(1,2)) +plotSimils(p_nn_exo, i_np); title(paste("Weights nn exo day",i_np)) +plotSimils(p_nn_exo, i_p); title(paste("Weights nn exo day",i_p)) + +plotSimils(p_nn_mix, i_np); title(paste("Weights nn mix day",i_np)) +plotSimils(p_nn_mix, i_p); title(paste("Weights nn mix day",i_p) + +# - pollué à gauche, + pollué à droite +-----r +# Fenêtres sélectionnées dans ]0,10] / endo à gauche, exo à droite +p_nn_exo$getParams(i_np)$window +p_nn_exo$getParams(i_p)$window + +p_nn_mix$getParams(i_np)$window +p_nn_mix$getParams(i_p)$window +----- +

Semaine non polluée

+-----r +p_nn_exo = computeForecast(data, indices_np, "Neighbors", "Neighbors", simtype="exo", horizon=H) +p_nn_mix = computeForecast(data, indices_np, "Neighbors", "Neighbors", simtype="mix", horizon=H) +p_az = computeForecast(data, indices_np, "Average", "Zero", horizon=H) #, memory=183) +p_pz = computeForecast(data, indices_np, "Persistence", "Zero", horizon=H, same_day=TRUE) +-----r +e_nn_exo = computeError(data, p_nn_exo) +e_nn_mix = computeError(data, p_nn_mix) +e_az = computeError(data, p_az) +e_pz = computeError(data, p_pz) +options(repr.plot.width=9, repr.plot.height=7) +plotError(list(e_nn_mix, e_pz, e_az, e_nn_exo), cols=c(1,2,colors()[258], 4)) + +# Noir: neighbors_mix, bleu: neighbors_exo, vert: moyenne, rouge: persistence + +i_np = which.min(e_nn_exo$abs$indices) +i_p = which.max(e_nn_exo$abs$indices) +-----r +options(repr.plot.width=9, repr.plot.height=4) +par(mfrow=c(1,2)) + +plotPredReal(data, p_nn_exo, i_np); title(paste("PredReal nn exo day",i_np)) +plotPredReal(data, p_nn_exo, i_p); title(paste("PredReal nn exo day",i_p)) + +plotPredReal(data, p_nn_mix, i_np); title(paste("PredReal nn mix day",i_np)) +plotPredReal(data, p_nn_mix, i_p); title(paste("PredReal nn mix day",i_p)) + +plotPredReal(data, p_az, i_np); title(paste("PredReal az day",i_np)) +plotPredReal(data, p_az, i_p); title(paste("PredReal az day",i_p)) + +# Bleu: prévue, noir: réalisée +-----r +par(mfrow=c(1,2)) +f_np_exo = computeFilaments(data, p_nn_exo, i_np, plot=TRUE); title(paste("Filaments nn exo day",i_np)) +f_p_exo = computeFilaments(data, p_nn_exo, i_p, plot=TRUE); title(paste("Filaments nn exo day",i_p)) + +f_np_mix = computeFilaments(data, p_nn_mix, i_np, plot=TRUE); title(paste("Filaments nn mix day",i_np)) +f_p_mix = computeFilaments(data, p_nn_mix, i_p, plot=TRUE); title(paste("Filaments nn mix day",i_p)) +-----r +par(mfrow=c(1,2)) +plotFilamentsBox(data, f_np_exo); title(paste("FilBox nn exo day",i_np)) +plotFilamentsBox(data, f_p_exo); title(paste("FilBox nn exo day",i_p)) + +plotFilamentsBox(data, f_np_mix); title(paste("FilBox nn mix day",i_np)) +plotFilamentsBox(data, f_p_mix); title(paste("FilBox nn mix day",i_p)) +-----r +par(mfrow=c(1,2)) +plotRelVar(data, f_np_exo); title(paste("StdDev nn exo day",i_np)) +plotRelVar(data, f_p_exo); title(paste("StdDev nn exo day",i_p)) + +plotRelVar(data, f_np_mix); title(paste("StdDev nn mix day",i_np)) +plotRelVar(data, f_p_mix); title(paste("StdDev nn mix day",i_p)) + +# Variabilité globale en rouge ; sur les 60 voisins (+ lendemains) en noir +-----r +par(mfrow=c(1,2)) +plotSimils(p_nn_exo, i_np); title(paste("Weights nn exo day",i_np)) +plotSimils(p_nn_exo, i_p); title(paste("Weights nn exo day",i_p)) + +plotSimils(p_nn_mix, i_np); title(paste("Weights nn mix day",i_np)) +plotSimils(p_nn_mix, i_p); title(paste("Weights nn mix day",i_p) + +# - pollué à gauche, + pollué à droite +-----r +# Fenêtres sélectionnées dans ]0,10] / endo à gauche, exo à droite +p_nn_exo$getParams(i_np)$window +p_nn_exo$getParams(i_p)$window + +p_nn_mix$getParams(i_np)$window +p_nn_mix$getParams(i_p)$window +----- +

Bilan

+ +Problème difficile : on ne fait guère mieux qu'une naïve moyenne des lendemains des jours +similaires dans le passé, ce qui n'est pas loin 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). + +Comment améliorer la méthode ? +******* cell: markdown +******* found shortname r +******* cell: astext=False shortname=r +******* cell: markdown +******* found shortname r +******* cell: astext=False shortname=r +******* found shortname r +******* cell: astext=False shortname=r +******* found shortname r +******* cell: astext=False shortname=r +******* found shortname r +******* cell: astext=False shortname=r +******* found shortname r +******* cell: astext=False shortname=r +******* found shortname r +******* cell: astext=False shortname=r +******* found shortname r +******* cell: astext=False shortname=r +******* found shortname r +******* cell: astext=False shortname=r +******* cell: markdown +******* found shortname r +******* cell: astext=False shortname=r +******* found shortname r +******* cell: astext=False shortname=r +******* found shortname r +******* cell: astext=False shortname=r +******* found shortname r +******* cell: astext=False shortname=r +******* found shortname r +******* cell: astext=False shortname=r +******* found shortname r +******* cell: astext=False shortname=r +******* found shortname r +******* cell: astext=False shortname=r +******* found shortname r +******* cell: astext=False shortname=r +******* cell: markdown +******* found shortname r +******* cell: astext=False shortname=r +******* found shortname r +******* cell: astext=False shortname=r +******* found shortname r +******* cell: astext=False shortname=r +******* found shortname r +******* cell: astext=False shortname=r +******* found shortname r +******* cell: astext=False shortname=r +******* found shortname r +******* cell: astext=False shortname=r +******* found shortname r +******* cell: astext=False shortname=r +******* found shortname r +******* cell: astext=False shortname=r +******* cell: markdown +******* cell data structure:[['markdown', + 'text', + '\n' + '\n' + '

Introduction

\n' + '\n' + "J'ai fait quelques essais dans différentes configurations pour la méthode " + '"Neighbors"\n' + '(la seule dont on a parlé).
Il semble que le mieux soit\n' + '\n' + ' * simtype="exo" ou "mix" : similarités exogènes avec/sans endogènes ' + '(fenêtre optimisée par VC)\n' + ' * same_season=FALSE : les indices pour la validation croisée ne tiennent ' + 'pas compte des saisons\n' + ' * mix_strategy="mult" : on multiplie les poids (au lieu d\'en éteindre)\n' + '\n' + "J'ai systématiquement comparé à une approche naïve : la moyennes des " + 'lendemains des jours\n' + '"similaires" dans tout le passé ; à chaque fois sans prédiction du saut ' + '(sauf pour Neighbors :\n' + 'prédiction basée sur les poids calculés).\n' + '\n' + "Ensuite j'affiche les erreurs, quelques courbes prévues/mesurées, quelques " + 'filaments puis les\n' + 'histogrammes de quelques poids. Concernant les graphes de filaments, la ' + 'moitié gauche du graphe\n' + 'correspond aux jours similaires au jour courant, tandis que la moitié ' + 'droite affiche les\n' + "lendemains : ce sont donc les voisinages tels qu'utilisés dans " + "l'algorithme.\n" + '\n'], + ['codecell', + 'R', + 'library(talweg)\n' + '\n' + 'ts_data = ' + 'read.csv(system.file("extdata","pm10_mesures_H_loc_report.csv",package="talweg"))\n' + 'exo_data = ' + 'read.csv(system.file("extdata","meteo_extra_noNAs.csv",package="talweg"))\n' + 'data = getData(ts_data, exo_data, input_tz = "Europe/Paris", ' + 'working_tz="Europe/Paris", predict_at=13)\n' + '\n' + 'indices_ch = seq(as.Date("2015-01-18"),as.Date("2015-01-24"),"days")\n' + 'indices_ep = seq(as.Date("2015-03-15"),as.Date("2015-03-21"),"days")\n' + 'indices_np = seq(as.Date("2015-04-26"),as.Date("2015-05-02"),"days")'], + ['markdown', + 'text', + '\n\n

Pollution par chauffage

'], + ['codecell', + 'R', + 'p_nn_exo = computeForecast(data, indices_ch, "Neighbors", "Neighbors", ' + 'simtype="exo", horizon=H)\n' + 'p_nn_mix = computeForecast(data, indices_ch, "Neighbors", "Neighbors", ' + 'simtype="mix", horizon=H)\n' + 'p_az = computeForecast(data, indices_ch, "Average", "Zero", horizon=H) #, ' + 'memory=183)\n' + 'p_pz = computeForecast(data, indices_ch, "Persistence", "Zero", horizon=H, ' + 'same_day=TRUE)'], + ['codecell', + 'R', + 'e_nn_exo = computeError(data, p_nn_exo)\n' + 'e_nn_mix = computeError(data, p_nn_mix)\n' + 'e_az = computeError(data, p_az)\n' + 'e_pz = computeError(data, p_pz)\n' + 'options(repr.plot.width=9, repr.plot.height=7)\n' + 'plotError(list(e_nn_mix, e_pz, e_az, e_nn_exo), cols=c(1,2,colors()[258], ' + '4))\n' + '\n' + '# Noir: neighbors_mix, bleu: neighbors_exo, vert: moyenne, rouge: ' + 'persistence\n' + '\n' + 'i_np = which.min(e_nn_exo$abs$indices)\n' + 'i_p = which.max(e_nn_exo$abs$indices)'], + ['codecell', + 'R', + 'options(repr.plot.width=9, repr.plot.height=4)\n' + 'par(mfrow=c(1,2))\n' + '\n' + 'plotPredReal(data, p_nn_exo, i_np); title(paste("PredReal nn exo ' + 'day",i_np))\n' + 'plotPredReal(data, p_nn_exo, i_p); title(paste("PredReal nn exo day",i_p))\n' + '\n' + 'plotPredReal(data, p_nn_mix, i_np); title(paste("PredReal nn mix ' + 'day",i_np))\n' + 'plotPredReal(data, p_nn_mix, i_p); title(paste("PredReal nn mix day",i_p))\n' + '\n' + 'plotPredReal(data, p_az, i_np); title(paste("PredReal az day",i_np))\n' + 'plotPredReal(data, p_az, i_p); title(paste("PredReal az day",i_p))\n' + '\n' + '# Bleu: prévue, noir: réalisée'], + ['codecell', + 'R', + 'par(mfrow=c(1,2))\n' + 'f_np_exo = computeFilaments(data, p_nn_exo, i_np, plot=TRUE); ' + 'title(paste("Filaments nn exo day",i_np))\n' + 'f_p_exo = computeFilaments(data, p_nn_exo, i_p, plot=TRUE); ' + 'title(paste("Filaments nn exo day",i_p))\n' + '\n' + 'f_np_mix = computeFilaments(data, p_nn_mix, i_np, plot=TRUE); ' + 'title(paste("Filaments nn mix day",i_np))\n' + 'f_p_mix = computeFilaments(data, p_nn_mix, i_p, plot=TRUE); ' + 'title(paste("Filaments nn mix day",i_p))'], + ['codecell', + 'R', + 'par(mfrow=c(1,2))\n' + 'plotFilamentsBox(data, f_np_exo); title(paste("FilBox nn exo day",i_np))\n' + 'plotFilamentsBox(data, f_p_exo); title(paste("FilBox nn exo day",i_p))\n' + '\n' + 'plotFilamentsBox(data, f_np_mix); title(paste("FilBox nn mix day",i_np))\n' + 'plotFilamentsBox(data, f_p_mix); title(paste("FilBox nn mix day",i_p))'], + ['codecell', + 'R', + 'par(mfrow=c(1,2))\n' + 'plotRelVar(data, f_np_exo); title(paste("StdDev nn exo day",i_np))\n' + 'plotRelVar(data, f_p_exo); title(paste("StdDev nn exo day",i_p))\n' + '\n' + 'plotRelVar(data, f_np_mix); title(paste("StdDev nn mix day",i_np))\n' + 'plotRelVar(data, f_p_mix); title(paste("StdDev nn mix day",i_p))\n' + '\n' + '# Variabilité globale en rouge ; sur les 60 voisins (+ lendemains) en noir'], + ['codecell', + 'R', + 'par(mfrow=c(1,2))\n' + 'plotSimils(p_nn_exo, i_np); title(paste("Weights nn exo day",i_np))\n' + 'plotSimils(p_nn_exo, i_p); title(paste("Weights nn exo day",i_p))\n' + '\n' + 'plotSimils(p_nn_mix, i_np); title(paste("Weights nn mix day",i_np))\n' + 'plotSimils(p_nn_mix, i_p); title(paste("Weights nn mix day",i_p)\n' + '\n' + '# - pollué à gauche, + pollué à droite'], + ['codecell', + 'R', + '# Fenêtres sélectionnées dans ]0,10] / endo à gauche, exo à droite\n' + 'p_nn_exo$getParams(i_np)$window\n' + 'p_nn_exo$getParams(i_p)$window\n' + '\n' + 'p_nn_mix$getParams(i_np)$window\n' + 'p_nn_mix$getParams(i_p)$window'], + ['markdown', + 'text', + '\n\n

Pollution par épandage

'], + ['codecell', + 'R', + 'p_nn_exo = computeForecast(data, indices_ep, "Neighbors", "Neighbors", ' + 'simtype="exo", horizon=H)\n' + 'p_nn_mix = computeForecast(data, indices_ep, "Neighbors", "Neighbors", ' + 'simtype="mix", horizon=H)\n' + 'p_az = computeForecast(data, indices_ep, "Average", "Zero", horizon=H) #, ' + 'memory=183)\n' + 'p_pz = computeForecast(data, indices_ep, "Persistence", "Zero", horizon=H, ' + 'same_day=TRUE)'], + ['codecell', + 'R', + 'e_nn_exo = computeError(data, p_nn_exo)\n' + 'e_nn_mix = computeError(data, p_nn_mix)\n' + 'e_az = computeError(data, p_az)\n' + 'e_pz = computeError(data, p_pz)\n' + 'options(repr.plot.width=9, repr.plot.height=7)\n' + 'plotError(list(e_nn_mix, e_pz, e_az, e_nn_exo), cols=c(1,2,colors()[258], ' + '4))\n' + '\n' + '# Noir: neighbors_mix, bleu: neighbors_exo, vert: moyenne, rouge: ' + 'persistence\n' + '\n' + 'i_np = which.min(e_nn_exo$abs$indices)\n' + 'i_p = which.max(e_nn_exo$abs$indices)'], + ['codecell', + 'R', + 'options(repr.plot.width=9, repr.plot.height=4)\n' + 'par(mfrow=c(1,2))\n' + '\n' + 'plotPredReal(data, p_nn_exo, i_np); title(paste("PredReal nn exo ' + 'day",i_np))\n' + 'plotPredReal(data, p_nn_exo, i_p); title(paste("PredReal nn exo day",i_p))\n' + '\n' + 'plotPredReal(data, p_nn_mix, i_np); title(paste("PredReal nn mix ' + 'day",i_np))\n' + 'plotPredReal(data, p_nn_mix, i_p); title(paste("PredReal nn mix day",i_p))\n' + '\n' + 'plotPredReal(data, p_az, i_np); title(paste("PredReal az day",i_np))\n' + 'plotPredReal(data, p_az, i_p); title(paste("PredReal az day",i_p))\n' + '\n' + '# Bleu: prévue, noir: réalisée'], + ['codecell', + 'R', + 'par(mfrow=c(1,2))\n' + 'f_np_exo = computeFilaments(data, p_nn_exo, i_np, plot=TRUE); ' + 'title(paste("Filaments nn exo day",i_np))\n' + 'f_p_exo = computeFilaments(data, p_nn_exo, i_p, plot=TRUE); ' + 'title(paste("Filaments nn exo day",i_p))\n' + '\n' + 'f_np_mix = computeFilaments(data, p_nn_mix, i_np, plot=TRUE); ' + 'title(paste("Filaments nn mix day",i_np))\n' + 'f_p_mix = computeFilaments(data, p_nn_mix, i_p, plot=TRUE); ' + 'title(paste("Filaments nn mix day",i_p))'], + ['codecell', + 'R', + 'par(mfrow=c(1,2))\n' + 'plotFilamentsBox(data, f_np_exo); title(paste("FilBox nn exo day",i_np))\n' + 'plotFilamentsBox(data, f_p_exo); title(paste("FilBox nn exo day",i_p))\n' + '\n' + 'plotFilamentsBox(data, f_np_mix); title(paste("FilBox nn mix day",i_np))\n' + 'plotFilamentsBox(data, f_p_mix); title(paste("FilBox nn mix day",i_p))'], + ['codecell', + 'R', + 'par(mfrow=c(1,2))\n' + 'plotRelVar(data, f_np_exo); title(paste("StdDev nn exo day",i_np))\n' + 'plotRelVar(data, f_p_exo); title(paste("StdDev nn exo day",i_p))\n' + '\n' + 'plotRelVar(data, f_np_mix); title(paste("StdDev nn mix day",i_np))\n' + 'plotRelVar(data, f_p_mix); title(paste("StdDev nn mix day",i_p))\n' + '\n' + '# Variabilité globale en rouge ; sur les 60 voisins (+ lendemains) en noir'], + ['codecell', + 'R', + 'par(mfrow=c(1,2))\n' + 'plotSimils(p_nn_exo, i_np); title(paste("Weights nn exo day",i_np))\n' + 'plotSimils(p_nn_exo, i_p); title(paste("Weights nn exo day",i_p))\n' + '\n' + 'plotSimils(p_nn_mix, i_np); title(paste("Weights nn mix day",i_np))\n' + 'plotSimils(p_nn_mix, i_p); title(paste("Weights nn mix day",i_p)\n' + '\n' + '# - pollué à gauche, + pollué à droite'], + ['codecell', + 'R', + '# Fenêtres sélectionnées dans ]0,10] / endo à gauche, exo à droite\n' + 'p_nn_exo$getParams(i_np)$window\n' + 'p_nn_exo$getParams(i_p)$window\n' + '\n' + 'p_nn_mix$getParams(i_np)$window\n' + 'p_nn_mix$getParams(i_p)$window'], + ['markdown', + 'text', + '\n\n

Semaine non polluée

'], + ['codecell', + 'R', + 'p_nn_exo = computeForecast(data, indices_np, "Neighbors", "Neighbors", ' + 'simtype="exo", horizon=H)\n' + 'p_nn_mix = computeForecast(data, indices_np, "Neighbors", "Neighbors", ' + 'simtype="mix", horizon=H)\n' + 'p_az = computeForecast(data, indices_np, "Average", "Zero", horizon=H) #, ' + 'memory=183)\n' + 'p_pz = computeForecast(data, indices_np, "Persistence", "Zero", horizon=H, ' + 'same_day=TRUE)'], + ['codecell', + 'R', + 'e_nn_exo = computeError(data, p_nn_exo)\n' + 'e_nn_mix = computeError(data, p_nn_mix)\n' + 'e_az = computeError(data, p_az)\n' + 'e_pz = computeError(data, p_pz)\n' + 'options(repr.plot.width=9, repr.plot.height=7)\n' + 'plotError(list(e_nn_mix, e_pz, e_az, e_nn_exo), cols=c(1,2,colors()[258], ' + '4))\n' + '\n' + '# Noir: neighbors_mix, bleu: neighbors_exo, vert: moyenne, rouge: ' + 'persistence\n' + '\n' + 'i_np = which.min(e_nn_exo$abs$indices)\n' + 'i_p = which.max(e_nn_exo$abs$indices)'], + ['codecell', + 'R', + 'options(repr.plot.width=9, repr.plot.height=4)\n' + 'par(mfrow=c(1,2))\n' + '\n' + 'plotPredReal(data, p_nn_exo, i_np); title(paste("PredReal nn exo ' + 'day",i_np))\n' + 'plotPredReal(data, p_nn_exo, i_p); title(paste("PredReal nn exo day",i_p))\n' + '\n' + 'plotPredReal(data, p_nn_mix, i_np); title(paste("PredReal nn mix ' + 'day",i_np))\n' + 'plotPredReal(data, p_nn_mix, i_p); title(paste("PredReal nn mix day",i_p))\n' + '\n' + 'plotPredReal(data, p_az, i_np); title(paste("PredReal az day",i_np))\n' + 'plotPredReal(data, p_az, i_p); title(paste("PredReal az day",i_p))\n' + '\n' + '# Bleu: prévue, noir: réalisée'], + ['codecell', + 'R', + 'par(mfrow=c(1,2))\n' + 'f_np_exo = computeFilaments(data, p_nn_exo, i_np, plot=TRUE); ' + 'title(paste("Filaments nn exo day",i_np))\n' + 'f_p_exo = computeFilaments(data, p_nn_exo, i_p, plot=TRUE); ' + 'title(paste("Filaments nn exo day",i_p))\n' + '\n' + 'f_np_mix = computeFilaments(data, p_nn_mix, i_np, plot=TRUE); ' + 'title(paste("Filaments nn mix day",i_np))\n' + 'f_p_mix = computeFilaments(data, p_nn_mix, i_p, plot=TRUE); ' + 'title(paste("Filaments nn mix day",i_p))'], + ['codecell', + 'R', + 'par(mfrow=c(1,2))\n' + 'plotFilamentsBox(data, f_np_exo); title(paste("FilBox nn exo day",i_np))\n' + 'plotFilamentsBox(data, f_p_exo); title(paste("FilBox nn exo day",i_p))\n' + '\n' + 'plotFilamentsBox(data, f_np_mix); title(paste("FilBox nn mix day",i_np))\n' + 'plotFilamentsBox(data, f_p_mix); title(paste("FilBox nn mix day",i_p))'], + ['codecell', + 'R', + 'par(mfrow=c(1,2))\n' + 'plotRelVar(data, f_np_exo); title(paste("StdDev nn exo day",i_np))\n' + 'plotRelVar(data, f_p_exo); title(paste("StdDev nn exo day",i_p))\n' + '\n' + 'plotRelVar(data, f_np_mix); title(paste("StdDev nn mix day",i_np))\n' + 'plotRelVar(data, f_p_mix); title(paste("StdDev nn mix day",i_p))\n' + '\n' + '# Variabilité globale en rouge ; sur les 60 voisins (+ lendemains) en noir'], + ['codecell', + 'R', + 'par(mfrow=c(1,2))\n' + 'plotSimils(p_nn_exo, i_np); title(paste("Weights nn exo day",i_np))\n' + 'plotSimils(p_nn_exo, i_p); title(paste("Weights nn exo day",i_p))\n' + '\n' + 'plotSimils(p_nn_mix, i_np); title(paste("Weights nn mix day",i_np))\n' + 'plotSimils(p_nn_mix, i_p); title(paste("Weights nn mix day",i_p)\n' + '\n' + '# - pollué à gauche, + pollué à droite'], + ['codecell', + 'R', + '# Fenêtres sélectionnées dans ]0,10] / endo à gauche, exo à droite\n' + 'p_nn_exo$getParams(i_np)$window\n' + 'p_nn_exo$getParams(i_p)$window\n' + '\n' + 'p_nn_mix$getParams(i_np)$window\n' + 'p_nn_mix$getParams(i_p)$window'], + ['markdown', + 'text', + '\n' + '\n' + '

Bilan

\n' + '\n' + "Problème difficile : on ne fait guère mieux qu'une naïve moyenne des " + 'lendemains des jours\n' + "similaires dans le passé, ce qui n'est pas loin de prédire une série " + 'constante égale à la\n' + 'dernière valeur observée (méthode "zéro"). La persistence donne parfois de ' + 'bons résultats\n' + "mais est trop instable (sensibilité à l'argument same_day).\n" + '\n' + 'Comment améliorer la méthode ?']]