From 32240b01d1d041e13144c7b8e4392ff7769e8ee8 Mon Sep 17 00:00:00 2001 From: Tarun Chadha <tarunchadha23@gmail.com> Date: Wed, 1 May 2019 15:09:37 +0200 Subject: [PATCH] Styling moved to first box and redundancy removed --- neural_nets_intro.ipynb | 250 ++++++++++++++++++---------------------- 1 file changed, 113 insertions(+), 137 deletions(-) diff --git a/neural_nets_intro.ipynb b/neural_nets_intro.ipynb index 84fe22e..eca45ca 100644 --- a/neural_nets_intro.ipynb +++ b/neural_nets_intro.ipynb @@ -2,9 +2,117 @@ "cells": [ { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "<style>\n", + " \n", + " @import url('http://fonts.googleapis.com/css?family=Source+Code+Pro');\n", + " \n", + " @import url('http://fonts.googleapis.com/css?family=Kameron');\n", + " @import url('http://fonts.googleapis.com/css?family=Crimson+Text');\n", + " \n", + " @import url('http://fonts.googleapis.com/css?family=Lato');\n", + " @import url('http://fonts.googleapis.com/css?family=Source+Sans+Pro');\n", + " \n", + " @import url('http://fonts.googleapis.com/css?family=Lora'); \n", + "\n", + " \n", + " body {\n", + " font-family: 'Lora', Consolas, sans-serif;\n", + " \n", + " -webkit-print-color-adjust: exact important !;\n", + " \n", + " \n", + " \n", + " }\n", + " \n", + " .alert-block {\n", + " width: 95%;\n", + " margin: auto;\n", + " }\n", + " \n", + " .rendered_html code\n", + " {\n", + " color: black;\n", + " background: #eaf0ff;\n", + " background: #f5f5f5; \n", + " padding: 1pt;\n", + " font-family: 'Source Code Pro', Consolas, monocco, monospace;\n", + " }\n", + " \n", + " p {\n", + " line-height: 140%;\n", + " }\n", + " \n", + " strong code {\n", + " background: red;\n", + " }\n", + " \n", + " .rendered_html strong code\n", + " {\n", + " background: #f5f5f5;\n", + " }\n", + " \n", + " .CodeMirror pre {\n", + " font-family: 'Source Code Pro', monocco, Consolas, monocco, monospace;\n", + " }\n", + " \n", + " .cm-s-ipython span.cm-keyword {\n", + " font-weight: normal;\n", + " }\n", + " \n", + " strong {\n", + " background: #f5f5f5;\n", + " margin-top: 4pt;\n", + " margin-bottom: 4pt;\n", + " padding: 2pt;\n", + " border: 0.5px solid #a0a0a0;\n", + " font-weight: bold;\n", + " color: darkred;\n", + " }\n", + " \n", + " \n", + " div #notebook {\n", + " # font-size: 10pt; \n", + " line-height: 145%;\n", + " }\n", + " \n", + " li {\n", + " line-height: 145%;\n", + " }\n", + "\n", + " div.output_area pre {\n", + " background: #fff9d8 !important;\n", + " padding: 5pt;\n", + " \n", + " -webkit-print-color-adjust: exact; \n", + " \n", + " }\n", + " \n", + " \n", + " \n", + " h1, h2, h3, h4 {\n", + " font-family: Kameron, arial;\n", + "\n", + "\n", + " }\n", + " \n", + " div#maintoolbar {display: none !important;}\n", + "</style>\n" + ], + "text/plain": [ + "<IPython.core.display.HTML object>" + ] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# IGNORE THIS CELL WHICH CUSTOMIZES LAYOUT AND STYLING OF THE NOTEBOOK !\n", "import matplotlib.pyplot as plt\n", @@ -12,7 +120,7 @@ "%config InlineBackend.figure_format = 'retina'\n", "import warnings\n", "warnings.filterwarnings('ignore', category=FutureWarning)\n", - "#from IPython.core.display import HTML; HTML(open(\"custom.html\", \"r\").read())" + "from IPython.core.display import HTML; HTML(open(\"custom.html\", \"r\").read())" ] }, { @@ -813,13 +921,7 @@ "350/350 [==============================] - 0s 73us/step - loss: 0.3096 - acc: 0.9314 - val_loss: 0.3596 - val_acc: 0.8800\n", "Epoch 60/300\n", "350/350 [==============================] - 0s 76us/step - loss: 0.3036 - acc: 0.9314 - val_loss: 0.3541 - val_acc: 0.8800\n", - "Epoch 61/300\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ + "Epoch 61/300\n", "350/350 [==============================] - 0s 90us/step - loss: 0.2978 - acc: 0.9371 - val_loss: 0.3487 - val_acc: 0.8800\n", "Epoch 62/300\n", "350/350 [==============================] - 0s 116us/step - loss: 0.2921 - acc: 0.9343 - val_loss: 0.3434 - val_acc: 0.8800\n", @@ -1065,13 +1167,7 @@ "350/350 [==============================] - 0s 152us/step - loss: 0.0799 - acc: 0.9800 - val_loss: 0.1238 - val_acc: 0.9533\n", "Epoch 180/300\n", "350/350 [==============================] - 0s 127us/step - loss: 0.0798 - acc: 0.9771 - val_loss: 0.1236 - val_acc: 0.9533\n", - "Epoch 181/300\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ + "Epoch 181/300\n", "350/350 [==============================] - 0s 143us/step - loss: 0.0795 - acc: 0.9771 - val_loss: 0.1236 - val_acc: 0.9533\n", "Epoch 182/300\n", "350/350 [==============================] - 0s 146us/step - loss: 0.0790 - acc: 0.9800 - val_loss: 0.1233 - val_acc: 0.9533\n", @@ -2441,126 +2537,6 @@ "source": [ "### Exercise: Load and play with the CIFAR10 dataset also included with Keras and build+train a simple CNN using it" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "#REMOVEBEGIN\n", - "# THE LINES BELOW ARE JUST FOR STYLING THE CONTENT ABOVE !\n", - "\n", - "from IPython import utils\n", - "from IPython.core.display import HTML\n", - "import os\n", - "def css_styling():\n", - " \"\"\"Load default custom.css file from ipython profile\"\"\"\n", - " base = utils.path.get_ipython_dir()\n", - " styles = \"\"\"<style>\n", - " \n", - " @import url('http://fonts.googleapis.com/css?family=Source+Code+Pro');\n", - " \n", - " @import url('http://fonts.googleapis.com/css?family=Kameron');\n", - " @import url('http://fonts.googleapis.com/css?family=Crimson+Text');\n", - " \n", - " @import url('http://fonts.googleapis.com/css?family=Lato');\n", - " @import url('http://fonts.googleapis.com/css?family=Source+Sans+Pro');\n", - " \n", - " @import url('http://fonts.googleapis.com/css?family=Lora'); \n", - "\n", - " \n", - " body {\n", - " font-family: 'Lora', Consolas, sans-serif;\n", - " \n", - " -webkit-print-color-adjust: exact important !;\n", - " \n", - " \n", - " \n", - " }\n", - " \n", - " .alert-block {\n", - " width: 95%;\n", - " margin: auto;\n", - " }\n", - " \n", - " .rendered_html code\n", - " {\n", - " color: black;\n", - " background: #eaf0ff;\n", - " background: #f5f5f5; \n", - " padding: 1pt;\n", - " font-family: 'Source Code Pro', Consolas, monocco, monospace;\n", - " }\n", - " \n", - " p {\n", - " line-height: 140%;\n", - " }\n", - " \n", - " strong code {\n", - " background: red;\n", - " }\n", - " \n", - " .rendered_html strong code\n", - " {\n", - " background: #f5f5f5;\n", - " }\n", - " \n", - " .CodeMirror pre {\n", - " font-family: 'Source Code Pro', monocco, Consolas, monocco, monospace;\n", - " }\n", - " \n", - " .cm-s-ipython span.cm-keyword {\n", - " font-weight: normal;\n", - " }\n", - " \n", - " strong {\n", - " background: #f5f5f5;\n", - " margin-top: 4pt;\n", - " margin-bottom: 4pt;\n", - " padding: 2pt;\n", - " border: 0.5px solid #a0a0a0;\n", - " font-weight: bold;\n", - " color: darkred;\n", - " }\n", - " \n", - " \n", - " div #notebook {\n", - " # font-size: 10pt; \n", - " line-height: 145%;\n", - " }\n", - " \n", - " li {\n", - " line-height: 145%;\n", - " }\n", - "\n", - " div.output_area pre {\n", - " background: #fff9d8 !important;\n", - " padding: 5pt;\n", - " \n", - " -webkit-print-color-adjust: exact; \n", - " \n", - " }\n", - " \n", - " \n", - " \n", - " h1, h2, h3, h4 {\n", - " font-family: Kameron, arial;\n", - " }\n", - " \n", - " div#maintoolbar {display: none !important;}\n", - " </style>\"\"\"\n", - " return HTML(styles)\n", - "css_styling()\n", - "#REMOVEEND" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { -- GitLab