'update'
authorBenjamin Auder <benjamin.auder@somewhere>
Thu, 2 Mar 2017 13:09:19 +0000 (14:09 +0100)
committerBenjamin Auder <benjamin.auder@somewhere>
Thu, 2 Mar 2017 13:09:19 +0000 (14:09 +0100)
reports/report.Rmd [new file with mode: 0644]

diff --git a/reports/report.Rmd b/reports/report.Rmd
new file mode 100644 (file)
index 0000000..b6e94cb
--- /dev/null
@@ -0,0 +1,160 @@
+---
+title: "talweg"
+author: "Benjamin Auder"
+date: "`r Sys.Date()`"
+output: rmarkdown::html_vignette
+vignette: >
+  %\VignetteIndexEntry{Vignette Title}
+  %\VignetteEngine{knitr::rmarkdown}
+  %\VignetteEncoding{UTF-8}
+---
+
+
+## Introduction
+
+J'ai fait quelques essais dans différentes configurations pour la méthode "Neighbors" (la seule dont on a parlé).<br>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.
+
+<h2 style="color:blue;font-size:2em">Pollution par chauffage</h2>
+
+
+loop: indices_ch, ep, np et titres: Pollution par chauffage, Pollution par épandage, Semaine non polluée
+
+
+
+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)
+
+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)
+
+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
+
+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))
+
+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))
+
+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
+
+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
+
+#Fenêtres sélectionnées dans ]0,10] / endo à gauche, exo à droite
+p_ch_nn_exo$getParams(i_np)$window
+p_ch_nn_exo$getParams(i_p)$window
+
+p_ch_nn_mix$getParams(i_np)$window
+p_ch_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 <code>same_day</code>).
+
+Comment améliorer la méthode ?
+
+
+
+
+Vignettes are long form documentation commonly included in packages. Because they are part of the distribution of the package, they need to be as compact as possible. The `html_vignette` output type provides a custom style sheet (and tweaks some options) to ensure that the resulting html is as small as possible. The `html_vignette` format:
+
+- Never uses retina figures
+- Has a smaller default figure size
+- Uses a custom CSS stylesheet instead of the default Twitter Bootstrap style
+
+## Vignette Info
+
+Note the various macros within the `vignette` section of the metadata block above. These are required in order to instruct R how to build the vignette. Note that you should change the `title` field and the `\VignetteIndexEntry` to match the title of your vignette.
+
+## Styles
+
+The `html_vignette` template includes a basic CSS theme. To override this theme you can specify your own CSS in the document metadata as follows:
+
+    output: 
+      rmarkdown::html_vignette:
+        css: mystyles.css
+
+## Figures
+
+The figure sizes have been customised so that you can easily put two images side-by-side. 
+
+```{r, fig.show='hold'}
+plot(1:10)
+plot(10:1)
+```
+
+You can enable figure captions by `fig_caption: yes` in YAML:
+
+    output:
+      rmarkdown::html_vignette:
+        fig_caption: yes
+
+Then you can use the chunk option `fig.cap = "Your figure caption."` in **knitr**.
+
+## More Examples
+
+You can write math expressions, e.g. $Y = X\beta + \epsilon$, footnotes^[A footnote here.], and tables, e.g. using `knitr::kable()`.
+
+```{r, echo=FALSE, results='asis'}
+knitr::kable(head(mtcars, 10))
+```
+
+Also a quote using `>`:
+
+> "He who gives up [code] safety for [code] speed deserves neither."
+([via](https://twitter.com/hadleywickham/status/504368538874703872))