From 83a131034ddcd3017b36343fa9f5ccf47f108175 Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.auder@somewhere>
Date: Wed, 29 Mar 2017 11:48:53 +0200
Subject: [PATCH] 'update'

---
 reports/report.ipynb    | 230 +++++++---------------------------------
 reports/run.sh          |  12 +++
 reports/run_notebook.sh |   3 -
 3 files changed, 53 insertions(+), 192 deletions(-)
 create mode 100644 reports/run.sh
 delete mode 100644 reports/run_notebook.sh

diff --git a/reports/report.ipynb b/reports/report.ipynb
index c4656a9..70d86d2 100644
--- a/reports/report.ipynb
+++ b/reports/report.ipynb
@@ -2,10 +2,7 @@
  "cells": [
   {
    "cell_type": "markdown",
-   "metadata": {
-    "deletable": true,
-    "editable": true
-   },
+   "metadata": {},
    "source": [
     "\n",
     "\n",
@@ -31,11 +28,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false,
-    "deletable": true,
-    "editable": true
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "library(talweg)\n",
@@ -56,10 +49,7 @@
   },
   {
    "cell_type": "markdown",
-   "metadata": {
-    "deletable": true,
-    "editable": true
-   },
+   "metadata": {},
    "source": [
     "\n",
     "\n",
@@ -69,16 +59,11 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false,
-    "deletable": true,
-    "editable": true
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
-    "reload(\"../pkg\")\n",
     "p_nn = computeForecast(data, indices_ch, \"Neighbors\", \"Neighbors\", horizon=H)\n",
-    "p_nn2 = computeForecast(data, indices_ch, \"Neighbors2\", \"Neighbors\", horizon=H)\n",
+    "p_nn2 = computeForecast(data, indices_ch, \"Neighbors2\", \"Zero\", horizon=H)\n",
     "p_az = computeForecast(data, indices_ch, \"Average\", \"Zero\", horizon=H)\n",
     "p_pz = computeForecast(data, indices_ch, \"Persistence\", \"Zero\", horizon=H, same_day=TRUE)"
    ]
@@ -86,24 +71,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false,
-    "deletable": true,
-    "editable": true
-   },
-   "outputs": [],
-   "source": [
-    "p_nn2$getParams(5)$weights"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "metadata": {
-    "collapsed": false,
-    "deletable": true,
-    "editable": true
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "e_nn = computeError(data, p_nn, H)\n",
@@ -122,11 +90,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false,
-    "deletable": true,
-    "editable": true
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "options(repr.plot.width=9, repr.plot.height=4)\n",
@@ -147,11 +111,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false,
-    "deletable": true,
-    "editable": true
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "par(mfrow=c(1,2))\n",
@@ -165,40 +125,22 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false,
-    "deletable": true,
-    "editable": true
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "par(mfrow=c(1,2))\n",
-    "#plotFilamentsBox(data, f_np); title(paste(\"FilBox nn day\",i_np))\n",
-    "#plotFilamentsBox(data, f_p); title(paste(\"FilBox nn day\",i_p))\n",
+    "plotFilamentsBox(data, f_np); title(paste(\"FilBox nn day\",i_np))\n",
+    "plotFilamentsBox(data, f_p); title(paste(\"FilBox nn day\",i_p))\n",
     "\n",
-    "plotFilamentsBox(data, f_np2); title(paste(\"FilBox nn2 day\",i_np))\n",
+    "# Generally too few neighbors:\n",
+    "#plotFilamentsBox(data, f_np2); title(paste(\"FilBox nn2 day\",i_np))\n",
     "#plotFilamentsBox(data, f_p2); title(paste(\"FilBox nn2 day\",i_p))"
    ]
   },
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false
-   },
-   "outputs": [],
-   "source": [
-    "f_np2"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "metadata": {
-    "collapsed": false,
-    "deletable": true,
-    "editable": true
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "par(mfrow=c(1,2))\n",
@@ -214,11 +156,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false,
-    "deletable": true,
-    "editable": true
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "par(mfrow=c(1,2))\n",
@@ -234,11 +172,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false,
-    "deletable": true,
-    "editable": true
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "# Fenêtres sélectionnées dans ]0,7] / nn à gauche, nn2 à droite\n",
@@ -251,10 +185,7 @@
   },
   {
    "cell_type": "markdown",
-   "metadata": {
-    "deletable": true,
-    "editable": true
-   },
+   "metadata": {},
    "source": [
     "\n",
     "\n",
@@ -264,11 +195,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false,
-    "deletable": true,
-    "editable": true
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "p_nn = computeForecast(data, indices_ep, \"Neighbors\", \"Neighbors\", horizon=H)\n",
@@ -280,11 +207,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false,
-    "deletable": true,
-    "editable": true
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "e_nn = computeError(data, p_nn, H)\n",
@@ -303,11 +226,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false,
-    "deletable": true,
-    "editable": true
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "options(repr.plot.width=9, repr.plot.height=4)\n",
@@ -328,11 +247,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false,
-    "deletable": true,
-    "editable": true
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "par(mfrow=c(1,2))\n",
@@ -346,29 +261,22 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false,
-    "deletable": true,
-    "editable": true
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "par(mfrow=c(1,2))\n",
     "plotFilamentsBox(data, f_np); title(paste(\"FilBox nn day\",i_np))\n",
     "plotFilamentsBox(data, f_p); title(paste(\"FilBox nn day\",i_p))\n",
     "\n",
-    "plotFilamentsBox(data, f_np2); title(paste(\"FilBox nn2 day\",i_np))\n",
-    "plotFilamentsBox(data, f_p2); title(paste(\"FilBox nn2 day\",i_p))"
+    "# Generally too few neighbors:\n",
+    "#plotFilamentsBox(data, f_np2); title(paste(\"FilBox nn2 day\",i_np))\n",
+    "#plotFilamentsBox(data, f_p2); title(paste(\"FilBox nn2 day\",i_p))"
    ]
   },
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false,
-    "deletable": true,
-    "editable": true
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "par(mfrow=c(1,2))\n",
@@ -384,11 +292,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false,
-    "deletable": true,
-    "editable": true
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "par(mfrow=c(1,2))\n",
@@ -404,11 +308,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false,
-    "deletable": true,
-    "editable": true
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "# Fenêtres sélectionnées dans ]0,7] / nn à gauche, nn2 à droite\n",
@@ -421,10 +321,7 @@
   },
   {
    "cell_type": "markdown",
-   "metadata": {
-    "deletable": true,
-    "editable": true
-   },
+   "metadata": {},
    "source": [
     "\n",
     "\n",
@@ -434,11 +331,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false,
-    "deletable": true,
-    "editable": true
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "p_nn = computeForecast(data, indices_np, \"Neighbors\", \"Neighbors\", horizon=H)\n",
@@ -450,11 +343,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false,
-    "deletable": true,
-    "editable": true
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "e_nn = computeError(data, p_nn, H)\n",
@@ -473,11 +362,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false,
-    "deletable": true,
-    "editable": true
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "options(repr.plot.width=9, repr.plot.height=4)\n",
@@ -498,11 +383,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false,
-    "deletable": true,
-    "editable": true
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "par(mfrow=c(1,2))\n",
@@ -516,29 +397,22 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false,
-    "deletable": true,
-    "editable": true
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "par(mfrow=c(1,2))\n",
     "plotFilamentsBox(data, f_np); title(paste(\"FilBox nn day\",i_np))\n",
     "plotFilamentsBox(data, f_p); title(paste(\"FilBox nn day\",i_p))\n",
     "\n",
-    "plotFilamentsBox(data, f_np2); title(paste(\"FilBox nn2 day\",i_np))\n",
-    "plotFilamentsBox(data, f_p2); title(paste(\"FilBox nn2 day\",i_p))"
+    "# Generally too few neighbors:\n",
+    "#plotFilamentsBox(data, f_np2); title(paste(\"FilBox nn2 day\",i_np))\n",
+    "#plotFilamentsBox(data, f_p2); title(paste(\"FilBox nn2 day\",i_p))"
    ]
   },
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false,
-    "deletable": true,
-    "editable": true
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "par(mfrow=c(1,2))\n",
@@ -554,11 +428,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false,
-    "deletable": true,
-    "editable": true
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "par(mfrow=c(1,2))\n",
@@ -574,11 +444,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false,
-    "deletable": true,
-    "editable": true
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "# Fenêtres sélectionnées dans ]0,7] / nn à gauche, nn2 à droite\n",
@@ -590,21 +456,7 @@
    ]
   }
  ],
- "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.3"
-  }
- },
+ "metadata": {},
  "nbformat": 4,
  "nbformat_minor": 2
 }
diff --git a/reports/run.sh b/reports/run.sh
new file mode 100644
index 0000000..d108199
--- /dev/null
+++ b/reports/run.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+# Usage: ./run.sh P H
+
+nbfile=report_P$1_H$2.ipynb
+./ipynb_generator.py report.gj $nbfile P=$1 H=$2
+
+htmlfile=report_P$1_H$2.html
+jupyter-nbconvert \
+	--ExecutePreprocessor.kernel_name='ir' \
+	--ExecutePreprocessor.timeout=1800 \
+	--to html --execute $nbfile \
+	--output=$htmlfile
diff --git a/reports/run_notebook.sh b/reports/run_notebook.sh
deleted file mode 100644
index a6b31ce..0000000
--- a/reports/run_notebook.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-jupyter-nbconvert --ExecutePreprocessor.timeout=1800 --to notebook --execute report_2017-03-01.ipynb
-- 
2.44.0