+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "library(talweg)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "data = getData(ts_data=\"../data/pm10_mesures_H_loc.csv\", exo_data=\"../data/meteo_extra_noNAs.csv\",\n",
+ " input_tz = \"Europe/Paris\", working_tz=\"Europe/Paris\", predict_at=7)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Pollution par chauffage"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "p_ch_nn = getForecast(data, seq(as.Date(\"2015-01-18\"),as.Date(\"2015-01-24\"),\"days\"), Inf, 17,\n",
+ " \"Neighbors\", \"Neighbors\", simtype=\"mix\", same_season=FALSE, mix_strategy=\"mult\")\n",
+ "p_ch_pz = getForecast(data, seq(as.Date(\"2015-01-18\"),as.Date(\"2015-01-24\"),\"days\"), Inf, 17,\n",
+ " \"Persistence\", \"Zero\")\n",
+ "p_ch_az = getForecast(data, seq(as.Date(\"2015-01-18\"),as.Date(\"2015-01-24\"),\"days\"), Inf, 17,\n",
+ " \"Average\", \"Zero\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "e_ch_nn = getError(data, p_ch_nn, 17)\n",
+ "e_ch_pz = getError(data, p_ch_pz, 17)\n",
+ "e_ch_az = getError(data, p_ch_az, 17)\n",
+ "options(repr.plot.width=9, repr.plot.height=6)\n",
+ "plotError(list(e_ch_nn, e_ch_pz, e_ch_az), cols=c(1,2,colors()[258]))"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "par(mfrow=c(1,2))\n",
+ "options(repr.plot.width=9, repr.plot.height=4)\n",
+ "plotPredReal(data, p_ch_nn, 3)\n",
+ "plotPredReal(data, p_ch_nn, 4)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "par(mfrow=c(1,2))\n",
+ "plotFilaments(data, p_ch_nn$getIndexInData(3))\n",
+ "plotFilaments(data, p_ch_nn$getIndexInData(4))"
+ ]
+ },
+ {
+ "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)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Pollution par épandage"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "p_ep_nn = getForecast(data, seq(as.Date(\"2015-03-15\"),as.Date(\"2015-03-21\"),\"days\"), Inf, 17,\n",
+ " \"Neighbors\", \"Neighbors\", simtype=\"mix\", same_season=FALSE, mix_strategy=\"mult\")\n",
+ "p_ep_pz = getForecast(data, seq(as.Date(\"2015-03-15\"),as.Date(\"2015-03-21\"),\"days\"), Inf, 17,\n",
+ " \"Persistence\", \"Zero\")\n",
+ "p_ep_az = getForecast(data, seq(as.Date(\"2015-03-15\"),as.Date(\"2015-03-21\"),\"days\"), Inf, 17,\n",
+ " \"Average\", \"Zero\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "e_ep_nn = getError(data, p_ep_nn, 17)\n",
+ "e_ep_pz = getError(data, p_ep_pz, 17)\n",
+ "e_ep_az = getError(data, p_ep_az, 17)\n",
+ "options(repr.plot.width=9, repr.plot.height=6)\n",
+ "plotError(list(e_ep_nn, e_ep_pz, e_ep_az), cols=c(1,2,colors()[258]))"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "par(mfrow=c(1,2))\n",
+ "options(repr.plot.width=9, repr.plot.height=4)\n",
+ "plotPredReal(data, p_ep_nn, 3)\n",
+ "plotPredReal(data, p_ep_nn, 4)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "par(mfrow=c(1,2))\n",
+ "plotFilaments(data, p_ep_nn$getIndexInData(3))\n",
+ "plotFilaments(data, p_ep_nn$getIndexInData(4))"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "par(mfrow=c(1,3))\n",
+ "plotSimils(p_ep_nn, 3)\n",
+ "plotSimils(p_ep_nn, 4)\n",
+ "plotSimils(p_ep_nn, 5)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Semaine non polluée"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "p_np_nn = getForecast(data, seq(as.Date(\"2015-04-26\"),as.Date(\"2015-05-02\"),\"days\"), Inf, 17,\n",
+ " \"Neighbors\", \"Neighbors\", simtype=\"mix\", same_season=FALSE, mix_strategy=\"mult\")\n",
+ "p_np_pz = getForecast(data, seq(as.Date(\"2015-04-26\"),as.Date(\"2015-05-02\"),\"days\"), Inf, 17,\n",
+ " \"Persistence\", \"Zero\")\n",
+ "p_np_az = getForecast(data, seq(as.Date(\"2015-04-26\"),as.Date(\"2015-05-02\"),\"days\"), Inf, 17,\n",
+ " \"Average\", \"Zero\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "e_np_nn = getError(data, p_np_nn, 17)\n",
+ "e_np_pz = getError(data, p_np_pz, 17)\n",
+ "e_np_az = getError(data, p_np_az, 17)\n",
+ "options(repr.plot.width=9, repr.plot.height=6)\n",
+ "plotError(list(e_np_nn, e_np_pz, e_np_az), cols=c(1,2,colors()[258]))"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "par(mfrow=c(1,2))\n",
+ "options(repr.plot.width=9, repr.plot.height=4)\n",
+ "plotPredReal(data, p_np_nn, 3)\n",
+ "plotPredReal(data, p_np_nn, 4)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "par(mfrow=c(1,2))\n",
+ "plotFilaments(data, p_np_nn$getIndexInData(3))\n",
+ "plotFilaments(data, p_np_nn$getIndexInData(4))"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "par(mfrow=c(1,3))\n",
+ "plotSimils(p_np_nn, 3)\n",
+ "plotSimils(p_np_nn, 4)\n",
+ "plotSimils(p_np_nn, 5)"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "R",
+ "language": "R",
+ "name": "ir"
+ },
+ "language_info": {
+ "codemirror_mode": "r",
+ "file_extension": ".r",
+ "mimetype": "text/x-r-source",
+ "name": "R",
+ "pygments_lexer": "r",
+ "version": "3.3.2"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}