From 689aa1d3c58e8b1e9fdfa9b895ca38c7228f56cc Mon Sep 17 00:00:00 2001 From: Benjamin Auder Date: Fri, 14 Apr 2017 12:23:33 +0200 Subject: [PATCH] 'update' --- .gitignore | 1 + AirNormand.zip | 1 + Untitled.tex | 468 ++++++++++++++++++++++++ pkg/R/Data.R | 2 + pkg/R/F_Average.R | 2 + pkg/R/F_Neighbors.R | 36 +- pkg/R/F_Persistence.R | 2 + pkg/R/F_Zero.R | 2 + pkg/R/Forecast.R | 2 + pkg/R/Forecaster.R | 2 + pkg/R/utils.R | 16 +- reports/rapport_final/report_P7_H17.tex | 1 + 12 files changed, 510 insertions(+), 25 deletions(-) create mode 100644 AirNormand.zip create mode 100644 Untitled.tex diff --git a/.gitignore b/.gitignore index 92a17ad..7b5eb35 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,7 @@ data/*.csv #misc *.png #*.tex +/AirNormand/ #.gitattributes/.gitfat files are generated by initialize.sh .gitattributes diff --git a/AirNormand.zip b/AirNormand.zip new file mode 100644 index 0000000..99fb2d0 --- /dev/null +++ b/AirNormand.zip @@ -0,0 +1 @@ +#$# git-fat cf4cf6c03e09a9aa2374a7250d21ce732c923e1e 49845703 diff --git a/Untitled.tex b/Untitled.tex new file mode 100644 index 0000000..fe2c0eb --- /dev/null +++ b/Untitled.tex @@ -0,0 +1,468 @@ + +% 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{Untitled} + + + + + % 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{Package R "talweg"}\label{package-r-talweg} + +Le package \(-\) Time-series sAmpLes forecasted With ExoGenous variables +\(-\) contient le code permettant de (re)lancer les expériences +numériques décrites dans cette partie et la suivante. Les fonctions +principales sont respectivement * \textbf{getData()} pour construire un +objet R contenant les données à partir de fichiers CSV (extraits de +bases de données). Le format choisi en R est une classe R6 (du package +du même nom) exposant en particulier les méthodes \emph{getSerie(i)} et +\emph{getExo(i)} qui renvoient respectivement la \(i^{eme}\) série de +24h et les variables exogènes (mesurées) correspondantes. Voir ?Data +pour plus d'information, une fois le package chargé. * +\textbf{computeForecast()} pour calculer des prédictions sur une +certaine plage temporelle contenue dans \emph{data \textless{}- +getData(...)} * \textbf{computeError()} pour évaluer les erreurs +commises par différentes méthodes. + +Le package contient en outre diverses fonctions graphiques +\emph{plotXXX()}, utilisées dans la partie suivante. + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}3}]:} \PY{c+c1}{\PYZsh{} Chargement de la librairie (après compilation, \PYZdq{}R CMD INSTALL .\PYZdq{})} + \PY{k+kn}{library}\PY{p}{(}talweg\PY{p}{)} + + \PY{c+c1}{\PYZsh{} Acquisition des données (depuis les fichiers CSV)} + ts\PYZus{}data \PY{o}{\PYZlt{}\PYZhy{}} read.csv\PY{p}{(}\PY{k+kp}{system.file}\PY{p}{(}\PY{l+s}{\PYZdq{}}\PY{l+s}{extdata\PYZdq{}}\PY{p}{,}\PY{l+s}{\PYZdq{}}\PY{l+s}{pm10\PYZus{}mesures\PYZus{}H\PYZus{}loc.csv\PYZdq{}}\PY{p}{,}package\PY{o}{=}\PY{l+s}{\PYZdq{}}\PY{l+s}{talweg\PYZdq{}}\PY{p}{)}\PY{p}{)} + exo\PYZus{}data \PY{o}{\PYZlt{}\PYZhy{}} read.csv\PY{p}{(}\PY{k+kp}{system.file}\PY{p}{(}\PY{l+s}{\PYZdq{}}\PY{l+s}{extdata\PYZdq{}}\PY{p}{,}\PY{l+s}{\PYZdq{}}\PY{l+s}{meteo\PYZus{}extra\PYZus{}noNAs.csv\PYZdq{}}\PY{p}{,}package\PY{o}{=}\PY{l+s}{\PYZdq{}}\PY{l+s}{talweg\PYZdq{}}\PY{p}{)}\PY{p}{)} + data \PY{o}{\PYZlt{}\PYZhy{}} getData\PY{p}{(}ts\PYZus{}data\PY{p}{,} exo\PYZus{}data\PY{p}{,} input\PYZus{}tz\PY{o}{=}\PY{l+s}{\PYZdq{}}\PY{l+s}{GMT\PYZdq{}}\PY{p}{,} date\PYZus{}format\PY{o}{=}\PY{l+s}{\PYZdq{}}\PY{l+s}{\PYZpc{}d/\PYZpc{}m/\PYZpc{}Y \PYZpc{}H:\PYZpc{}M\PYZdq{}}\PY{p}{,} + working\PYZus{}tz\PY{o}{=}\PY{l+s}{\PYZdq{}}\PY{l+s}{GMT\PYZdq{}}\PY{p}{,} predict\PYZus{}at\PY{o}{=}\PY{l+m}{7}\PY{p}{,} limit\PY{o}{=}\PY{l+m}{120}\PY{p}{)} + \PY{c+c1}{\PYZsh{} Plus de détails à la section 1 ci\PYZhy{}après.} + + \PY{c+c1}{\PYZsh{} Prédiction de 10 courbes (jours 102 à 111)} + pred \PY{o}{\PYZlt{}\PYZhy{}} computeForecast\PY{p}{(}data\PY{p}{,} \PY{l+m}{101}\PY{o}{:}\PY{l+m}{110}\PY{p}{,} \PY{l+s}{\PYZdq{}}\PY{l+s}{Persistence\PYZdq{}}\PY{p}{,} \PY{l+s}{\PYZdq{}}\PY{l+s}{Zero\PYZdq{}}\PY{p}{,} memory\PY{o}{=}\PY{l+m}{50}\PY{p}{,} horizon\PY{o}{=}\PY{l+m}{12}\PY{p}{,} ncores\PY{o}{=}\PY{l+m}{1}\PY{p}{)} + \PY{c+c1}{\PYZsh{} Plus de détails à la section 2 ci\PYZhy{}après.} + + \PY{c+c1}{\PYZsh{} Calcul des erreurs (sur un horizon arbitraire \PYZlt{}= horizon de prédiction)} + err \PY{o}{\PYZlt{}\PYZhy{}} computeError\PY{p}{(}data\PY{p}{,} pred\PY{p}{,} horizon\PY{o}{=}\PY{l+m}{6}\PY{p}{)} + \PY{c+c1}{\PYZsh{} Plus de détails à la section 3 ci\PYZhy{}après.} + + \PY{c+c1}{\PYZsh{} Puis voir ?plotError et les autres plot dans le paragraphe \PYZsq{}seealso\PYZsq{}} +\end{Verbatim} + + \subsubsection{getData()}\label{getdata} + +Les arguments de cette fonction sont, dans l'ordre : 1. +\textbf{ts\_data} : séries temporelles (fichier CSV avec entête ou +data.frame) ; la première colonne contient les heures, la seconde les +valeurs. 2. \textbf{exo\_data} : variables exogènes (fichier CSV avec +entête ou data.frame) ; la première colonne contient les jours, les +\(m\) suivantes les variables mesurées pour ce jour, et les \(m\) +dernières les variables prédites pour ce même jour. Dans notre cas +\(m=4\) : pression, température, gradient de température, vitesse du +vent. 3. \textbf{input\_tz} : zone horaire pour ts\_data (défaut : +"GMT"). 4. \textbf{date\_format} : format des heures dans ts\_data +(défaut : "\%d/\%m/\%Y \%H:\%M", format du fichier transmis par Michel). +5. \textbf{working\_tz} : zone horaire dans laquelle on souhaite +travailler avec les données (défaut : "GMT"). 6. \textbf{predict\_at} : +heure à laquelle s'effectue la prévision \(-\) et donc dernière heure +d'un bloc de 24h, relativement à working\_tz. data\texttt{\$}getSerie(3) +renvoit ainsi les 24 valeurs de 8h à 7h pour le \(3^{eme}\) bloc de 24h +présent dans le jeu de données. + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}11}]:} \PY{k+kp}{print}\PY{p}{(}data\PY{p}{)} + \PY{c+c1}{\PYZsh{}?Data} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] + + Public: + append: function (time, serie, exo, exo\_hat) + clone: function (deep = FALSE) + getCenteredSerie: function (index) + getCenteredSeries: function (indices) + getExo: function (index) + getExoHat: function (index) + getLevel: function (index) + getSerie: function (index) + getSeries: function (indices) + getSize: function () + getStdHorizon: function () + getTime: function (index) + removeFirst: function () + removeLast: function () + Private: + .data: list + + \end{Verbatim} + + \subsubsection{computeForecast()}\label{computeforecast} + +Les arguments de cette fonction sont, dans l'ordre : 1. \textbf{data} : +le jeu de données renvoyé par getData() 2. \textbf{indices} : l'ensemble +de jours dont on veut prévoir les "lendemains" (prochains blocs de 24h) +; peut être donnée sous forme d'un vecteur de dates ou d'entiers +(correspondants aux numéros des jours). 3. \textbf{forecaster} : le nom +du prédicteur principal à utiliser ; voir ?computeForecast 4. +\textbf{pjump} : le nom du prédicteur de saut d'une série à l'autre ; +voir ?computeForecast 5. \textbf{memory} : le nombre de jours à prendre +en compte dans le passé pour chaque prévision (par défaut : Inf, +c'est-à-dire tout l'historique pris en compte). 6. \textbf{horizon} : le +nombre d'heures à prédire ; par défaut "data\texttt{\$}getStdHorizon()", +c'est-à-dire le nombre d'heures restantes à partir de l'instant de +prévision + 1 jusqu'à minuit (17 pour predict\_at=7 par exemple). 7. +\textbf{ncores} : le nombre de processus parallèles (utiliser 1 pour une +exécution séquentielle) + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}8}]:} \PY{k+kp}{print}\PY{p}{(}pred\PY{p}{)} + \PY{c+c1}{\PYZsh{}?computeForecast} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] + + Public: + append: function (forecast, params, index\_in\_data) + clone: function (deep = FALSE) + getDates: function () + getForecast: function (index) + getIndexInData: function (index) + getParams: function (index) + getSize: function () + initialize: function (dates) + Private: + .dates: 14323 14324 14325 14326 14327 14328 14329 14330 14331 14332 + .pred: list + + \end{Verbatim} + + \subsubsection{computeError()}\label{computeerror} + +Les arguments de cette fonction sont, dans l'ordre : 1. \textbf{data} : +le jeu de données renvoyé par getData() 2. \textbf{pred} : les +prédictions renvoyées par computeForecast() 3. \textbf{horizon} : le +nombre d'heures à considérer pour le calcul de l'erreur ; doit être +inférieur ou égal à l'horizon utilisé pour la prédiction (même valeur +par défaut : "data\texttt{\$}getStdHorizon()") + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}9}]:} \PY{k+kp}{summary}\PY{p}{(}err\PY{p}{)} + \PY{k+kp}{summary}\PY{p}{(}err\PY{o}{\PYZdl{}}\PY{k+kp}{abs}\PY{p}{)} + \PY{k+kp}{summary}\PY{p}{(}err\PY{o}{\PYZdl{}}MAPE\PY{p}{)} +\end{Verbatim} + + + \begin{verbatim} + Length Class Mode +abs 2 -none- list +MAPE 2 -none- list + \end{verbatim} + + + + \begin{verbatim} + Length Class Mode +day 6 -none- numeric +indices 10 -none- numeric + \end{verbatim} + + + + \begin{verbatim} + Length Class Mode +day 6 -none- numeric +indices 10 -none- numeric + \end{verbatim} + + + \subsubsection{Graphiques}\label{graphiques} + +Voir ?plotError : les autres fonctions graphiques sont dans la section +'seealso' : + +\begin{verbatim} + ‘plotCurves’, ‘plotPredReal’, ‘plotSimils’, ‘plotFbox’, + ‘computeFilaments’, ‘plotFilamentsBox’, ‘plotRelVar’ +\end{verbatim} + +?plotXXX, etc. + + + % Add a bibliography block to the postdoc + + + + \end{document} diff --git a/pkg/R/Data.R b/pkg/R/Data.R index 92ba2c1..3820d57 100644 --- a/pkg/R/Data.R +++ b/pkg/R/Data.R @@ -9,6 +9,8 @@ #' \code{getTime()} below. Each cell .data[[i]] is itself a list containing five slots, #' as described in the 'field' section. #' +#' @usage data <- Data$new() +#' #' @field .data[[i]] List of #' \itemize{ #' \item time: vector of times diff --git a/pkg/R/F_Average.R b/pkg/R/F_Average.R index 8f81747..a1f29ad 100644 --- a/pkg/R/F_Average.R +++ b/pkg/R/F_Average.R @@ -7,6 +7,8 @@ #' averaged to provide a smooth prediction. This forecast will most of the time be wrong, #' but will also look plausible enough. #' +#' @usage f <- AverageForecaster$new(pjump) +#' #' @docType class #' @format R6 class, inherits Forecaster #' @aliases F_Average diff --git a/pkg/R/F_Neighbors.R b/pkg/R/F_Neighbors.R index 32d5cff..51b5730 100644 --- a/pkg/R/F_Neighbors.R +++ b/pkg/R/F_Neighbors.R @@ -28,6 +28,8 @@ #' obtain the final prediction. #' } #' +#' @usage f <- NeighborsForecaster$new(pjump) +#' #' @docType class #' @format R6 class, inherits Forecaster #' @aliases F_Neighbors @@ -216,16 +218,16 @@ NeighborsForecaster = R6::R6Class("NeighborsForecaster", ) ) -#' getConstrainedNeighbs -#' -#' Get indices of neighbors of similar pollution level (among same season + day type). -#' -#' @param today Index of current day -#' @param data Object of class Data -#' @param fdays Current set of "first days" (no-NA pairs) -#' @param min_neighbs Minimum number of points in a neighborhood -#' @param max_neighbs Maximum number of points in a neighborhood -#' +# getConstrainedNeighbs +# +# Get indices of neighbors of similar pollution level (among same season + day type). +# +# @param today Index of current day +# @param data Object of class Data +# @param fdays Current set of "first days" (no-NA pairs) +# @param min_neighbs Minimum number of points in a neighborhood +# @param max_neighbs Maximum number of points in a neighborhood +# .getConstrainedNeighbs = function(today, data, fdays, min_neighbs=10, max_neighbs=12) { levelToday = data$getLevel(today) @@ -252,13 +254,13 @@ NeighborsForecaster = R6::R6Class("NeighborsForecaster", fdays } -#' compute similarities -#' -#' Apply the gaussian kernel on computed squared distances. -#' -#' @param distances2 Squared distances -#' @param window Window parameter for the kernel -#' +# compute similarities +# +# Apply the gaussian kernel on computed squared distances. +# +# @param distances2 Squared distances +# @param window Window parameter for the kernel +# .computeSimils <- function(distances2, window) { sd_dist = sd(distances2) diff --git a/pkg/R/F_Persistence.R b/pkg/R/F_Persistence.R index fa5f99f..3eefa5b 100644 --- a/pkg/R/F_Persistence.R +++ b/pkg/R/F_Persistence.R @@ -8,6 +8,8 @@ #' If the last similar day has missing values, the next one is searched, and so on until #' one full serie is found (if no one is found, NA is returned). #' +#' @usage f <- PersistenceForecaster$new(pjump) +#' #' @docType class #' @format R6 class, inherits Forecaster #' @aliases F_Persistence diff --git a/pkg/R/F_Zero.R b/pkg/R/F_Zero.R index 2c9a7b7..dae43e8 100644 --- a/pkg/R/F_Zero.R +++ b/pkg/R/F_Zero.R @@ -3,6 +3,8 @@ #' Flat prediction: always forecast a serie of zeros. #' This serie is then adjusted using the ".pjump" function (see \code{Forecaster} class). #' +#' @usage f <- ZeroForecaster$new(pjump) +#' #' @docType class #' @format R6 class, inherits Forecaster #' @aliases F_Zero diff --git a/pkg/R/Forecast.R b/pkg/R/Forecast.R index 6036daf..bb665bd 100644 --- a/pkg/R/Forecast.R +++ b/pkg/R/Forecast.R @@ -9,6 +9,8 @@ #' Each cell .pred[[i]] is itself a list containing three slots, as described in the #' 'field' section. #' +#' @usage f <- Forecast$new(dates) +#' #' @field .pred List with #' \itemize{ #' \item serie: the forecasted serie diff --git a/pkg/R/Forecaster.R b/pkg/R/Forecaster.R index 2efa9ba..ce1bb35 100644 --- a/pkg/R/Forecaster.R +++ b/pkg/R/Forecaster.R @@ -9,6 +9,8 @@ #' serie, and then calls the "jump prediction" function -- see "field" section -- to #' adjust it based on the last observed values. #' +#' @usage f <- Forecaster$new(pjump) #warning: predictShape() is unimplemented +#' #' @field .params List of computed parameters (if applicable). #' @field .pjump Function: how to predict the jump at day interface? The arguments of #' this function are -- in this order: diff --git a/pkg/R/utils.R b/pkg/R/utils.R index 3f32868..b0d0ae0 100644 --- a/pkg/R/utils.R +++ b/pkg/R/utils.R @@ -116,14 +116,14 @@ getSimilarDaysIndices = function(index, data, limit, same_season, days_in=NULL) return (day == day_ref) } -#' getNoNA2 -#' -#' Get indices in data of no-NA series followed by no-NA, within [first,last] range. -#' -#' @inheritParams dateIndexToInteger -#' @param first First index (included) -#' @param last Last index (included) -#' +# getNoNA2 +# +# Get indices in data of no-NA series followed by no-NA, within [first,last] range. +# +# @inheritParams dateIndexToInteger +# @param first First index (included) +# @param last Last index (included) +# .getNoNA2 = function(data, first, last) { (first:last)[ sapply(first:last, function(i) diff --git a/reports/rapport_final/report_P7_H17.tex b/reports/rapport_final/report_P7_H17.tex index 012df04..5d0886b 100644 --- a/reports/rapport_final/report_P7_H17.tex +++ b/reports/rapport_final/report_P7_H17.tex @@ -271,6 +271,7 @@ \geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in} +\graphicspath{{./figs/}} \begin{document} -- 2.44.0