From: Benjamin Auder Date: Wed, 12 Apr 2017 16:49:06 +0000 (+0200) Subject: add report.tex X-Git-Url: https://git.auder.net/variants/%24%7Bvname%7D/current/%7B%7B%20targetUrl%20%7D%7D?a=commitdiff_plain;h=4ba96933bd3eb63800ef9e98edbabe693aec7340;p=talweg.git add report.tex --- diff --git a/.gitignore b/.gitignore index 0156460..92a17ad 100644 --- a/.gitignore +++ b/.gitignore @@ -29,14 +29,14 @@ data/*.csv #misc *.png -*.tex +#*.tex #.gitattributes/.gitfat files are generated by initialize.sh .gitattributes .gitfat #Rmarkdown, knitr + LaTeX generated files -*.tex +#*.tex *.pdf !/biblio/*.pdf *.aux diff --git a/reports/rapport_final/report_P7_H17.tex b/reports/rapport_final/report_P7_H17.tex new file mode 100644 index 0000000..012df04 --- /dev/null +++ b/reports/rapport_final/report_P7_H17.tex @@ -0,0 +1,985 @@ + +% Default to the notebook output style + + + + +% Inherit from the specified cell style. + + + + + +\documentclass[11pt]{article} + + + + \usepackage[T1]{fontenc} + % Nicer default font (+ math font) than Computer Modern for most use cases + \usepackage{mathpazo} + + % Basic figure setup, for now with no caption control since it's done + % automatically by Pandoc (which extracts ![](path) syntax from Markdown). + \usepackage{graphicx} + % We will generate all images so they have a width \maxwidth. This means + % that they will get their normal width if they fit onto the page, but + % are scaled down if they would overflow the margins. + \makeatletter + \def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth + \else\Gin@nat@width\fi} + \makeatother + \let\Oldincludegraphics\includegraphics + % Set max figure width to be 80% of text width, for now hardcoded. + \renewcommand{\includegraphics}[1]{\Oldincludegraphics[width=.8\maxwidth]{#1}} + % Ensure that by default, figures have no caption (until we provide a + % proper Figure object with a Caption API and a way to capture that + % in the conversion process - todo). + \usepackage{caption} + \DeclareCaptionLabelFormat{nolabel}{} + \captionsetup{labelformat=nolabel} + + \usepackage{adjustbox} % Used to constrain images to a maximum size + \usepackage{xcolor} % Allow colors to be defined + \usepackage{enumerate} % Needed for markdown enumerations to work + \usepackage{geometry} % Used to adjust the document margins + \usepackage{amsmath} % Equations + \usepackage{amssymb} % Equations + \usepackage{textcomp} % defines textquotesingle + % Hack from http://tex.stackexchange.com/a/47451/13684: + \AtBeginDocument{% + \def\PYZsq{\textquotesingle}% Upright quotes in Pygmentized code + } + \usepackage{upquote} % Upright quotes for verbatim code + \usepackage{eurosym} % defines \euro + \usepackage[mathletters]{ucs} % Extended unicode (utf-8) support + \usepackage[utf8x]{inputenc} % Allow utf-8 characters in the tex document + \usepackage{fancyvrb} % verbatim replacement that allows latex + \usepackage{grffile} % extends the file name processing of package graphics + % to support a larger range + % The hyperref package gives us a pdf with properly built + % internal navigation ('pdf bookmarks' for the table of contents, + % internal cross-reference links, web links for URLs, etc.) + \usepackage{hyperref} + \usepackage{longtable} % longtable support required by pandoc >1.10 + \usepackage{booktabs} % table support for pandoc > 1.12.2 + \usepackage[inline]{enumitem} % IRkernel/repr support (it uses the enumerate* environment) + \usepackage[normalem]{ulem} % ulem is needed to support strikethroughs (\sout) + % normalem makes italics be italics, not underlines + + + + + % Colors for the hyperref package + \definecolor{urlcolor}{rgb}{0,.145,.698} + \definecolor{linkcolor}{rgb}{.71,0.21,0.01} + \definecolor{citecolor}{rgb}{.12,.54,.11} + + % ANSI colors + \definecolor{ansi-black}{HTML}{3E424D} + \definecolor{ansi-black-intense}{HTML}{282C36} + \definecolor{ansi-red}{HTML}{E75C58} + \definecolor{ansi-red-intense}{HTML}{B22B31} + \definecolor{ansi-green}{HTML}{00A250} + \definecolor{ansi-green-intense}{HTML}{007427} + \definecolor{ansi-yellow}{HTML}{DDB62B} + \definecolor{ansi-yellow-intense}{HTML}{B27D12} + \definecolor{ansi-blue}{HTML}{208FFB} + \definecolor{ansi-blue-intense}{HTML}{0065CA} + \definecolor{ansi-magenta}{HTML}{D160C4} + \definecolor{ansi-magenta-intense}{HTML}{A03196} + \definecolor{ansi-cyan}{HTML}{60C6C8} + \definecolor{ansi-cyan-intense}{HTML}{258F8F} + \definecolor{ansi-white}{HTML}{C5C1B4} + \definecolor{ansi-white-intense}{HTML}{A1A6B2} + + % commands and environments needed by pandoc snippets + % extracted from the output of `pandoc -s` + \providecommand{\tightlist}{% + \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} + \DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}} + % Add ',fontsize=\small' for more characters per line + \newenvironment{Shaded}{}{} + \newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}} + \newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.56,0.13,0.00}{{#1}}} + \newcommand{\DecValTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}} + \newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}} + \newcommand{\FloatTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}} + \newcommand{\CharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}} + \newcommand{\StringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}} + \newcommand{\CommentTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textit{{#1}}}} + \newcommand{\OtherTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{{#1}}} + \newcommand{\AlertTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}} + \newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.02,0.16,0.49}{{#1}}} + \newcommand{\RegionMarkerTok}[1]{{#1}} + \newcommand{\ErrorTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}} + \newcommand{\NormalTok}[1]{{#1}} + + % Additional commands for more recent versions of Pandoc + \newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.53,0.00,0.00}{{#1}}} + \newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}} + \newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}} + \newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.73,0.40,0.53}{{#1}}} + \newcommand{\ImportTok}[1]{{#1}} + \newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.73,0.13,0.13}{\textit{{#1}}}} + \newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}} + \newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}} + \newcommand{\VariableTok}[1]{\textcolor[rgb]{0.10,0.09,0.49}{{#1}}} + \newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}} + \newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.40,0.40,0.40}{{#1}}} + \newcommand{\BuiltInTok}[1]{{#1}} + \newcommand{\ExtensionTok}[1]{{#1}} + \newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.74,0.48,0.00}{{#1}}} + \newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.49,0.56,0.16}{{#1}}} + \newcommand{\InformationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}} + \newcommand{\WarningTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}} + + + % Define a nice break command that doesn't care if a line doesn't already + % exist. + \def\br{\hspace*{\fill} \\* } + % Math Jax compatability definitions + \def\gt{>} + \def\lt{<} + % Document parameters + \title{report\_P7\_H17} + + + + + % Pygments definitions + +\makeatletter +\def\PY@reset{\let\PY@it=\relax \let\PY@bf=\relax% + \let\PY@ul=\relax \let\PY@tc=\relax% + \let\PY@bc=\relax \let\PY@ff=\relax} +\def\PY@tok#1{\csname PY@tok@#1\endcsname} +\def\PY@toks#1+{\ifx\relax#1\empty\else% + \PY@tok{#1}\expandafter\PY@toks\fi} +\def\PY@do#1{\PY@bc{\PY@tc{\PY@ul{% + \PY@it{\PY@bf{\PY@ff{#1}}}}}}} +\def\PY#1#2{\PY@reset\PY@toks#1+\relax+\PY@do{#2}} + +\expandafter\def\csname PY@tok@w\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.73,0.73}{##1}}} +\expandafter\def\csname PY@tok@c\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}} +\expandafter\def\csname PY@tok@cp\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.74,0.48,0.00}{##1}}} +\expandafter\def\csname PY@tok@k\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@kp\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@kt\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.69,0.00,0.25}{##1}}} +\expandafter\def\csname PY@tok@o\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} +\expandafter\def\csname PY@tok@ow\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}} +\expandafter\def\csname PY@tok@nb\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@nf\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}} +\expandafter\def\csname PY@tok@nc\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}} +\expandafter\def\csname PY@tok@nn\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}} +\expandafter\def\csname PY@tok@ne\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.82,0.25,0.23}{##1}}} +\expandafter\def\csname PY@tok@nv\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}} +\expandafter\def\csname PY@tok@no\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.53,0.00,0.00}{##1}}} +\expandafter\def\csname PY@tok@nl\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.63,0.63,0.00}{##1}}} +\expandafter\def\csname PY@tok@ni\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.60,0.60,0.60}{##1}}} +\expandafter\def\csname PY@tok@na\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.49,0.56,0.16}{##1}}} +\expandafter\def\csname PY@tok@nt\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@nd\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}} +\expandafter\def\csname PY@tok@s\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} +\expandafter\def\csname PY@tok@sd\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} +\expandafter\def\csname PY@tok@si\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.53}{##1}}} +\expandafter\def\csname PY@tok@se\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.13}{##1}}} +\expandafter\def\csname PY@tok@sr\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.53}{##1}}} +\expandafter\def\csname PY@tok@ss\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}} +\expandafter\def\csname PY@tok@sx\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@m\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} +\expandafter\def\csname PY@tok@gh\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}} +\expandafter\def\csname PY@tok@gu\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.50,0.00,0.50}{##1}}} +\expandafter\def\csname PY@tok@gd\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.63,0.00,0.00}{##1}}} +\expandafter\def\csname PY@tok@gi\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.63,0.00}{##1}}} +\expandafter\def\csname PY@tok@gr\endcsname{\def\PY@tc##1{\textcolor[rgb]{1.00,0.00,0.00}{##1}}} +\expandafter\def\csname PY@tok@ge\endcsname{\let\PY@it=\textit} +\expandafter\def\csname PY@tok@gs\endcsname{\let\PY@bf=\textbf} +\expandafter\def\csname PY@tok@gp\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}} +\expandafter\def\csname PY@tok@go\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.53,0.53,0.53}{##1}}} +\expandafter\def\csname PY@tok@gt\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.27,0.87}{##1}}} +\expandafter\def\csname PY@tok@err\endcsname{\def\PY@bc##1{\setlength{\fboxsep}{0pt}\fcolorbox[rgb]{1.00,0.00,0.00}{1,1,1}{\strut ##1}}} +\expandafter\def\csname PY@tok@kc\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@kd\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@kn\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@kr\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@bp\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@fm\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}} +\expandafter\def\csname PY@tok@vc\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}} +\expandafter\def\csname PY@tok@vg\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}} +\expandafter\def\csname PY@tok@vi\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}} +\expandafter\def\csname PY@tok@vm\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}} +\expandafter\def\csname PY@tok@sa\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} +\expandafter\def\csname PY@tok@sb\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} +\expandafter\def\csname PY@tok@sc\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} +\expandafter\def\csname PY@tok@dl\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} +\expandafter\def\csname PY@tok@s2\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} +\expandafter\def\csname PY@tok@sh\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} +\expandafter\def\csname PY@tok@s1\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} +\expandafter\def\csname PY@tok@mb\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} +\expandafter\def\csname PY@tok@mf\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} +\expandafter\def\csname PY@tok@mh\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} +\expandafter\def\csname PY@tok@mi\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} +\expandafter\def\csname PY@tok@il\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} +\expandafter\def\csname PY@tok@mo\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} +\expandafter\def\csname PY@tok@ch\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}} +\expandafter\def\csname PY@tok@cm\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}} +\expandafter\def\csname PY@tok@cpf\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}} +\expandafter\def\csname PY@tok@c1\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}} +\expandafter\def\csname PY@tok@cs\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}} + +\def\PYZbs{\char`\\} +\def\PYZus{\char`\_} +\def\PYZob{\char`\{} +\def\PYZcb{\char`\}} +\def\PYZca{\char`\^} +\def\PYZam{\char`\&} +\def\PYZlt{\char`\<} +\def\PYZgt{\char`\>} +\def\PYZsh{\char`\#} +\def\PYZpc{\char`\%} +\def\PYZdl{\char`\$} +\def\PYZhy{\char`\-} +\def\PYZsq{\char`\'} +\def\PYZdq{\char`\"} +\def\PYZti{\char`\~} +% for compatibility with earlier versions +\def\PYZat{@} +\def\PYZlb{[} +\def\PYZrb{]} +\makeatother + + + % Exact colors from NB + \definecolor{incolor}{rgb}{0.0, 0.0, 0.5} + \definecolor{outcolor}{rgb}{0.545, 0.0, 0.0} + + + + + % Prevent overflowing lines due to hard-to-break entities + \sloppy + % Setup hyperref package + \hypersetup{ + breaklinks=true, % so long urls are correctly broken across lines + colorlinks=true, + urlcolor=urlcolor, + linkcolor=linkcolor, + citecolor=citecolor, + } + % Slightly bigger margins than the latex defaults + + \geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in} + + + + \begin{document} + + + \maketitle + + + + + \subsection*{Introduction} + +Cette partie montre les résultats obtenus via des variantes de +l'algorithme décrit à la section 2, en utilisant le package présenté à +la section 3. Cet algorithme est systématiquement comparé à deux +approches naïves : * la moyenne des lendemains des jours "similaires" +dans tout le passé, c'est-à-dire prédiction = moyenne de tous les mardis +passé si le jour courant est un lndi par exemple. * la persistence, +reproduisant le jour courant ou allant chercher le lendemain de la +dernière journée "similaire" (même principe que ci-dessus ; argument +"same\_day"). + +Concernant l'algorithme principal à voisins, trois variantes sont +étudiées dans cette partie : * avec simtype="mix" et raccordement +"Neighbors" dans le cas "non local", i.e. on va chercher des voisins +n'importe où du moment qu'ils correspondent au premier élément d'un +couple de deux jours consécutifs sans valeurs manquantes. * avec +simtype="endo" + raccordement "Neighbors" puis simtype="none" + +raccordement "Zero" (sans ajustement) dans le cas "local" : voisins de +même niveau de pollution et même saison. + +Pour chaque période retenue -\/- chauffage, épandage, semaine non +polluée -\/- les erreurs de prédiction sont d'abord affichées, puis +quelques graphes de courbes réalisées/prévues (sur le jour "en moyenne +le plus facile" à gauche, et "en moyenne le plus difficile" à droite). +Ensuite plusieurs types de graphes apportant des précisions sur la +nature et la difficulté du problème viennent compléter ces premières +courbes. 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. + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}1}]:} \PY{n}{library}\PY{p}{(}\PY{n}{talweg}\PY{p}{)} + + \PY{n}{P} \PY{o}{=} \PY{l+m+mi}{7} \PY{c+c1}{\PYZsh{}instant de prévision} + \PY{n}{H} \PY{o}{=} \PY{l+m+mi}{17} \PY{c+c1}{\PYZsh{}horizon (en heures)} + + \PY{n}{ts\PYZus{}data} \PY{o}{=} \PY{n}{read}\PY{o}{.}\PY{n}{csv}\PY{p}{(}\PY{n}{system}\PY{o}{.}\PY{n}{file}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{extdata}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{pm10\PYZus{}mesures\PYZus{}H\PYZus{}loc\PYZus{}report.csv}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} + \PY{n}{package}\PY{o}{=}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{talweg}\PY{l+s+s2}{\PYZdq{}}\PY{p}{)}\PY{p}{)} + \PY{n}{exo\PYZus{}data} \PY{o}{=} \PY{n}{read}\PY{o}{.}\PY{n}{csv}\PY{p}{(}\PY{n}{system}\PY{o}{.}\PY{n}{file}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{extdata}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{meteo\PYZus{}extra\PYZus{}noNAs.csv}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{package}\PY{o}{=}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{talweg}\PY{l+s+s2}{\PYZdq{}}\PY{p}{)}\PY{p}{)} + \PY{c+c1}{\PYZsh{} NOTE: \PYZsq{}GMT\PYZsq{} because DST gaps are filled and multiple values merged in above dataset.} + \PY{c+c1}{\PYZsh{} Prediction from P+1 to P+H included.} + \PY{n}{data} \PY{o}{=} \PY{n}{getData}\PY{p}{(}\PY{n}{ts\PYZus{}data}\PY{p}{,} \PY{n}{exo\PYZus{}data}\PY{p}{,} \PY{n}{input\PYZus{}tz} \PY{o}{=} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{GMT}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{n}{working\PYZus{}tz}\PY{o}{=}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{GMT}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{n}{predict\PYZus{}at}\PY{o}{=}\PY{n}{P}\PY{p}{)} + + \PY{n}{indices\PYZus{}ch} \PY{o}{=} \PY{n}{seq}\PY{p}{(}\PY{k}{as}\PY{o}{.}\PY{n}{Date}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{2015\PYZhy{}01\PYZhy{}18}\PY{l+s+s2}{\PYZdq{}}\PY{p}{)}\PY{p}{,}\PY{k}{as}\PY{o}{.}\PY{n}{Date}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{2015\PYZhy{}01\PYZhy{}24}\PY{l+s+s2}{\PYZdq{}}\PY{p}{)}\PY{p}{,}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{days}\PY{l+s+s2}{\PYZdq{}}\PY{p}{)} + \PY{n}{indices\PYZus{}ep} \PY{o}{=} \PY{n}{seq}\PY{p}{(}\PY{k}{as}\PY{o}{.}\PY{n}{Date}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{2015\PYZhy{}03\PYZhy{}15}\PY{l+s+s2}{\PYZdq{}}\PY{p}{)}\PY{p}{,}\PY{k}{as}\PY{o}{.}\PY{n}{Date}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{2015\PYZhy{}03\PYZhy{}21}\PY{l+s+s2}{\PYZdq{}}\PY{p}{)}\PY{p}{,}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{days}\PY{l+s+s2}{\PYZdq{}}\PY{p}{)} + \PY{n}{indices\PYZus{}np} \PY{o}{=} \PY{n}{seq}\PY{p}{(}\PY{k}{as}\PY{o}{.}\PY{n}{Date}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{2015\PYZhy{}04\PYZhy{}26}\PY{l+s+s2}{\PYZdq{}}\PY{p}{)}\PY{p}{,}\PY{k}{as}\PY{o}{.}\PY{n}{Date}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{2015\PYZhy{}05\PYZhy{}02}\PY{l+s+s2}{\PYZdq{}}\PY{p}{)}\PY{p}{,}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{days}\PY{l+s+s2}{\PYZdq{}}\PY{p}{)} +\end{Verbatim} + + \subsection*{Pollution par chauffage} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}2}]:} \PY{n}{p1} \PY{o}{=} \PY{n}{computeForecast}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{indices\PYZus{}ch}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Neighbors}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Neighbors}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{n}{horizon}\PY{o}{=}\PY{n}{H}\PY{p}{,} + \PY{n}{simtype}\PY{o}{=}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{mix}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{n}{local}\PY{o}{=}\PY{n}{FALSE}\PY{p}{)} + \PY{n}{p2} \PY{o}{=} \PY{n}{computeForecast}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{indices\PYZus{}ch}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Neighbors}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Neighbors}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{n}{horizon}\PY{o}{=}\PY{n}{H}\PY{p}{,} + \PY{n}{simtype}\PY{o}{=}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{endo}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{n}{local}\PY{o}{=}\PY{n}{TRUE}\PY{p}{)} + \PY{n}{p3} \PY{o}{=} \PY{n}{computeForecast}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{indices\PYZus{}ch}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Neighbors}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Zero}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{n}{horizon}\PY{o}{=}\PY{n}{H}\PY{p}{,} + \PY{n}{simtype}\PY{o}{=}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{none}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{n}{local}\PY{o}{=}\PY{n}{TRUE}\PY{p}{)} + \PY{n}{p4} \PY{o}{=} \PY{n}{computeForecast}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{indices\PYZus{}ch}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Average}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Zero}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{n}{horizon}\PY{o}{=}\PY{n}{H}\PY{p}{)} + \PY{n}{p5} \PY{o}{=} \PY{n}{computeForecast}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{indices\PYZus{}ch}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Persistence}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Zero}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{n}{horizon}\PY{o}{=}\PY{n}{H}\PY{p}{,} + \PY{n}{same\PYZus{}day}\PY{o}{=}\PY{n}{TRUE}\PY{p}{)} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}3}]:} \PY{n}{e1} \PY{o}{=} \PY{n}{computeError}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p1}\PY{p}{,} \PY{n}{H}\PY{p}{)} + \PY{n}{e2} \PY{o}{=} \PY{n}{computeError}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p2}\PY{p}{,} \PY{n}{H}\PY{p}{)} + \PY{n}{e3} \PY{o}{=} \PY{n}{computeError}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p3}\PY{p}{,} \PY{n}{H}\PY{p}{)} + \PY{n}{e4} \PY{o}{=} \PY{n}{computeError}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p4}\PY{p}{,} \PY{n}{H}\PY{p}{)} + \PY{n}{e5} \PY{o}{=} \PY{n}{computeError}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p5}\PY{p}{,} \PY{n}{H}\PY{p}{)} + \PY{n}{options}\PY{p}{(}\PY{n+nb}{repr}\PY{o}{.}\PY{n}{plot}\PY{o}{.}\PY{n}{width}\PY{o}{=}\PY{l+m+mi}{9}\PY{p}{,} \PY{n+nb}{repr}\PY{o}{.}\PY{n}{plot}\PY{o}{.}\PY{n}{height}\PY{o}{=}\PY{l+m+mi}{7}\PY{p}{)} + \PY{n}{plotError}\PY{p}{(}\PY{n+nb}{list}\PY{p}{(}\PY{n}{e1}\PY{p}{,} \PY{n}{e5}\PY{p}{,} \PY{n}{e4}\PY{p}{,} \PY{n}{e2}\PY{p}{,} \PY{n}{e3}\PY{p}{)}\PY{p}{,} \PY{n}{cols}\PY{o}{=}\PY{n}{c}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{,}\PY{n}{colors}\PY{p}{(}\PY{p}{)}\PY{p}{[}\PY{l+m+mi}{258}\PY{p}{]}\PY{p}{,}\PY{l+m+mi}{4}\PY{p}{,}\PY{l+m+mi}{6}\PY{p}{)}\PY{p}{)} + + \PY{c+c1}{\PYZsh{} noir: Neighbors non\PYZhy{}local (p1), bleu: Neighbors local endo (p2),} + \PY{c+c1}{\PYZsh{} mauve: Neighbors local none (p3), vert: moyenne (p4),} + \PY{c+c1}{\PYZsh{} rouge: persistence (p5)} + + \PY{n}{sum\PYZus{}p123} \PY{o}{=} \PY{n}{e1}\PY{err}{\PYZdl{}}\PY{n+nb}{abs}\PY{err}{\PYZdl{}}\PY{n}{indices} \PY{o}{+} \PY{n}{e2}\PY{err}{\PYZdl{}}\PY{n+nb}{abs}\PY{err}{\PYZdl{}}\PY{n}{indices} \PY{o}{+} \PY{n}{e3}\PY{err}{\PYZdl{}}\PY{n+nb}{abs}\PY{err}{\PYZdl{}}\PY{n}{indices} + \PY{n}{i\PYZus{}np} \PY{o}{=} \PY{n}{which}\PY{o}{.}\PY{n}{min}\PY{p}{(}\PY{n}{sum\PYZus{}p123}\PY{p}{)} \PY{c+c1}{\PYZsh{}indice de (veille de) jour \PYZdq{}facile\PYZdq{}} + \PY{n}{i\PYZus{}p} \PY{o}{=} \PY{n}{which}\PY{o}{.}\PY{n}{max}\PY{p}{(}\PY{n}{sum\PYZus{}p123}\PY{p}{)} \PY{c+c1}{\PYZsh{}indice de (veille de) jour \PYZdq{}difficile\PYZdq{}} +\end{Verbatim} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_4_0.png} + \end{center} + { \hspace*{\fill} \\} + + L'erreur absolue dépasse 20 sur 1 à 2 jours suivant les modèles (graphe +en haut à droite). C'est au-delà de ce que l'on aimerait voir (disons ++/- 5 environ). Sur cet exemple le modèle à voisins "contraint" +(local=TRUE) utilisant des pondérations basées sur les similarités de +forme (simtype="endo") obtient en moyenne les meilleurs résultats, avec +un MAPE restant en général inférieur à 30\% de 8h à 19h (7+1 à 7+12 : +graphe en bas à gauche). + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}4}]:} \PY{n}{options}\PY{p}{(}\PY{n+nb}{repr}\PY{o}{.}\PY{n}{plot}\PY{o}{.}\PY{n}{width}\PY{o}{=}\PY{l+m+mi}{9}\PY{p}{,} \PY{n+nb}{repr}\PY{o}{.}\PY{n}{plot}\PY{o}{.}\PY{n}{height}\PY{o}{=}\PY{l+m+mi}{4}\PY{p}{)} + \PY{n}{par}\PY{p}{(}\PY{n}{mfrow}\PY{o}{=}\PY{n}{c}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{)} + + \PY{n}{plotPredReal}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p1}\PY{p}{,} \PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{PredReal p1 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{)} + \PY{n}{plotPredReal}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p1}\PY{p}{,} \PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{PredReal p1 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{)} + + \PY{n}{plotPredReal}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p2}\PY{p}{,} \PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{PredReal p2 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{)} + \PY{n}{plotPredReal}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p2}\PY{p}{,} \PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{PredReal p2 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{)} + + \PY{n}{plotPredReal}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p3}\PY{p}{,} \PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{PredReal p3 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{)} + \PY{n}{plotPredReal}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p3}\PY{p}{,} \PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{PredReal p3 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{)} + + \PY{c+c1}{\PYZsh{} Bleu: prévue, noir: réalisée} +\end{Verbatim} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_6_0.png} + \end{center} + { \hspace*{\fill} \\} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_6_1.png} + \end{center} + { \hspace*{\fill} \\} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_6_2.png} + \end{center} + { \hspace*{\fill} \\} + + Le jour "facile à prévoir", à gauche, se décompose en deux modes : un +léger vers 10h (7+3), puis un beaucoup plus marqué vers 19h (7+12). Ces +deux modes sont retrouvés par les trois variantes de l'algorithme à +voisins, bien que l'amplitude soit mal prédite. Concernant le jour +"difficile à prévoir" il y a deux pics en tout début et toute fin de +journée (à 9h et 23h), qui ne sont pas du tout anticipés par le +programme ; la grande amplitude de ces pics explique alors l'intensité +de l'erreur observée. + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}5}]:} \PY{n}{par}\PY{p}{(}\PY{n}{mfrow}\PY{o}{=}\PY{n}{c}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{)} + \PY{n}{f\PYZus{}np1} \PY{o}{=} \PY{n}{computeFilaments}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p1}\PY{p}{,} \PY{n}{i\PYZus{}np}\PY{p}{,} \PY{n}{plot}\PY{o}{=}\PY{n}{TRUE}\PY{p}{)} + \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Filaments p1 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{)} + \PY{n}{f\PYZus{}p1} \PY{o}{=} \PY{n}{computeFilaments}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p1}\PY{p}{,} \PY{n}{i\PYZus{}p}\PY{p}{,} \PY{n}{plot}\PY{o}{=}\PY{n}{TRUE}\PY{p}{)} + \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Filaments p1 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{)} + + \PY{n}{f\PYZus{}np2} \PY{o}{=} \PY{n}{computeFilaments}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p2}\PY{p}{,} \PY{n}{i\PYZus{}np}\PY{p}{,} \PY{n}{plot}\PY{o}{=}\PY{n}{TRUE}\PY{p}{)} + \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Filaments p2 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{)} + \PY{n}{f\PYZus{}p2} \PY{o}{=} \PY{n}{computeFilaments}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p2}\PY{p}{,} \PY{n}{i\PYZus{}p}\PY{p}{,} \PY{n}{plot}\PY{o}{=}\PY{n}{TRUE}\PY{p}{)} + \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Filaments p2 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{)} +\end{Verbatim} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_8_0.png} + \end{center} + { \hspace*{\fill} \\} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_8_1.png} + \end{center} + { \hspace*{\fill} \\} + + Les voisins du jour courant (période de 24h allant de 8h à 7h le +lendemain) sont affichés avec un trait d'autant plus sombre qu'ils sont +proches. On constate dans le cas non contraint (en haut) une grande +variabilité des lendemains, très nette sur le graphe en haut à droite. +Ceci indique une faible corrélation entre la forme d'une courbe sur une +période de 24h et la forme sur les 24h suivantes ; \textbf{cette +observation est la source des difficultés rencontrées par l'algorithme +sur ce jeu de données.} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}6}]:} \PY{n}{par}\PY{p}{(}\PY{n}{mfrow}\PY{o}{=}\PY{n}{c}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{)} + \PY{n}{plotFilamentsBox}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{f\PYZus{}np1}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{FilBox p1 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{)} + \PY{n}{plotFilamentsBox}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{f\PYZus{}p1}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{FilBox p1 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{)} + + \PY{c+c1}{\PYZsh{} En pointillés la courbe du jour courant + lendemain (à prédire)} +\end{Verbatim} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_10_0.png} + \end{center} + { \hspace*{\fill} \\} + + Sur cette boxplot fonctionnelle (voir la fonction fboxplot() du package +R "rainbow") l'on constate essentiellement deux choses : le lendemain +d'un voisin "normal" peut se révéler être une courbe atypique, fort +éloignée de ce que l'on souhaite prédire (courbes bleue et rouge à +gauche) ; et, dans le cas d'une courbe à prédire atypique (à droite) la +plupart des voisins sont trop éloignés de la forme à prédire et forcent +ainsi un aplatissement de la prédiction. + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}7}]:} \PY{n}{par}\PY{p}{(}\PY{n}{mfrow}\PY{o}{=}\PY{n}{c}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{)} + \PY{n}{plotRelVar}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{f\PYZus{}np1}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{StdDev p1 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{)} + \PY{n}{plotRelVar}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{f\PYZus{}p1}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{StdDev p1 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{)} + + \PY{n}{plotRelVar}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{f\PYZus{}np2}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{StdDev p2 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{)} + \PY{n}{plotRelVar}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{f\PYZus{}p2}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{StdDev p2 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{)} + + \PY{c+c1}{\PYZsh{} Variabilité globale en rouge ; sur les 60 voisins (+ lendemains) en noir} +\end{Verbatim} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_12_0.png} + \end{center} + { \hspace*{\fill} \\} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_12_1.png} + \end{center} + { \hspace*{\fill} \\} + + Ces graphes viennent confirmer l'impression visuelle après observation +des filaments. En effet, la variabilité globale en rouge (écart-type +heure par heure sur l'ensemble des couples "aujourd'hui/lendemain" du +passé) devrait rester nettement au-dessus de la variabilité locale, +calculée respectivement sur un voisinage d'une soixantaine de jours +(pour p1) et d'une dizaine de jours (pour p2). Or on constate que ce +n'est pas du tout le cas sur la période "lendemain", sauf en partie pour +p2 le jour 4 \(-\) mais ce n'est pas suffisant. + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}8}]:} \PY{n}{par}\PY{p}{(}\PY{n}{mfrow}\PY{o}{=}\PY{n}{c}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{)} + \PY{n}{plotSimils}\PY{p}{(}\PY{n}{p1}\PY{p}{,} \PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Weights p1 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{)} + \PY{n}{plotSimils}\PY{p}{(}\PY{n}{p1}\PY{p}{,} \PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Weights p1 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{)} + + \PY{n}{plotSimils}\PY{p}{(}\PY{n}{p2}\PY{p}{,} \PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Weights p2 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{)} + \PY{n}{plotSimils}\PY{p}{(}\PY{n}{p2}\PY{p}{,} \PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Weights p2 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{)} + + \PY{c+c1}{\PYZsh{} \PYZhy{} pollué à gauche, + pollué à droite} +\end{Verbatim} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_14_0.png} + \end{center} + { \hspace*{\fill} \\} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_14_1.png} + \end{center} + { \hspace*{\fill} \\} + + Les poids se concentrent près de 0 dans le cas "non local" (p1), et se +répartissent assez uniformément dans \([0,0.2]\) dans le cas "local" +(p2). C'est ce que l'on souhaite observer pour éviter d'effectuer une +simple moyenne. + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}9}]:} \PY{c+c1}{\PYZsh{} Fenêtres sélectionnées dans ]0,7] / non\PYZhy{}loc 2 premières lignes, loc ensuite} + \PY{n}{p1}\PY{err}{\PYZdl{}}\PY{n}{getParams}\PY{p}{(}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{err}{\PYZdl{}}\PY{n}{window} + \PY{n}{p1}\PY{err}{\PYZdl{}}\PY{n}{getParams}\PY{p}{(}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{err}{\PYZdl{}}\PY{n}{window} + + \PY{n}{p2}\PY{err}{\PYZdl{}}\PY{n}{getParams}\PY{p}{(}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{err}{\PYZdl{}}\PY{n}{window} + \PY{n}{p2}\PY{err}{\PYZdl{}}\PY{n}{getParams}\PY{p}{(}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{err}{\PYZdl{}}\PY{n}{window} +\end{Verbatim} + + \begin{enumerate*} +\item 0.168824188864717 +\item 0.336969608767438 +\end{enumerate*} + + + \begin{enumerate*} +\item 0.18004595760919 +\item 0.353963007643311 +\end{enumerate*} + + + 1.16620655388085 + + + 1.18148881881259 + + + \subsection*{Pollution par épandage} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}10}]:} \PY{n}{p1} \PY{o}{=} \PY{n}{computeForecast}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{indices\PYZus{}ep}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Neighbors}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Neighbors}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{n}{horizon}\PY{o}{=}\PY{n}{H}\PY{p}{,} + \PY{n}{simtype}\PY{o}{=}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{mix}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{n}{local}\PY{o}{=}\PY{n}{FALSE}\PY{p}{)} + \PY{n}{p2} \PY{o}{=} \PY{n}{computeForecast}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{indices\PYZus{}ep}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Neighbors}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Neighbors}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{n}{horizon}\PY{o}{=}\PY{n}{H}\PY{p}{,} + \PY{n}{simtype}\PY{o}{=}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{endo}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{n}{local}\PY{o}{=}\PY{n}{TRUE}\PY{p}{)} + \PY{n}{p3} \PY{o}{=} \PY{n}{computeForecast}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{indices\PYZus{}ep}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Neighbors}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Zero}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{n}{horizon}\PY{o}{=}\PY{n}{H}\PY{p}{,} + \PY{n}{simtype}\PY{o}{=}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{none}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{n}{local}\PY{o}{=}\PY{n}{TRUE}\PY{p}{)} + \PY{n}{p4} \PY{o}{=} \PY{n}{computeForecast}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{indices\PYZus{}ep}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Average}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Zero}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{n}{horizon}\PY{o}{=}\PY{n}{H}\PY{p}{)} + \PY{n}{p5} \PY{o}{=} \PY{n}{computeForecast}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{indices\PYZus{}ep}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Persistence}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Zero}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{n}{horizon}\PY{o}{=}\PY{n}{H}\PY{p}{,} + \PY{n}{same\PYZus{}day}\PY{o}{=}\PY{n}{TRUE}\PY{p}{)} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}11}]:} \PY{n}{e1} \PY{o}{=} \PY{n}{computeError}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p1}\PY{p}{,} \PY{n}{H}\PY{p}{)} + \PY{n}{e2} \PY{o}{=} \PY{n}{computeError}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p2}\PY{p}{,} \PY{n}{H}\PY{p}{)} + \PY{n}{e3} \PY{o}{=} \PY{n}{computeError}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p3}\PY{p}{,} \PY{n}{H}\PY{p}{)} + \PY{n}{e4} \PY{o}{=} \PY{n}{computeError}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p4}\PY{p}{,} \PY{n}{H}\PY{p}{)} + \PY{n}{e5} \PY{o}{=} \PY{n}{computeError}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p5}\PY{p}{,} \PY{n}{H}\PY{p}{)} + \PY{n}{options}\PY{p}{(}\PY{n+nb}{repr}\PY{o}{.}\PY{n}{plot}\PY{o}{.}\PY{n}{width}\PY{o}{=}\PY{l+m+mi}{9}\PY{p}{,} \PY{n+nb}{repr}\PY{o}{.}\PY{n}{plot}\PY{o}{.}\PY{n}{height}\PY{o}{=}\PY{l+m+mi}{7}\PY{p}{)} + \PY{n}{plotError}\PY{p}{(}\PY{n+nb}{list}\PY{p}{(}\PY{n}{e1}\PY{p}{,} \PY{n}{e5}\PY{p}{,} \PY{n}{e4}\PY{p}{,} \PY{n}{e2}\PY{p}{,} \PY{n}{e3}\PY{p}{)}\PY{p}{,} \PY{n}{cols}\PY{o}{=}\PY{n}{c}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{,}\PY{n}{colors}\PY{p}{(}\PY{p}{)}\PY{p}{[}\PY{l+m+mi}{258}\PY{p}{]}\PY{p}{,}\PY{l+m+mi}{4}\PY{p}{,}\PY{l+m+mi}{6}\PY{p}{)}\PY{p}{)} + + \PY{c+c1}{\PYZsh{} noir: Neighbors non\PYZhy{}local (p1), bleu: Neighbors local endo (p2),} + \PY{c+c1}{\PYZsh{} mauve: Neighbors local none (p3), vert: moyenne (p4),} + \PY{c+c1}{\PYZsh{} rouge: persistence (p5)} + + \PY{n}{sum\PYZus{}p123} \PY{o}{=} \PY{n}{e1}\PY{err}{\PYZdl{}}\PY{n+nb}{abs}\PY{err}{\PYZdl{}}\PY{n}{indices} \PY{o}{+} \PY{n}{e2}\PY{err}{\PYZdl{}}\PY{n+nb}{abs}\PY{err}{\PYZdl{}}\PY{n}{indices} \PY{o}{+} \PY{n}{e3}\PY{err}{\PYZdl{}}\PY{n+nb}{abs}\PY{err}{\PYZdl{}}\PY{n}{indices} + \PY{n}{i\PYZus{}np} \PY{o}{=} \PY{n}{which}\PY{o}{.}\PY{n}{min}\PY{p}{(}\PY{n}{sum\PYZus{}p123}\PY{p}{)} \PY{c+c1}{\PYZsh{}indice de (veille de) jour \PYZdq{}facile\PYZdq{}} + \PY{n}{i\PYZus{}p} \PY{o}{=} \PY{n}{which}\PY{o}{.}\PY{n}{max}\PY{p}{(}\PY{n}{sum\PYZus{}p123}\PY{p}{)} \PY{c+c1}{\PYZsh{}indice de (veille de) jour \PYZdq{}difficile\PYZdq{}} +\end{Verbatim} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_19_0.png} + \end{center} + { \hspace*{\fill} \\} + + Il est difficile dans ce cas de déterminer une méthode meilleure que les +autres : elles donnent toutes de plutôt mauvais résultats, avec une +erreur absolue moyennée sur la journée dépassant presque toujours 15 +(graphe en haut à droite). + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}12}]:} \PY{n}{options}\PY{p}{(}\PY{n+nb}{repr}\PY{o}{.}\PY{n}{plot}\PY{o}{.}\PY{n}{width}\PY{o}{=}\PY{l+m+mi}{9}\PY{p}{,} \PY{n+nb}{repr}\PY{o}{.}\PY{n}{plot}\PY{o}{.}\PY{n}{height}\PY{o}{=}\PY{l+m+mi}{4}\PY{p}{)} + \PY{n}{par}\PY{p}{(}\PY{n}{mfrow}\PY{o}{=}\PY{n}{c}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{)} + + \PY{n}{plotPredReal}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p1}\PY{p}{,} \PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{PredReal p1 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{)} + \PY{n}{plotPredReal}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p1}\PY{p}{,} \PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{PredReal p1 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{)} + + \PY{n}{plotPredReal}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p2}\PY{p}{,} \PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{PredReal p2 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{)} + \PY{n}{plotPredReal}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p2}\PY{p}{,} \PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{PredReal p2 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{)} + + \PY{n}{plotPredReal}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p3}\PY{p}{,} \PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{PredReal p3 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{)} + \PY{n}{plotPredReal}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p3}\PY{p}{,} \PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{PredReal p3 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{)} + + \PY{c+c1}{\PYZsh{} Bleu: prévue, noir: réalisée} +\end{Verbatim} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_21_0.png} + \end{center} + { \hspace*{\fill} \\} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_21_1.png} + \end{center} + { \hspace*{\fill} \\} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_21_2.png} + \end{center} + { \hspace*{\fill} \\} + + Dans le cas d'un jour "facile" à prédire \(-\) à gauche \(-\) la forme +est plus ou moins retrouvée, mais le niveau moyen est trop bas (courbe +en bleu). Concernant le jour "difficile" à droite, non seulement la +forme n'est pas anticipée mais surtout le niveau prédit est très +inférieur au niveau de pollution observé. Comme on le voit ci-dessous +cela découle d'un manque de voisins au comportement similaire. + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}13}]:} \PY{n}{par}\PY{p}{(}\PY{n}{mfrow}\PY{o}{=}\PY{n}{c}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{)} + \PY{n}{f\PYZus{}np1} \PY{o}{=} \PY{n}{computeFilaments}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p1}\PY{p}{,} \PY{n}{i\PYZus{}np}\PY{p}{,} \PY{n}{plot}\PY{o}{=}\PY{n}{TRUE}\PY{p}{)} + \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Filaments p1 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{)} + \PY{n}{f\PYZus{}p1} \PY{o}{=} \PY{n}{computeFilaments}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p1}\PY{p}{,} \PY{n}{i\PYZus{}p}\PY{p}{,} \PY{n}{plot}\PY{o}{=}\PY{n}{TRUE}\PY{p}{)} + \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Filaments p1 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{)} + + \PY{n}{f\PYZus{}np2} \PY{o}{=} \PY{n}{computeFilaments}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p2}\PY{p}{,} \PY{n}{i\PYZus{}np}\PY{p}{,} \PY{n}{plot}\PY{o}{=}\PY{n}{TRUE}\PY{p}{)} + \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Filaments p2 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{)} + \PY{n}{f\PYZus{}p2} \PY{o}{=} \PY{n}{computeFilaments}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p2}\PY{p}{,} \PY{n}{i\PYZus{}p}\PY{p}{,} \PY{n}{plot}\PY{o}{=}\PY{n}{TRUE}\PY{p}{)} + \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Filaments p2 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{)} +\end{Verbatim} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_23_0.png} + \end{center} + { \hspace*{\fill} \\} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_23_1.png} + \end{center} + { \hspace*{\fill} \\} + + Les observations sont les mêmes qu'au paragraphe précédent : trop de +variabilité des lendemains (et même des voisins du jour courant). + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}14}]:} \PY{n}{par}\PY{p}{(}\PY{n}{mfrow}\PY{o}{=}\PY{n}{c}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{)} + \PY{n}{plotFilamentsBox}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{f\PYZus{}np1}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{FilBox p1 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{)} + \PY{n}{plotFilamentsBox}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{f\PYZus{}p1}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{FilBox p1 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{)} + + \PY{c+c1}{\PYZsh{} En pointillés la courbe du jour courant + lendemain (à prédire)} +\end{Verbatim} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_25_0.png} + \end{center} + { \hspace*{\fill} \\} + + On constate la présence d'un voisin au lendemain complètement atypique +avec un pic en début de journée (courbe en vert à gauche), et d'un autre +phénomène semblable avec la courbe rouge sur le graphe de droite. Ajouté +au fait que le lendemain à prévoir est lui-même un jour "hors norme", +cela montre l'impossibilité de bien prévoir une courbe en utilisant +l'algorithme à voisins. + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}15}]:} \PY{n}{par}\PY{p}{(}\PY{n}{mfrow}\PY{o}{=}\PY{n}{c}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{)} + \PY{n}{plotRelVar}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{f\PYZus{}np1}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{StdDev p1 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{)} + \PY{n}{plotRelVar}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{f\PYZus{}p1}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{StdDev p1 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{)} + + \PY{n}{plotRelVar}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{f\PYZus{}np2}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{StdDev p2 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{)} + \PY{n}{plotRelVar}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{f\PYZus{}p2}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{StdDev p2 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{)} + + \PY{c+c1}{\PYZsh{} Variabilité globale en rouge ; sur les 60 voisins (+ lendemains) en noir} +\end{Verbatim} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_27_0.png} + \end{center} + { \hspace*{\fill} \\} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_27_1.png} + \end{center} + { \hspace*{\fill} \\} + + Comme précédemment les variabilités locales et globales sont confondues +dans les parties droites des graphes \(-\) sauf pour la version "locale" +sur le jour "facile" ; mais cette bonne propriété n'est pas suffisante +si l'on ne trouve pas les bons poids à appliquer. + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}16}]:} \PY{n}{par}\PY{p}{(}\PY{n}{mfrow}\PY{o}{=}\PY{n}{c}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{)} + \PY{n}{plotSimils}\PY{p}{(}\PY{n}{p1}\PY{p}{,} \PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Weights p1 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{)} + \PY{n}{plotSimils}\PY{p}{(}\PY{n}{p1}\PY{p}{,} \PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Weights p1 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{)} + + \PY{n}{plotSimils}\PY{p}{(}\PY{n}{p2}\PY{p}{,} \PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Weights p2 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{)} + \PY{n}{plotSimils}\PY{p}{(}\PY{n}{p2}\PY{p}{,} \PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Weights p2 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{)} + + \PY{c+c1}{\PYZsh{} \PYZhy{} pollué à gauche, + pollué à droite} +\end{Verbatim} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_29_0.png} + \end{center} + { \hspace*{\fill} \\} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_29_1.png} + \end{center} + { \hspace*{\fill} \\} + + En comparaison avec le pragraphe précédent on retrouve le même (bon) +comportement des poids pour la version "non locale". En revanche la +fenêtre optimisée est trop grande sur le jour "facile" pour la méthode +"locale" (voir affichage ci-dessous) : il en résulte des poids tous +semblables autour de 0.084, l'algorithme effectue donc une moyenne +simple \(-\) expliquant pourquoi les courbes mauve et bleue sont très +proches sur le graphe d'erreurs. + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}17}]:} \PY{c+c1}{\PYZsh{} Fenêtres sélectionnées dans ]0,7] / non\PYZhy{}loc 2 premières lignes, loc ensuite} + \PY{n}{p1}\PY{err}{\PYZdl{}}\PY{n}{getParams}\PY{p}{(}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{err}{\PYZdl{}}\PY{n}{window} + \PY{n}{p1}\PY{err}{\PYZdl{}}\PY{n}{getParams}\PY{p}{(}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{err}{\PYZdl{}}\PY{n}{window} + + \PY{n}{p2}\PY{err}{\PYZdl{}}\PY{n}{getParams}\PY{p}{(}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{err}{\PYZdl{}}\PY{n}{window} + \PY{n}{p2}\PY{err}{\PYZdl{}}\PY{n}{getParams}\PY{p}{(}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{err}{\PYZdl{}}\PY{n}{window} +\end{Verbatim} + + \begin{enumerate*} +\item 0.206604806619633 +\item 0.661854053860987 +\end{enumerate*} + + + \begin{enumerate*} +\item 0.367945958636072 +\item 0.244429852740092 +\end{enumerate*} + + + 6.99993248587025 + + + 1.24825506305085 + + + \subsection*{Semaine non polluée} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}18}]:} \PY{n}{p1} \PY{o}{=} \PY{n}{computeForecast}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{indices\PYZus{}np}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Neighbors}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Neighbors}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{n}{horizon}\PY{o}{=}\PY{n}{H}\PY{p}{,} + \PY{n}{simtype}\PY{o}{=}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{mix}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{n}{local}\PY{o}{=}\PY{n}{FALSE}\PY{p}{)} + \PY{n}{p2} \PY{o}{=} \PY{n}{computeForecast}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{indices\PYZus{}np}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Neighbors}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Neighbors}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{n}{horizon}\PY{o}{=}\PY{n}{H}\PY{p}{,} + \PY{n}{simtype}\PY{o}{=}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{endo}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{n}{local}\PY{o}{=}\PY{n}{TRUE}\PY{p}{)} + \PY{n}{p3} \PY{o}{=} \PY{n}{computeForecast}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{indices\PYZus{}np}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Neighbors}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Zero}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{n}{horizon}\PY{o}{=}\PY{n}{H}\PY{p}{,} + \PY{n}{simtype}\PY{o}{=}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{none}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{n}{local}\PY{o}{=}\PY{n}{TRUE}\PY{p}{)} + \PY{n}{p4} \PY{o}{=} \PY{n}{computeForecast}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{indices\PYZus{}np}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Average}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Zero}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{n}{horizon}\PY{o}{=}\PY{n}{H}\PY{p}{)} + \PY{n}{p5} \PY{o}{=} \PY{n}{computeForecast}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{indices\PYZus{}np}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Persistence}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Zero}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,} \PY{n}{horizon}\PY{o}{=}\PY{n}{H}\PY{p}{,} + \PY{n}{same\PYZus{}day}\PY{o}{=}\PY{n}{FALSE}\PY{p}{)} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}19}]:} \PY{n}{e1} \PY{o}{=} \PY{n}{computeError}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p1}\PY{p}{,} \PY{n}{H}\PY{p}{)} + \PY{n}{e2} \PY{o}{=} \PY{n}{computeError}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p2}\PY{p}{,} \PY{n}{H}\PY{p}{)} + \PY{n}{e3} \PY{o}{=} \PY{n}{computeError}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p3}\PY{p}{,} \PY{n}{H}\PY{p}{)} + \PY{n}{e4} \PY{o}{=} \PY{n}{computeError}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p4}\PY{p}{,} \PY{n}{H}\PY{p}{)} + \PY{n}{e5} \PY{o}{=} \PY{n}{computeError}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p5}\PY{p}{,} \PY{n}{H}\PY{p}{)} + \PY{n}{options}\PY{p}{(}\PY{n+nb}{repr}\PY{o}{.}\PY{n}{plot}\PY{o}{.}\PY{n}{width}\PY{o}{=}\PY{l+m+mi}{9}\PY{p}{,} \PY{n+nb}{repr}\PY{o}{.}\PY{n}{plot}\PY{o}{.}\PY{n}{height}\PY{o}{=}\PY{l+m+mi}{7}\PY{p}{)} + \PY{n}{plotError}\PY{p}{(}\PY{n+nb}{list}\PY{p}{(}\PY{n}{e1}\PY{p}{,} \PY{n}{e5}\PY{p}{,} \PY{n}{e4}\PY{p}{,} \PY{n}{e2}\PY{p}{,} \PY{n}{e3}\PY{p}{)}\PY{p}{,} \PY{n}{cols}\PY{o}{=}\PY{n}{c}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{,}\PY{n}{colors}\PY{p}{(}\PY{p}{)}\PY{p}{[}\PY{l+m+mi}{258}\PY{p}{]}\PY{p}{,}\PY{l+m+mi}{4}\PY{p}{,}\PY{l+m+mi}{6}\PY{p}{)}\PY{p}{)} + + \PY{c+c1}{\PYZsh{} noir: Neighbors non\PYZhy{}local (p1), bleu: Neighbors local endo (p2),} + \PY{c+c1}{\PYZsh{} mauve: Neighbors local none (p3), vert: moyenne (p4),} + \PY{c+c1}{\PYZsh{} rouge: persistence (p5)} + + \PY{n}{sum\PYZus{}p123} \PY{o}{=} \PY{n}{e1}\PY{err}{\PYZdl{}}\PY{n+nb}{abs}\PY{err}{\PYZdl{}}\PY{n}{indices} \PY{o}{+} \PY{n}{e2}\PY{err}{\PYZdl{}}\PY{n+nb}{abs}\PY{err}{\PYZdl{}}\PY{n}{indices} \PY{o}{+} \PY{n}{e3}\PY{err}{\PYZdl{}}\PY{n+nb}{abs}\PY{err}{\PYZdl{}}\PY{n}{indices} + \PY{n}{i\PYZus{}np} \PY{o}{=} \PY{n}{which}\PY{o}{.}\PY{n}{min}\PY{p}{(}\PY{n}{sum\PYZus{}p123}\PY{p}{)} \PY{c+c1}{\PYZsh{}indice de (veille de) jour \PYZdq{}facile\PYZdq{}} + \PY{n}{i\PYZus{}p} \PY{o}{=} \PY{n}{which}\PY{o}{.}\PY{n}{max}\PY{p}{(}\PY{n}{sum\PYZus{}p123}\PY{p}{)} \PY{c+c1}{\PYZsh{}indice de (veille de) jour \PYZdq{}difficile\PYZdq{}} +\end{Verbatim} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_34_0.png} + \end{center} + { \hspace*{\fill} \\} + + Dans ce cas plus favorable les intensité des erreurs absolues ont +clairement diminué : elles restent souvent en dessous de 5. En revanche +le MAPE moyen reste au-delà de 20\%, et même souvent plus de 30\%. Comme +dans le cas de l'épandage on constate une croissance globale de la +courbe journalière d'erreur absolue moyenne (en haut à gauche) ; ceci +peut être dû au fait que l'on ajuste le niveau du jour à prédire en le +recollant sur la dernière valeur observée. + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}20}]:} \PY{n}{options}\PY{p}{(}\PY{n+nb}{repr}\PY{o}{.}\PY{n}{plot}\PY{o}{.}\PY{n}{width}\PY{o}{=}\PY{l+m+mi}{9}\PY{p}{,} \PY{n+nb}{repr}\PY{o}{.}\PY{n}{plot}\PY{o}{.}\PY{n}{height}\PY{o}{=}\PY{l+m+mi}{4}\PY{p}{)} + \PY{n}{par}\PY{p}{(}\PY{n}{mfrow}\PY{o}{=}\PY{n}{c}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{)} + + \PY{n}{plotPredReal}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p1}\PY{p}{,} \PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{PredReal p1 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{)} + \PY{n}{plotPredReal}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p1}\PY{p}{,} \PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{PredReal p1 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{)} + + \PY{n}{plotPredReal}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p2}\PY{p}{,} \PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{PredReal p2 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{)} + \PY{n}{plotPredReal}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p2}\PY{p}{,} \PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{PredReal p2 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{)} + + \PY{n}{plotPredReal}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p3}\PY{p}{,} \PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{PredReal p3 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{)} + \PY{n}{plotPredReal}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p3}\PY{p}{,} \PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{PredReal p3 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{)} + + \PY{c+c1}{\PYZsh{} Bleu: prévue, noir: réalisée} +\end{Verbatim} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_36_0.png} + \end{center} + { \hspace*{\fill} \\} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_36_1.png} + \end{center} + { \hspace*{\fill} \\} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_36_2.png} + \end{center} + { \hspace*{\fill} \\} + + La forme est raisonnablement retrouvée pour les méthodes "locales", +l'autre version lissant trop les prédictions. Le biais reste cependant +important, surtout en fin de journée sur le jour "difficile". + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}21}]:} \PY{n}{par}\PY{p}{(}\PY{n}{mfrow}\PY{o}{=}\PY{n}{c}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{)} + \PY{n}{f\PYZus{}np1} \PY{o}{=} \PY{n}{computeFilaments}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p1}\PY{p}{,} \PY{n}{i\PYZus{}np}\PY{p}{,} \PY{n}{plot}\PY{o}{=}\PY{n}{TRUE}\PY{p}{)} + \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Filaments p1 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{)} + \PY{n}{f\PYZus{}p1} \PY{o}{=} \PY{n}{computeFilaments}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p1}\PY{p}{,} \PY{n}{i\PYZus{}p}\PY{p}{,} \PY{n}{plot}\PY{o}{=}\PY{n}{TRUE}\PY{p}{)} + \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Filaments p1 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{)} + + \PY{n}{f\PYZus{}np2} \PY{o}{=} \PY{n}{computeFilaments}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p2}\PY{p}{,} \PY{n}{i\PYZus{}np}\PY{p}{,} \PY{n}{plot}\PY{o}{=}\PY{n}{TRUE}\PY{p}{)} + \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Filaments p2 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{)} + \PY{n}{f\PYZus{}p2} \PY{o}{=} \PY{n}{computeFilaments}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{p2}\PY{p}{,} \PY{n}{i\PYZus{}p}\PY{p}{,} \PY{n}{plot}\PY{o}{=}\PY{n}{TRUE}\PY{p}{)} + \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Filaments p2 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{)} +\end{Verbatim} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_38_0.png} + \end{center} + { \hspace*{\fill} \\} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_38_1.png} + \end{center} + { \hspace*{\fill} \\} + + Les graphes de filaments ont encore la même allure, avec une assez +grande variabilité observée. Cette observation est cependant trompeuse, +comme l'indique plus bas le graphe de variabilité relative. + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}22}]:} \PY{n}{par}\PY{p}{(}\PY{n}{mfrow}\PY{o}{=}\PY{n}{c}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{)} + \PY{n}{plotFilamentsBox}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{f\PYZus{}np1}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{FilBox p1 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{)} + \PY{n}{plotFilamentsBox}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{f\PYZus{}p1}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{FilBox p1 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{)} + + \PY{c+c1}{\PYZsh{} En pointillés la courbe du jour courant + lendemain (à prédire)} +\end{Verbatim} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_40_0.png} + \end{center} + { \hspace*{\fill} \\} + + On peut réappliquer les mêmes remarques qu'auparavant sur les boxplots +fonctionnels : lendemains de voisins atypiques, courbe à prévoir +elle-même légèrement "hors norme". + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}23}]:} \PY{n}{par}\PY{p}{(}\PY{n}{mfrow}\PY{o}{=}\PY{n}{c}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{)} + \PY{n}{plotRelVar}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{f\PYZus{}np1}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{StdDev p1 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{)} + \PY{n}{plotRelVar}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{f\PYZus{}p1}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{StdDev p1 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{)} + + \PY{n}{plotRelVar}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{f\PYZus{}np2}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{StdDev p2 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{)} + \PY{n}{plotRelVar}\PY{p}{(}\PY{n}{data}\PY{p}{,} \PY{n}{f\PYZus{}p2}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{StdDev p2 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{)} + + \PY{c+c1}{\PYZsh{} Variabilité globale en rouge ; sur les 60 voisins (+ lendemains) en noir} +\end{Verbatim} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_42_0.png} + \end{center} + { \hspace*{\fill} \\} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_42_1.png} + \end{center} + { \hspace*{\fill} \\} + + Cette fois la situation idéale est observée : la variabilité globale est +nettement au-dessus de la variabilité locale. Bien que cela ne suffise +pas à obtenir de bonnes prédictions de forme, on constate au moins +l'amélioration dans la prédiction du niveau. + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}24}]:} \PY{n}{par}\PY{p}{(}\PY{n}{mfrow}\PY{o}{=}\PY{n}{c}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{)} + \PY{n}{plotSimils}\PY{p}{(}\PY{n}{p1}\PY{p}{,} \PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Weights p1 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{)} + \PY{n}{plotSimils}\PY{p}{(}\PY{n}{p1}\PY{p}{,} \PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Weights p1 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{)} + + \PY{n}{plotSimils}\PY{p}{(}\PY{n}{p2}\PY{p}{,} \PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Weights p2 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{p}{)} + \PY{n}{plotSimils}\PY{p}{(}\PY{n}{p2}\PY{p}{,} \PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{;} \PY{n}{title}\PY{p}{(}\PY{n}{paste}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Weights p2 day}\PY{l+s+s2}{\PYZdq{}}\PY{p}{,}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{p}{)} + + \PY{c+c1}{\PYZsh{} \PYZhy{} pollué à gauche, + pollué à droite} +\end{Verbatim} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_44_0.png} + \end{center} + { \hspace*{\fill} \\} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_44_1.png} + \end{center} + { \hspace*{\fill} \\} + + Concernant les poids en revanche, deux cas a priori mauvais se cumulent +: * les poids dans le cas "non local" ne sont pas assez concentrés +autour de 0, menant à un lissage trop fort \(-\) comme observé sur les +graphes des courbes réalisées/prévues ; * les poids dans le cas "local" +sont trop semblables (à cause de la trop grande fenêtre optimisée par +validation croisée, cf. ci-dessous), résultant encore en une moyenne +simple \(-\) mais sur moins de jours, plus proches du jour courant. + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}25}]:} \PY{c+c1}{\PYZsh{} Fenêtres sélectionnées dans ]0,7] / non\PYZhy{}loc 2 premières lignes, loc ensuite} + \PY{n}{p1}\PY{err}{\PYZdl{}}\PY{n}{getParams}\PY{p}{(}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{err}{\PYZdl{}}\PY{n}{window} + \PY{n}{p1}\PY{err}{\PYZdl{}}\PY{n}{getParams}\PY{p}{(}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{err}{\PYZdl{}}\PY{n}{window} + + \PY{n}{p2}\PY{err}{\PYZdl{}}\PY{n}{getParams}\PY{p}{(}\PY{n}{i\PYZus{}np}\PY{p}{)}\PY{err}{\PYZdl{}}\PY{n}{window} + \PY{n}{p2}\PY{err}{\PYZdl{}}\PY{n}{getParams}\PY{p}{(}\PY{n}{i\PYZus{}p}\PY{p}{)}\PY{err}{\PYZdl{}}\PY{n}{window} +\end{Verbatim} + + \begin{enumerate*} +\item 0.205055690975915 +\item 0.703482647754766 +\end{enumerate*} + + + \begin{enumerate*} +\item 1.1038650998802 +\item 0.885155748316133 +\end{enumerate*} + + + 3.64336124381868 + + + 6.99994501761361 + + + \subsection*{Bilan} + +Nos algorithmes à voisins ne sont pas adaptés à ce jeu de données où la +forme varie considérablement d'un jour à l'autre. Plus généralement +cette décorrélation de forme rend ardue la tâche de prévision pour toute +autre méthode \(-\) du moins, nous ne savons pas comment procéder pour +parvenir à une bonne précision. + +Toutefois, un espoir reste permis par exemple en aggréger les courbes +spatialement (sur plusieurs stations situées dans la même agglomération +ou dans une même zone). + + + % Add a bibliography block to the postdoc + + + + \end{document}