merge with remote
[aggexp.git] / scripts / make_summaries / modele.Rnw
1 \documentclass[12pt]{article}
2
3 \usepackage{geometry}
4 \geometry{
5 a4paper,
6 total={210mm,297mm},
7 left=10mm,
8 right=10mm,
9 top=15mm,
10 bottom=15mm,
11 }
12 \setlength{\parindent}{0pt}
13 \usepackage[utf8]{inputenc}
14 \usepackage[french]{babel}
15 \usepackage{helvet}
16 \renewcommand{\familydefault}{\sfdefault}
17 \usepackage{amsmath,amsfonts,amssymb}
18 \usepackage{float}
19 \usepackage{graphicx}
20 \usepackage{wrapfig}
21 \usepackage{xcolor}
22 \usepackage{cprotect}
23 %\setcounter{section}{9}
24
25 \begin{document}
26
27 <<setup, include=FALSE, cache=FALSE, echo=FALSE>>=
28 opts_chunk$set(fig.path="figs/", fig.align="center", fig.show="hold", echo=FALSE)
29 options(replace.assign=TRUE,width=90)
30 @
31
32 <<initialize>>=
33 library(aggexp)
34 station = "STATIONNAME"
35 experts = aggexp:::expertsArray[EXPERTSINDICES]
36 K = length(experts)
37 @
38
39 \cprotect\section{\verb|STATIONNAME| - Résumé des données}
40
41 \vspace*{-0.5cm}
42 <<plotCurves, out.width="12cm", out.height="9cm">>=
43 mock_r = list(data = getData(experts, station), experts=experts, stations=station)
44 plotCurves(mock_r)
45 @
46
47 \vspace*{-0.8cm}
48 \cprotect\section{\verb|STATIONNAME| - Performances en prédiction}
49
50 \vspace*{-0.5cm}
51 <<computePredictions>>=
52 r_ml = runAlgorithm("ml", experts=experts, stations=station, alpha=0.2, H=183, grad=TRUE)
53 r_rr = runAlgorithm("rr", experts=experts, stations=station, H=183)
54 r_be = r_ml
55 be = which.max(getBestExpert(r_ml))
56 r_be$data[,"Prediction"] = r_be$data[,experts[be]]
57 @
58
59 <<plotPredictionClouds, out.width="6cm", out.height="6cm">>=
60 plotCloud(r_be, 30, c(30,50,80), main=paste("Nuage Meilleur Expert (",experts[be],")",sep=""))
61 plotCloud(r_ml, 30, c(30,50,80), main="Nuage ML")
62 plotCloud(r_rr, 30, c(30,50,80), main="Nuage RR")
63 @
64
65 \vspace*{-0.8cm}
66 \cprotect\section{\verb|STATIONNAME| - Indicateurs d'alertes}
67
68 \vspace*{-0.5cm}
69 <<computeAlertIndicators>>=
70 indicators = matrix(nrow=5, ncol=4+K)
71 indicators[,1] = as.numeric(getIndicators(r_ml, thresh=30))
72 indicators[,2] = as.numeric(getIndicators(r_rr, thresh=30))
73 for (i in 1:K) {
74 r_be$data[,"Prediction"] = r_be$data[,experts[i]]
75 indicators[,i+2] = as.numeric(getIndicators(r_be, thresh=30))
76 }
77 indicators = as.data.frame(indicators, row.names=c("TS","FA","MA","RMSE","EV"))
78 names(indicators) = c("ML","RR", experts)
79 @
80
81 <<plotAlertIndicators, results="asis">>=
82 library(xtable)
83 splitIndex = ifelse(length(experts) < 10, 7, 8)
84 xtable(indicators[,1:splitIndex], caption="Indicateurs d'alertes ; partie 1")
85 xtable(indicators[,(splitIndex+1):(2+K)], caption="Indicateurs d'alertes ; partie 2")
86 @
87
88 \end{document}