#' @export
plotCurves <- function(data, indices=seq_len(data$getSize()))
{
- yrange = quantile( range( sapply( indices, function(i) {
+ yrange = quantile( sapply( indices, function(i) {
serie = c(data$getCenteredSerie(i))
if (!all(is.na(serie)))
range(serie, na.rm=TRUE)
c()
- }) ), probs=c(0.05,0.95) )
+ }), probs=c(0.05,0.95) )
par(mar=c(4.7,5,1,1), cex.axis=1.5, cex.lab=1.5)
for (i in seq_along(indices))
{
sqrt( sum( (ref_serie - data$getCenteredSerie(i))^2 ) / L )
})
indices = sort(distances, index.return=TRUE)$ix[1:min(limit,length(distances))]
- yrange = quantile( range( ref_serie, sapply( indices, function(i) {
+ yrange = quantile( c(ref_serie, sapply( indices, function(i) {
ii = fdays_indices[i]
serie = c(data$getCenteredSerie(ii), data$getCenteredSerie(ii+1))
if (!all(is.na(serie)))
"p_ch_nn = getForecast(data,indices,\"Neighbors\",\"Neighbors\",simtype=\"mix\",same_season=FALSE,mix_strategy=\"mult\")\n",
"p_ch_pz = getForecast(data, indices, \"Persistence\", \"Zero\", same_day=TRUE)\n",
"p_ch_az = getForecast(data, indices, \"Average\", \"Zero\") #, memory=183)\n",
- "#p_ch_zz = getForecast(data, indices, \"Zero\", \"Zero\")\n",
- "#p_ch_l = getForecast(data, indices, \"Level\", same_day=FALSE)"
+ "#p_ch_zz = getForecast(data, indices, \"Zero\", \"Zero\")"
]
},
{
"e_ch_pz = getError(data, p_ch_pz)\n",
"e_ch_az = getError(data, p_ch_az)\n",
"#e_ch_zz = getError(data, p_ch_zz)\n",
- "#e_ch_l = getError(data, p_ch_l)\n",
- "options(repr.plot.width=9, repr.plot.height=6)\n",
+ "options(repr.plot.width=9, repr.plot.height=7)\n",
"plotError(list(e_ch_nn, e_ch_pz, e_ch_az), cols=c(1,2,colors()[258]))\n",
"\n",
"#Noir: neighbors, rouge: persistence, vert: moyenne"
"outputs": [],
"source": [
"par(mfrow=c(2,2))\n",
- "options(repr.plot.width=9, repr.plot.height=6)\n",
+ "options(repr.plot.width=9, repr.plot.height=7)\n",
"plotFilamentsBox(data, f3$indices)\n",
"plotFilamentsBox(data, f3$indices+1)\n",
"plotFilamentsBox(data, f4$indices)\n",
- "plotFilamentsBox(data, f4$indices+1)"
+ "plotFilamentsBox(data, f4$indices+1)\n",
+ "\n",
+ "#En haut : jour 3 + lendemain (4) ; en bas : jour 4 + lendemain (5)\n",
+ "#À gauche : premières 24h ; à droite : 24h suivantes"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "Beaucoup de courbes similaires dans le cas peu pollué, très peu pour un jour pollué."
+ "Dans les deux cas, un voisinage \"raisonnable\" est trouvé ; mais grande variabilité le lendemain \"pollué\"."
]
},
{
"source": [
"par(mfrow=c(1,2))\n",
"options(repr.plot.width=9, repr.plot.height=4)\n",
+ "plotRelativeVariability(data, f3$indices)\n",
+ "plotRelativeVariability(data, f4$indices)\n",
+ "\n",
+ "#Variabilité sur 60 courbes au hasard en rouge ; sur nos 60 voisins (+ lendemains) en noir"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Dans la situation idéale, il faudrait que la courbe noire soit nettement plus basse que la courbe rouge. Ce n'est pas très clair à J+1, surtout en soirée (de 21h à 0h)."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "par(mfrow=c(1,3))\n",
"plotSimils(p_ch_nn, 3)\n",
"plotSimils(p_ch_nn, 4)\n",
+ "plotSimils(p_ch_nn, 5)\n",
"\n",
"#Non pollué à gauche, pollué au milieu, autre pollué à droite"
]
"source": [
"par(mfrow=c(1,2))\n",
"plotPredReal(data, p_ch_nn, 5)\n",
- "plotFilaments(data, p_ch_nn$getIndexInData(5))"
+ "ignored <- computeFilaments(data, p_ch_nn$getIndexInData(5), plot=TRUE)"
]
},
{
"p_ep_nn = getForecast(data,indices,\"Neighbors\",\"Neighbors\",simtype=\"mix\",same_season=FALSE,mix_strategy=\"mult\")\n",
"p_ep_pz = getForecast(data, indices, \"Persistence\", \"Zero\", same_day=TRUE)\n",
"p_ep_az = getForecast(data, indices, \"Average\", \"Zero\") #, memory=183)\n",
- "#p_ep_zz = getForecast(data, indices, \"Zero\", \"Zero\")\n",
- "#p_ep_l = getForecast(data, indices, \"Level\", same_day=TRUE)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "source": [
- "class(p_ep_nn)"
+ "#p_ep_zz = getForecast(data, indices, \"Zero\", \"Zero\")"
]
},
{
"e_ep_az = getError(data, p_ep_az)\n",
"#e_ep_zz = getError(data, p_ep_zz)\n",
"#e_ep_l = getError(data, p_ep_l)\n",
- "options(repr.plot.width=9, repr.plot.height=6)\n",
+ "options(repr.plot.width=9, repr.plot.height=7)\n",
"plotError(list(e_ep_nn, e_ep_pz, e_ep_az), cols=c(1,2,colors()[258]))\n",
"\n",
"#Noir: neighbors, rouge: persistence, vert: moyenne"