20 |
21 |
22 |
23 |
24 |
25 |
26 |
ML Car Insurance Risk Check
27 |You can check the risk group for a prospective customer simply by providing three inputs
28 |44 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
├── model ├── .gitattributes └── insurance.h5 ├── .gitignore ├── img ├── calc.jpg ├── neuron.jpg ├── what-if.png ├── encoding3.jpg ├── dropout-smerty.jpg ├── generalization.jpg └── generalization2.jpg ├── exercise ├── test.png ├── train.png ├── manual-decision-boundaries.docx ├── manual-decision-boundaries.pdf └── plot.py ├── sample_insurance.json ├── tf-v2 ├── twitch.png └── nn-from-layer-to-model.png ├── tf └── 1 │ ├── saved_model.pb │ └── variables │ ├── variables.index │ └── variables.data-00000-of-00001 ├── tfjs ├── group1-shard1of1 ├── group2-shard1of1 ├── group3-shard1of1 ├── group4-shard1of1 ├── group5-shard1of1 └── model.json ├── docs ├── ml_insurance │ ├── group1-shard1of1 │ ├── group2-shard1of1 │ ├── group3-shard1of1 │ ├── group4-shard1of1 │ ├── group5-shard1of1 │ └── model.json ├── load_model.html ├── bootstrap │ └── css │ │ ├── bootstrap-reboot.min.css │ │ ├── .DS_Store │ │ ├── bootstrap-reboot.css │ │ ├── bootstrap-reboot.min.css.map │ │ └── bootstrap-grid.min.css └── index.html ├── livevideo-deep-learning-crash-course.png ├── solution └── plot.py ├── LICENSE ├── U4-M5-tf-check.ipynb ├── U4-M7-local.ipynb ├── README.md ├── data ├── insurance-customers-300.csv ├── insurance-customers-500-test.csv └── generate.ipynb ├── U4-M6-cloud.ipynb ├── U4-M2-tensorflowjs.ipynb └── U4-M4-tf-prep.ipynb /model/.gitattributes: -------------------------------------------------------------------------------- 1 | *.h5 binary -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .ipynb_checkpoints 2 | /*.csv 3 | tf_log 4 | /*.hdf5 5 | /*.h5 -------------------------------------------------------------------------------- /img/calc.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJCordhose/deep-learning-crash-course-notebooks/HEAD/img/calc.jpg -------------------------------------------------------------------------------- /img/neuron.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJCordhose/deep-learning-crash-course-notebooks/HEAD/img/neuron.jpg -------------------------------------------------------------------------------- /img/what-if.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJCordhose/deep-learning-crash-course-notebooks/HEAD/img/what-if.png -------------------------------------------------------------------------------- /exercise/test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJCordhose/deep-learning-crash-course-notebooks/HEAD/exercise/test.png -------------------------------------------------------------------------------- /img/encoding3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJCordhose/deep-learning-crash-course-notebooks/HEAD/img/encoding3.jpg -------------------------------------------------------------------------------- /sample_insurance.json: -------------------------------------------------------------------------------- 1 | {"inputs": [ 160, 18, 100]} 2 | {"inputs": [ 100, 47, 10]} 3 | {"inputs": [ 90, 20, 20]} -------------------------------------------------------------------------------- /tf-v2/twitch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJCordhose/deep-learning-crash-course-notebooks/HEAD/tf-v2/twitch.png -------------------------------------------------------------------------------- /exercise/train.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJCordhose/deep-learning-crash-course-notebooks/HEAD/exercise/train.png -------------------------------------------------------------------------------- /model/insurance.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJCordhose/deep-learning-crash-course-notebooks/HEAD/model/insurance.h5 -------------------------------------------------------------------------------- /tf/1/saved_model.pb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJCordhose/deep-learning-crash-course-notebooks/HEAD/tf/1/saved_model.pb -------------------------------------------------------------------------------- /img/dropout-smerty.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJCordhose/deep-learning-crash-course-notebooks/HEAD/img/dropout-smerty.jpg -------------------------------------------------------------------------------- /img/generalization.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJCordhose/deep-learning-crash-course-notebooks/HEAD/img/generalization.jpg -------------------------------------------------------------------------------- /tfjs/group1-shard1of1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJCordhose/deep-learning-crash-course-notebooks/HEAD/tfjs/group1-shard1of1 -------------------------------------------------------------------------------- /tfjs/group2-shard1of1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJCordhose/deep-learning-crash-course-notebooks/HEAD/tfjs/group2-shard1of1 -------------------------------------------------------------------------------- /tfjs/group3-shard1of1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJCordhose/deep-learning-crash-course-notebooks/HEAD/tfjs/group3-shard1of1 -------------------------------------------------------------------------------- /tfjs/group4-shard1of1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJCordhose/deep-learning-crash-course-notebooks/HEAD/tfjs/group4-shard1of1 -------------------------------------------------------------------------------- /tfjs/group5-shard1of1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJCordhose/deep-learning-crash-course-notebooks/HEAD/tfjs/group5-shard1of1 -------------------------------------------------------------------------------- /img/generalization2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJCordhose/deep-learning-crash-course-notebooks/HEAD/img/generalization2.jpg -------------------------------------------------------------------------------- /tf/1/variables/variables.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJCordhose/deep-learning-crash-course-notebooks/HEAD/tf/1/variables/variables.index -------------------------------------------------------------------------------- /tf-v2/nn-from-layer-to-model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJCordhose/deep-learning-crash-course-notebooks/HEAD/tf-v2/nn-from-layer-to-model.png -------------------------------------------------------------------------------- /docs/ml_insurance/group1-shard1of1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJCordhose/deep-learning-crash-course-notebooks/HEAD/docs/ml_insurance/group1-shard1of1 -------------------------------------------------------------------------------- /docs/ml_insurance/group2-shard1of1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJCordhose/deep-learning-crash-course-notebooks/HEAD/docs/ml_insurance/group2-shard1of1 -------------------------------------------------------------------------------- /docs/ml_insurance/group3-shard1of1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJCordhose/deep-learning-crash-course-notebooks/HEAD/docs/ml_insurance/group3-shard1of1 -------------------------------------------------------------------------------- /docs/ml_insurance/group4-shard1of1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJCordhose/deep-learning-crash-course-notebooks/HEAD/docs/ml_insurance/group4-shard1of1 -------------------------------------------------------------------------------- /docs/ml_insurance/group5-shard1of1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJCordhose/deep-learning-crash-course-notebooks/HEAD/docs/ml_insurance/group5-shard1of1 -------------------------------------------------------------------------------- /exercise/manual-decision-boundaries.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJCordhose/deep-learning-crash-course-notebooks/HEAD/exercise/manual-decision-boundaries.docx -------------------------------------------------------------------------------- /exercise/manual-decision-boundaries.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJCordhose/deep-learning-crash-course-notebooks/HEAD/exercise/manual-decision-boundaries.pdf -------------------------------------------------------------------------------- /livevideo-deep-learning-crash-course.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJCordhose/deep-learning-crash-course-notebooks/HEAD/livevideo-deep-learning-crash-course.png -------------------------------------------------------------------------------- /tf/1/variables/variables.data-00000-of-00001: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJCordhose/deep-learning-crash-course-notebooks/HEAD/tf/1/variables/variables.data-00000-of-00001 -------------------------------------------------------------------------------- /solution/plot.py: -------------------------------------------------------------------------------- 1 | sample_df = df.sample(n=300, random_state=42) 2 | sns.set(font_scale=2) 3 | sns.pairplot(sample_df, hue="group", palette={0: '#AA4444', 1: '#006000', 2: '#EEEE44'}, 4 | vars=['speed', 'age', 'miles'], height=5, markers=["o", "s", "D"]) -------------------------------------------------------------------------------- /exercise/plot.py: -------------------------------------------------------------------------------- 1 | # Change our pairplot to 2 | # * plot more samples 3 | # * reduce the number of variables to the first three (leave out the group) 4 | # * make the plot a bit larger 5 | 6 | # Optional 7 | # * give each group a different type of marker, use https://matplotlib.org/api/markers_api.html as a reference 8 | 9 | # Use the help function built into the notebook to explore Seaborns API by typing 10 | sns.pairplot? -------------------------------------------------------------------------------- /docs/load_model.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 20 | 21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Oliver Zeigermann 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /docs/bootstrap/css/bootstrap-reboot.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Reboot v4.1.3 (https://getbootstrap.com/) 3 | * Copyright 2011-2018 The Bootstrap Authors 4 | * Copyright 2011-2018 Twitter, Inc. 5 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 6 | * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) 7 | */*,::after,::before{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;-ms-overflow-style:scrollbar;-webkit-tap-highlight-color:transparent}@-ms-viewport{width:device-width}article,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;text-align:left;background-color:#fff}[tabindex="-1"]:focus{outline:0!important}hr{box-sizing:content-box;height:0;overflow:visible}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem}p{margin-top:0;margin-bottom:1rem}abbr[data-original-title],abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;border-bottom:0}address{margin-bottom:1rem;font-style:normal;line-height:inherit}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}dfn{font-style:italic}b,strong{font-weight:bolder}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#007bff;text-decoration:none;background-color:transparent;-webkit-text-decoration-skip:objects}a:hover{color:#0056b3;text-decoration:underline}a:not([href]):not([tabindex]){color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus,a:not([href]):not([tabindex]):hover{color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus{outline:0}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em}pre{margin-top:0;margin-bottom:1rem;overflow:auto;-ms-overflow-style:scrollbar}figure{margin:0 0 1rem}img{vertical-align:middle;border-style:none}svg{overflow:hidden;vertical-align:middle}table{border-collapse:collapse}caption{padding-top:.75rem;padding-bottom:.75rem;color:#6c757d;text-align:left;caption-side:bottom}th{text-align:inherit}label{display:inline-block;margin-bottom:.5rem}button{border-radius:0}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,input{overflow:visible}button,select{text-transform:none}[type=reset],[type=submit],button,html [type=button]{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{padding:0;border-style:none}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=date],input[type=datetime-local],input[type=month],input[type=time]{-webkit-appearance:listbox}textarea{overflow:auto;resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;max-width:100%;padding:0;margin-bottom:.5rem;font-size:1.5rem;line-height:inherit;color:inherit;white-space:normal}progress{vertical-align:baseline}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:none}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}summary{display:list-item;cursor:pointer}template{display:none}[hidden]{display:none!important} 8 | /*# sourceMappingURL=bootstrap-reboot.min.css.map */ -------------------------------------------------------------------------------- /U4-M5-tf-check.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Checking our TensorFlow model\n", 8 | "https://www.tensorflow.org/guide/saved_model#cli_to_inspect_and_execute_savedmodel" 9 | ] 10 | }, 11 | { 12 | "cell_type": "code", 13 | "execution_count": 4, 14 | "metadata": {}, 15 | "outputs": [], 16 | "source": [ 17 | "import warnings\n", 18 | "warnings.filterwarnings('ignore')" 19 | ] 20 | }, 21 | { 22 | "cell_type": "code", 23 | "execution_count": 5, 24 | "metadata": {}, 25 | "outputs": [ 26 | { 27 | "name": "stdout", 28 | "output_type": "stream", 29 | "text": [ 30 | "Populating the interactive namespace from numpy and matplotlib\n" 31 | ] 32 | } 33 | ], 34 | "source": [ 35 | "%matplotlib inline\n", 36 | "%pylab inline\n", 37 | "import matplotlib.pyplot as plt" 38 | ] 39 | }, 40 | { 41 | "cell_type": "code", 42 | "execution_count": 6, 43 | "metadata": {}, 44 | "outputs": [ 45 | { 46 | "name": "stdout", 47 | "output_type": "stream", 48 | "text": [ 49 | "total 616\n", 50 | "-rw-r--r-- 1 olive 197609 625641 Sep 14 09:35 saved_model.pb\n", 51 | "drwxr-xr-x 1 olive 197609 0 Sep 14 09:35 variables\n" 52 | ] 53 | } 54 | ], 55 | "source": [ 56 | "!ls -l tf/1" 57 | ] 58 | }, 59 | { 60 | "cell_type": "code", 61 | "execution_count": 7, 62 | "metadata": {}, 63 | "outputs": [ 64 | { 65 | "name": "stdout", 66 | "output_type": "stream", 67 | "text": [ 68 | "The given SavedModel contains the following tag-sets:\n", 69 | "serve\n" 70 | ] 71 | } 72 | ], 73 | "source": [ 74 | "!saved_model_cli show --dir tf/1" 75 | ] 76 | }, 77 | { 78 | "cell_type": "code", 79 | "execution_count": 8, 80 | "metadata": {}, 81 | "outputs": [ 82 | { 83 | "name": "stdout", 84 | "output_type": "stream", 85 | "text": [ 86 | "The given SavedModel MetaGraphDef contains SignatureDefs with the following keys:\n", 87 | "SignatureDef key: \"serving_default\"\n" 88 | ] 89 | } 90 | ], 91 | "source": [ 92 | "!saved_model_cli show --dir tf/1 --tag_set serve" 93 | ] 94 | }, 95 | { 96 | "cell_type": "code", 97 | "execution_count": 9, 98 | "metadata": {}, 99 | "outputs": [ 100 | { 101 | "name": "stdout", 102 | "output_type": "stream", 103 | "text": [ 104 | "The given SavedModel SignatureDef contains the following input(s):\n", 105 | " inputs['inputs'] tensor_info:\n", 106 | " dtype: DT_FLOAT\n", 107 | " shape: (-1, 3)\n", 108 | " name: hidden1_input_1:0\n", 109 | "The given SavedModel SignatureDef contains the following output(s):\n", 110 | " outputs['scores'] tensor_info:\n", 111 | " dtype: DT_FLOAT\n", 112 | " shape: (-1, 3)\n", 113 | " name: softmax_1/Softmax:0\n", 114 | "Method name is: tensorflow/serving/predict\n" 115 | ] 116 | } 117 | ], 118 | "source": [ 119 | "!saved_model_cli show --dir tf/1 --tag_set serve --signature_def serving_default" 120 | ] 121 | }, 122 | { 123 | "cell_type": "code", 124 | "execution_count": null, 125 | "metadata": {}, 126 | "outputs": [], 127 | "source": [ 128 | "# 0: red\n", 129 | "# 1: green\n", 130 | "# 2: yellow\n", 131 | "\n", 132 | "!saved_model_cli run --dir tf/1 --tag_set serve --signature_def serving_default --input_exprs inputs=[[100.0,47.0,10.0]]" 133 | ] 134 | } 135 | ], 136 | "metadata": { 137 | "kernelspec": { 138 | "display_name": "Python 3", 139 | "language": "python", 140 | "name": "python3" 141 | }, 142 | "language_info": { 143 | "codemirror_mode": { 144 | "name": "ipython", 145 | "version": 3 146 | }, 147 | "file_extension": ".py", 148 | "mimetype": "text/x-python", 149 | "name": "python", 150 | "nbconvert_exporter": "python", 151 | "pygments_lexer": "ipython3", 152 | "version": "3.6.6" 153 | } 154 | }, 155 | "nbformat": 4, 156 | "nbformat_minor": 1 157 | } 158 | -------------------------------------------------------------------------------- /U4-M7-local.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Running on a dedicated Linux server\n", 8 | "## From here-on you will need a Linux server that has a proper installation of TensorFlow and the TensorFlow server\n", 9 | "* https://www.tensorflow.org/install/install_linux\n", 10 | "* https://www.tensorflow.org/serving/setup" 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": 3, 16 | "metadata": {}, 17 | "outputs": [ 18 | { 19 | "name": "stdout", 20 | "output_type": "stream", 21 | "text": [ 22 | "total 616\n", 23 | "-rw-r--r-- 1 olive 197609 625641 Sep 14 09:35 saved_model.pb\n", 24 | "drwxr-xr-x 1 olive 197609 0 Sep 14 09:35 variables\n" 25 | ] 26 | } 27 | ], 28 | "source": [ 29 | "!ls -l tf/1" 30 | ] 31 | }, 32 | { 33 | "cell_type": "markdown", 34 | "metadata": {}, 35 | "source": [ 36 | "## Running a local TensorFlow server" 37 | ] 38 | }, 39 | { 40 | "cell_type": "code", 41 | "execution_count": null, 42 | "metadata": {}, 43 | "outputs": [], 44 | "source": [ 45 | "# https://www.tensorflow.org/serving/\n", 46 | "# https://github.com/tensorflow/serving/blob/master/tensorflow_serving/g3doc/setup.md#tensorflow-serving-python-api-pip-package-pip\n", 47 | "\n", 48 | "!tensorflow_model_server --port=9000 --model_name=manning_insurance_1 --model_base_path=$(pwd)/tf" 49 | ] 50 | }, 51 | { 52 | "cell_type": "markdown", 53 | "metadata": {}, 54 | "source": [ 55 | "## Running as a REST server" 56 | ] 57 | }, 58 | { 59 | "cell_type": "code", 60 | "execution_count": null, 61 | "metadata": {}, 62 | "outputs": [], 63 | "source": [ 64 | "# https://www.tensorflow.org/serving/api_rest\n", 65 | "\n", 66 | "!tensorflow_model_server --rest_api_port=8501 \\\n", 67 | " --model_name=manning_insurance_1 \\\n", 68 | " --model_base_path=$(pwd)/tf" 69 | ] 70 | }, 71 | { 72 | "cell_type": "code", 73 | "execution_count": 2, 74 | "metadata": {}, 75 | "outputs": [ 76 | { 77 | "name": "stdout", 78 | "output_type": "stream", 79 | "text": [ 80 | "{ \"error\": \"JSON Parse error: Invalid value. at offset: 0\" }\n" 81 | ] 82 | }, 83 | { 84 | "name": "stderr", 85 | "output_type": "stream", 86 | "text": [ 87 | " % Total % Received % Xferd Average Speed Time Time Time Current\n", 88 | " Dload Upload Total Spent Left Speed\n", 89 | "\n", 90 | " 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\n", 91 | " 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: instances\n", 92 | "curl: (3) [globbing] bad range specification in column 2\n", 93 | "curl: (3) [globbing] bad range specification in column 2\n", 94 | "curl: (6) Could not resolve host: 100.0,\n", 95 | "curl: (6) Could not resolve host: 47.0,\n", 96 | "curl: (3) [globbing] unmatched close brace/bracket in column 5\n", 97 | "\n", 98 | "100 62 100 60 100 2 60000 2000 --:--:-- --:--:-- --:--:-- 62000\n" 99 | ] 100 | } 101 | ], 102 | "source": [ 103 | "!curl -d '{ \"instances\": [{\"inputs\": [ 100.0, 47.0, 10.0]}]}' -X POST http://localhost:8501/v1/models/manning_insurance_1:predict\n", 104 | "# {\n", 105 | "# \"predictions\": [[0.0027608, 0.872088, 0.125151]\n", 106 | "# ]\n", 107 | "# }" 108 | ] 109 | } 110 | ], 111 | "metadata": { 112 | "kernelspec": { 113 | "display_name": "Python 3", 114 | "language": "python", 115 | "name": "python3" 116 | }, 117 | "language_info": { 118 | "codemirror_mode": { 119 | "name": "ipython", 120 | "version": 3 121 | }, 122 | "file_extension": ".py", 123 | "mimetype": "text/x-python", 124 | "name": "python", 125 | "nbconvert_exporter": "python", 126 | "pygments_lexer": "ipython3", 127 | "version": "3.6.6" 128 | } 129 | }, 130 | "nbformat": 4, 131 | "nbformat_minor": 1 132 | } 133 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |You can check the risk group for a prospective customer simply by providing three inputs
28 |
4 |
5 | This repository contains notebooks implementing the code samples found in the video course [Deep Learning Crash Course (Manning Publications)](https://www.manning.com/livevideo/deep-learning-crash-course?a_aid=djcordhose&a_bid=e8e77cbf). Note that the video course features far more content than you will find in these notebooks, in particular further explanations and figures. Here we have only included the code samples themselves and immediately related surrounding comments.
6 |
7 | ## Our Crash Risk Calculator running on TensorFlow.js
8 |
9 | In this course we train a model that can predict the crash risk of a driver based on three simple inputs.
10 | We train the model using Colab notebooks on Google's GPU based hardware and convert the final model to a format
11 | TensorFlow.js supports. This allows us to deploy the
12 | model togther with a simple application that runs serverless in the browser.
13 |
14 | Try is out here (you will need an up to version of a modern browser to do this):
15 |
16 |
17 |
18 |
19 |
20 | https://djcordhose.github.io/deep-learning-crash-course-notebooks/
21 |
22 |
23 | ## Original Notebooks
24 |
25 | These notebooks have been created using Python 3.6 and TensorFlow 1.x
26 |
27 | * Unit 3:
28 | * [Notebook 3.3: Getting to know our data](https://colab.research.google.com/github/djcordhose/deep-learning-crash-course-notebooks/blob/master/U3-M3-data.ipynb)
29 | * [Notebook 3.5: Introduction to Neural Networks with TensorFlow and Keras Layers](https://colab.research.google.com/github/djcordhose/deep-learning-crash-course-notebooks/blob/master/U3-M5-nn-intro.ipynb)
30 | * [Notebook 3.7: Training Neural Networks with TensorFlow and Keras Layers](https://colab.research.google.com/github/djcordhose/deep-learning-crash-course-notebooks/blob/master/U3-M7-nn-training.ipynb)
31 | * [Exercise 3.7: Draw Decision Boundaries by hand](https://raw.githubusercontent.com/DJCordhose/deep-learning-crash-course-notebooks/master/exercise/manual-decision-boundaries.pdf)
32 | * [Notebook 3.9: Regularization - How to get a decent architecture?](https://colab.research.google.com/github/djcordhose/deep-learning-crash-course-notebooks/blob/master/U3-M9-regularization.ipynb)
33 | * [Notebook 3.10: Our Final TensorFlow Model](https://colab.research.google.com/github/djcordhose/deep-learning-crash-course-notebooks/blob/master/U3-M10-final-model.ipynb)
34 |
35 | * Unit 4:
36 | * [Notebook 4.2: Converting our Keras model for tensorflow.js](https://colab.research.google.com/github/djcordhose/deep-learning-crash-course-notebooks/blob/master/U4-M2-tensorflowjs.ipynb)
37 | * [Notebook 4.4: Preparing our Keras model for serving](https://colab.research.google.com/github/djcordhose/deep-learning-crash-course-notebooks/blob/master/U4-M4-tf-prep.ipynb)
38 | * [Notebook 4.5: Checking our TensorFlow model](https://colab.research.google.com/github/djcordhose/deep-learning-crash-course-notebooks/blob/master/U4-M5-tf-check.ipynb)
39 | * [Notebook 4.6: Hosting your model on Google Cloud ML](https://colab.research.google.com/github/djcordhose/deep-learning-crash-course-notebooks/blob/master/U4-M6-cloud.ipynb)
40 | * [Notebook 4.7: Running on a dedicated Linux server](https://colab.research.google.com/github/djcordhose/deep-learning-crash-course-notebooks/blob/master/U4-M7-local.ipynb)
41 |
42 | ## TensorFlow 2
43 |
44 | TensorFlow models from Unit 3 converted to TensorFlow 2
45 |
46 | * Unit 3 converted to TensorFlow 2:
47 | * [Notebook 3.5 / TF 2: Introduction to Neural Networks with TensorFlow 2 and Keras Layers](https://colab.research.google.com/github/djcordhose/deep-learning-crash-course-notebooks/blob/master/tf-v2/U3-M5-nn-intro.ipynb)
48 | * [Notebook 3.7 / TF 2: Training Neural Networks with TensorFlow 2 and Keras Layers](https://colab.research.google.com/github/djcordhose/deep-learning-crash-course-notebooks/blob/master/tf-v2/U3-M7-nn-training.ipynb)
49 | * [Notebook 3.9 / TF 2: Regularization - How to get a decent architecture?](https://colab.research.google.com/github/djcordhose/deep-learning-crash-course-notebooks/blob/master/tf-v2/U3-M9-regularization.ipynb)
50 | * [Notebook 3.10 / TF 2: Our Final TensorFlow 2 Model](https://colab.research.google.com/github/djcordhose/deep-learning-crash-course-notebooks/blob/master/tf-v2/U3-M10-final-model.ipynb)
51 |
52 | ## Data related notebooks
53 |
54 | * [Generating Sample Data from Distributions](https://colab.research.google.com/github/DJCordhose/deep-learning-crash-course-notebooks/blob/master/data/generate.ipynb)
55 | * [Analyzing our dataset using Google's What-if Tool](https://colab.research.google.com/github/DJCordhose/deep-learning-crash-course-notebooks/blob/master/data/what-if.ipynb)
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/docs/bootstrap/css/.DS_Store:
--------------------------------------------------------------------------------
1 | Bud1 % @ � @ � @ � @ E % DSDB ` � @ � @ � @
--------------------------------------------------------------------------------
/docs/bootstrap/css/bootstrap-reboot.css:
--------------------------------------------------------------------------------
1 | /*!
2 | * Bootstrap Reboot v4.1.3 (https://getbootstrap.com/)
3 | * Copyright 2011-2018 The Bootstrap Authors
4 | * Copyright 2011-2018 Twitter, Inc.
5 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
6 | * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
7 | */
8 | *,
9 | *::before,
10 | *::after {
11 | box-sizing: border-box;
12 | }
13 |
14 | html {
15 | font-family: sans-serif;
16 | line-height: 1.15;
17 | -webkit-text-size-adjust: 100%;
18 | -ms-text-size-adjust: 100%;
19 | -ms-overflow-style: scrollbar;
20 | -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
21 | }
22 |
23 | @-ms-viewport {
24 | width: device-width;
25 | }
26 |
27 | article, aside, figcaption, figure, footer, header, hgroup, main, nav, section {
28 | display: block;
29 | }
30 |
31 | body {
32 | margin: 0;
33 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
34 | font-size: 1rem;
35 | font-weight: 400;
36 | line-height: 1.5;
37 | color: #212529;
38 | text-align: left;
39 | background-color: #fff;
40 | }
41 |
42 | [tabindex="-1"]:focus {
43 | outline: 0 !important;
44 | }
45 |
46 | hr {
47 | box-sizing: content-box;
48 | height: 0;
49 | overflow: visible;
50 | }
51 |
52 | h1, h2, h3, h4, h5, h6 {
53 | margin-top: 0;
54 | margin-bottom: 0.5rem;
55 | }
56 |
57 | p {
58 | margin-top: 0;
59 | margin-bottom: 1rem;
60 | }
61 |
62 | abbr[title],
63 | abbr[data-original-title] {
64 | text-decoration: underline;
65 | -webkit-text-decoration: underline dotted;
66 | text-decoration: underline dotted;
67 | cursor: help;
68 | border-bottom: 0;
69 | }
70 |
71 | address {
72 | margin-bottom: 1rem;
73 | font-style: normal;
74 | line-height: inherit;
75 | }
76 |
77 | ol,
78 | ul,
79 | dl {
80 | margin-top: 0;
81 | margin-bottom: 1rem;
82 | }
83 |
84 | ol ol,
85 | ul ul,
86 | ol ul,
87 | ul ol {
88 | margin-bottom: 0;
89 | }
90 |
91 | dt {
92 | font-weight: 700;
93 | }
94 |
95 | dd {
96 | margin-bottom: .5rem;
97 | margin-left: 0;
98 | }
99 |
100 | blockquote {
101 | margin: 0 0 1rem;
102 | }
103 |
104 | dfn {
105 | font-style: italic;
106 | }
107 |
108 | b,
109 | strong {
110 | font-weight: bolder;
111 | }
112 |
113 | small {
114 | font-size: 80%;
115 | }
116 |
117 | sub,
118 | sup {
119 | position: relative;
120 | font-size: 75%;
121 | line-height: 0;
122 | vertical-align: baseline;
123 | }
124 |
125 | sub {
126 | bottom: -.25em;
127 | }
128 |
129 | sup {
130 | top: -.5em;
131 | }
132 |
133 | a {
134 | color: #007bff;
135 | text-decoration: none;
136 | background-color: transparent;
137 | -webkit-text-decoration-skip: objects;
138 | }
139 |
140 | a:hover {
141 | color: #0056b3;
142 | text-decoration: underline;
143 | }
144 |
145 | a:not([href]):not([tabindex]) {
146 | color: inherit;
147 | text-decoration: none;
148 | }
149 |
150 | a:not([href]):not([tabindex]):hover, a:not([href]):not([tabindex]):focus {
151 | color: inherit;
152 | text-decoration: none;
153 | }
154 |
155 | a:not([href]):not([tabindex]):focus {
156 | outline: 0;
157 | }
158 |
159 | pre,
160 | code,
161 | kbd,
162 | samp {
163 | font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
164 | font-size: 1em;
165 | }
166 |
167 | pre {
168 | margin-top: 0;
169 | margin-bottom: 1rem;
170 | overflow: auto;
171 | -ms-overflow-style: scrollbar;
172 | }
173 |
174 | figure {
175 | margin: 0 0 1rem;
176 | }
177 |
178 | img {
179 | vertical-align: middle;
180 | border-style: none;
181 | }
182 |
183 | svg {
184 | overflow: hidden;
185 | vertical-align: middle;
186 | }
187 |
188 | table {
189 | border-collapse: collapse;
190 | }
191 |
192 | caption {
193 | padding-top: 0.75rem;
194 | padding-bottom: 0.75rem;
195 | color: #6c757d;
196 | text-align: left;
197 | caption-side: bottom;
198 | }
199 |
200 | th {
201 | text-align: inherit;
202 | }
203 |
204 | label {
205 | display: inline-block;
206 | margin-bottom: 0.5rem;
207 | }
208 |
209 | button {
210 | border-radius: 0;
211 | }
212 |
213 | button:focus {
214 | outline: 1px dotted;
215 | outline: 5px auto -webkit-focus-ring-color;
216 | }
217 |
218 | input,
219 | button,
220 | select,
221 | optgroup,
222 | textarea {
223 | margin: 0;
224 | font-family: inherit;
225 | font-size: inherit;
226 | line-height: inherit;
227 | }
228 |
229 | button,
230 | input {
231 | overflow: visible;
232 | }
233 |
234 | button,
235 | select {
236 | text-transform: none;
237 | }
238 |
239 | button,
240 | html [type="button"],
241 | [type="reset"],
242 | [type="submit"] {
243 | -webkit-appearance: button;
244 | }
245 |
246 | button::-moz-focus-inner,
247 | [type="button"]::-moz-focus-inner,
248 | [type="reset"]::-moz-focus-inner,
249 | [type="submit"]::-moz-focus-inner {
250 | padding: 0;
251 | border-style: none;
252 | }
253 |
254 | input[type="radio"],
255 | input[type="checkbox"] {
256 | box-sizing: border-box;
257 | padding: 0;
258 | }
259 |
260 | input[type="date"],
261 | input[type="time"],
262 | input[type="datetime-local"],
263 | input[type="month"] {
264 | -webkit-appearance: listbox;
265 | }
266 |
267 | textarea {
268 | overflow: auto;
269 | resize: vertical;
270 | }
271 |
272 | fieldset {
273 | min-width: 0;
274 | padding: 0;
275 | margin: 0;
276 | border: 0;
277 | }
278 |
279 | legend {
280 | display: block;
281 | width: 100%;
282 | max-width: 100%;
283 | padding: 0;
284 | margin-bottom: .5rem;
285 | font-size: 1.5rem;
286 | line-height: inherit;
287 | color: inherit;
288 | white-space: normal;
289 | }
290 |
291 | progress {
292 | vertical-align: baseline;
293 | }
294 |
295 | [type="number"]::-webkit-inner-spin-button,
296 | [type="number"]::-webkit-outer-spin-button {
297 | height: auto;
298 | }
299 |
300 | [type="search"] {
301 | outline-offset: -2px;
302 | -webkit-appearance: none;
303 | }
304 |
305 | [type="search"]::-webkit-search-cancel-button,
306 | [type="search"]::-webkit-search-decoration {
307 | -webkit-appearance: none;
308 | }
309 |
310 | ::-webkit-file-upload-button {
311 | font: inherit;
312 | -webkit-appearance: button;
313 | }
314 |
315 | output {
316 | display: inline-block;
317 | }
318 |
319 | summary {
320 | display: list-item;
321 | cursor: pointer;
322 | }
323 |
324 | template {
325 | display: none;
326 | }
327 |
328 | [hidden] {
329 | display: none !important;
330 | }
331 | /*# sourceMappingURL=bootstrap-reboot.css.map */
--------------------------------------------------------------------------------
/data/insurance-customers-300.csv:
--------------------------------------------------------------------------------
1 | speed;age;miles;group
2 | 117.0;41.0;5.0;1
3 | 108.0;18.0;15.0;1
4 | 107.0;28.0;14.0;2
5 | 111.0;43.0;62.0;2
6 | 129.0;36.0;42.0;0
7 | 144.0;39.0;43.0;1
8 | 150.0;39.0;51.0;0
9 | 147.0;33.0;36.0;1
10 | 123.0;74.0;21.0;0
11 | 101.0;45.0;26.0;1
12 | 112.0;18.0;38.0;0
13 | 106.0;86.0;19.0;0
14 | 108.0;36.0;33.0;0
15 | 138.0;43.0;38.0;1
16 | 151.0;27.0;43.0;0
17 | 115.0;60.0;34.0;1
18 | 122.0;36.0;27.0;1
19 | 107.0;37.0;4.0;1
20 | 115.0;33.0;59.0;2
21 | 108.0;43.0;17.0;1
22 | 105.0;70.0;48.0;2
23 | 147.0;33.0;54.0;0
24 | 111.0;23.0;13.0;2
25 | 121.0;22.0;44.0;0
26 | 97.0;55.0;45.0;1
27 | 135.0;30.0;57.0;2
28 | 110.0;51.0;47.0;1
29 | 112.0;53.0;19.0;1
30 | 124.0;56.0;18.0;2
31 | 130.0;75.0;47.0;2
32 | 121.0;52.0;33.0;2
33 | 113.0;42.0;26.0;1
34 | 112.0;65.0;29.0;0
35 | 85.0;52.0;41.0;2
36 | 134.0;29.0;29.0;2
37 | 115.0;83.0;19.0;0
38 | 131.0;37.0;40.0;1
39 | 99.0;60.0;32.0;1
40 | 149.0;29.0;48.0;0
41 | 114.0;67.0;27.0;1
42 | 146.0;29.0;51.0;2
43 | 121.0;45.0;18.0;0
44 | 132.0;83.0;37.0;0
45 | 132.0;82.0;19.0;0
46 | 115.0;58.0;16.0;0
47 | 112.0;39.0;27.0;1
48 | 121.0;35.0;36.0;0
49 | 95.0;38.0;39.0;2
50 | 149.0;36.0;54.0;0
51 | 138.0;50.0;37.0;1
52 | 150.0;39.0;47.0;0
53 | 135.0;28.0;35.0;0
54 | 151.0;33.0;52.0;0
55 | 114.0;76.0;23.0;0
56 | 158.0;74.0;3.0;2
57 | 108.0;46.0;30.0;1
58 | 120.0;75.0;16.0;0
59 | 138.0;69.0;13.0;0
60 | 121.0;41.0;31.0;0
61 | 129.0;43.0;50.0;2
62 | 114.0;42.0;9.0;1
63 | 107.0;43.0;24.0;1
64 | 97.0;22.0;12.0;2
65 | 152.0;33.0;49.0;0
66 | 151.0;41.0;48.0;0
67 | 127.0;82.0;30.0;0
68 | 112.0;57.0;25.0;1
69 | 114.0;57.0;42.0;1
70 | 100.0;26.0;23.0;2
71 | 113.0;57.0;42.0;2
72 | 99.0;16.0;42.0;0
73 | 129.0;64.0;99.0;2
74 | 122.0;75.0;21.0;0
75 | 112.0;53.0;19.0;1
76 | 120.0;68.0;21.0;0
77 | 141.0;45.0;39.0;1
78 | 101.0;36.0;19.0;1
79 | 125.0;68.0;37.0;0
80 | 128.0;69.0;13.0;2
81 | 120.0;43.0;34.0;1
82 | 154.0;39.0;47.0;0
83 | 119.0;39.0;21.0;0
84 | 135.0;43.0;42.0;1
85 | 97.0;26.0;15.0;2
86 | 133.0;35.0;32.0;2
87 | 138.0;47.0;42.0;1
88 | 118.0;36.0;37.0;0
89 | 126.0;70.0;41.0;2
90 | 151.0;38.0;51.0;0
91 | 161.0;49.0;59.0;2
92 | 99.0;21.0;8.0;2
93 | 156.0;38.0;48.0;0
94 | 140.0;56.0;44.0;2
95 | 100.0;46.0;13.0;1
96 | 119.0;38.0;6.0;1
97 | 122.0;71.0;16.0;0
98 | 136.0;53.0;57.0;2
99 | 130.0;54.0;39.0;2
100 | 102.0;28.0;25.0;2
101 | 98.0;23.0;16.0;2
102 | 132.0;34.0;50.0;2
103 | 111.0;36.0;40.0;0
104 | 136.0;45.0;36.0;1
105 | 114.0;48.0;31.0;1
106 | 110.0;16.0;41.0;0
107 | 97.0;28.0;16.0;2
108 | 122.0;50.0;66.0;2
109 | 97.0;21.0;17.0;2
110 | 104.0;19.0;12.0;0
111 | 140.0;53.0;42.0;1
112 | 143.0;40.0;40.0;1
113 | 109.0;48.0;30.0;0
114 | 141.0;40.0;43.0;1
115 | 106.0;51.0;21.0;2
116 | 137.0;17.0;35.0;0
117 | 137.0;43.0;37.0;1
118 | 100.0;37.0;28.0;1
119 | 111.0;40.0;28.0;1
120 | 116.0;42.0;15.0;1
121 | 137.0;35.0;66.0;2
122 | 118.0;73.0;29.0;0
123 | 112.0;57.0;14.0;1
124 | 105.0;36.0;26.0;1
125 | 130.0;63.0;46.0;2
126 | 120.0;80.0;18.0;0
127 | 111.0;44.0;45.0;2
128 | 107.0;32.0;2.0;1
129 | 115.0;68.0;22.0;0
130 | 132.0;45.0;34.0;1
131 | 94.0;47.0;32.0;2
132 | 135.0;84.0;16.0;0
133 | 130.0;70.0;24.0;0
134 | 122.0;33.0;26.0;2
135 | 103.0;31.0;19.0;2
136 | 112.0;25.0;20.0;0
137 | 156.0;34.0;49.0;0
138 | 125.0;44.0;26.0;2
139 | 95.0;30.0;14.0;2
140 | 111.0;78.0;17.0;2
141 | 116.0;41.0;32.0;1
142 | 123.0;43.0;45.0;2
143 | 115.0;45.0;13.0;1
144 | 124.0;87.0;19.0;0
145 | 140.0;56.0;11.0;2
146 | 117.0;42.0;38.0;1
147 | 110.0;55.0;47.0;2
148 | 125.0;25.0;23.0;0
149 | 126.0;20.0;29.0;0
150 | 131.0;55.0;32.0;2
151 | 137.0;31.0;36.0;2
152 | 100.0;54.0;17.0;1
153 | 148.0;42.0;50.0;0
154 | 109.0;36.0;23.0;1
155 | 149.0;33.0;68.0;2
156 | 126.0;80.0;25.0;0
157 | 101.0;31.0;11.0;2
158 | 119.0;21.0;16.0;0
159 | 96.0;52.0;14.0;1
160 | 110.0;42.0;14.0;1
161 | 121.0;43.0;30.0;1
162 | 144.0;40.0;44.0;1
163 | 123.0;23.0;44.0;0
164 | 146.0;47.0;38.0;1
165 | 119.0;16.0;12.0;2
166 | 107.0;33.0;12.0;2
167 | 114.0;73.0;22.0;0
168 | 114.0;49.0;17.0;1
169 | 107.0;49.0;6.0;1
170 | 148.0;35.0;45.0;0
171 | 143.0;39.0;77.0;2
172 | 102.0;26.0;17.0;2
173 | 101.0;29.0;15.0;2
174 | 119.0;21.0;25.0;0
175 | 98.0;24.0;8.0;2
176 | 96.0;25.0;24.0;2
177 | 120.0;16.0;29.0;0
178 | 143.0;44.0;42.0;1
179 | 123.0;81.0;17.0;0
180 | 99.0;23.0;22.0;2
181 | 145.0;42.0;39.0;1
182 | 135.0;42.0;44.0;1
183 | 135.0;36.0;38.0;1
184 | 97.0;25.0;13.0;2
185 | 98.0;55.0;28.0;1
186 | 130.0;50.0;56.0;2
187 | 115.0;43.0;45.0;2
188 | 122.0;72.0;53.0;2
189 | 149.0;35.0;44.0;0
190 | 127.0;54.0;14.0;1
191 | 124.0;44.0;31.0;2
192 | 118.0;36.0;44.0;0
193 | 136.0;41.0;47.0;2
194 | 100.0;28.0;9.0;2
195 | 132.0;49.0;44.0;2
196 | 137.0;57.0;58.0;2
197 | 112.0;31.0;35.0;1
198 | 148.0;32.0;52.0;0
199 | 101.0;30.0;8.0;2
200 | 147.0;36.0;56.0;0
201 | 150.0;41.0;40.0;0
202 | 96.0;46.0;33.0;1
203 | 97.0;31.0;22.0;2
204 | 146.0;43.0;30.0;1
205 | 122.0;23.0;17.0;0
206 | 132.0;46.0;44.0;2
207 | 125.0;21.0;28.0;0
208 | 114.0;75.0;24.0;0
209 | 136.0;52.0;35.0;2
210 | 152.0;34.0;53.0;0
211 | 113.0;79.0;9.0;0
212 | 144.0;41.0;40.0;1
213 | 146.0;46.0;42.0;1
214 | 105.0;30.0;33.0;0
215 | 148.0;31.0;51.0;0
216 | 107.0;46.0;19.0;1
217 | 142.0;43.0;41.0;1
218 | 105.0;45.0;43.0;2
219 | 114.0;55.0;26.0;1
220 | 117.0;39.0;27.0;1
221 | 148.0;34.0;46.0;0
222 | 105.0;36.0;15.0;1
223 | 120.0;37.0;38.0;2
224 | 137.0;45.0;39.0;1
225 | 114.0;82.0;21.0;0
226 | 106.0;53.0;39.0;2
227 | 143.0;56.0;41.0;1
228 | 150.0;27.0;49.0;0
229 | 138.0;43.0;46.0;2
230 | 98.0;31.0;11.0;2
231 | 127.0;32.0;47.0;2
232 | 103.0;30.0;21.0;2
233 | 143.0;50.0;53.0;2
234 | 135.0;83.0;15.0;0
235 | 149.0;33.0;44.0;0
236 | 122.0;63.0;9.0;0
237 | 132.0;26.0;22.0;2
238 | 115.0;25.0;28.0;0
239 | 150.0;62.0;23.0;2
240 | 120.0;67.0;20.0;0
241 | 150.0;34.0;44.0;0
242 | 108.0;53.0;25.0;1
243 | 101.0;37.0;12.0;2
244 | 139.0;46.0;28.0;0
245 | 126.0;43.0;46.0;2
246 | 123.0;36.0;7.0;1
247 | 152.0;33.0;48.0;0
248 | 127.0;49.0;52.0;2
249 | 121.0;43.0;28.0;2
250 | 144.0;37.0;43.0;1
251 | 104.0;31.0;29.0;1
252 | 153.0;35.0;49.0;0
253 | 108.0;28.0;13.0;1
254 | 103.0;49.0;28.0;1
255 | 104.0;30.0;1.0;1
256 | 137.0;45.0;36.0;1
257 | 123.0;58.0;40.0;0
258 | 159.0;66.0;1.0;2
259 | 130.0;62.0;15.0;0
260 | 151.0;36.0;50.0;0
261 | 147.0;33.0;54.0;0
262 | 146.0;29.0;56.0;0
263 | 117.0;50.0;21.0;1
264 | 119.0;34.0;33.0;2
265 | 128.0;30.0;43.0;0
266 | 122.0;45.0;15.0;1
267 | 137.0;48.0;36.0;1
268 | 105.0;22.0;22.0;2
269 | 109.0;40.0;24.0;1
270 | 118.0;78.0;13.0;0
271 | 145.0;38.0;55.0;0
272 | 141.0;49.0;33.0;1
273 | 109.0;28.0;13.0;2
274 | 92.0;33.0;24.0;2
275 | 139.0;49.0;29.0;1
276 | 131.0;40.0;15.0;1
277 | 139.0;52.0;43.0;2
278 | 141.0;43.0;36.0;1
279 | 95.0;20.0;11.0;2
280 | 112.0;49.0;8.0;1
281 | 106.0;34.0;16.0;1
282 | 123.0;48.0;49.0;1
283 | 106.0;38.0;12.0;2
284 | 97.0;23.0;16.0;2
285 | 121.0;97.0;1.0;2
286 | 114.0;20.0;45.0;0
287 | 150.0;49.0;38.0;1
288 | 108.0;52.0;1.0;1
289 | 151.0;28.0;51.0;0
290 | 113.0;30.0;22.0;1
291 | 113.0;72.0;23.0;0
292 | 114.0;32.0;29.0;0
293 | 124.0;43.0;22.0;1
294 | 151.0;27.0;45.0;0
295 | 119.0;50.0;1.0;1
296 | 98.0;30.0;18.0;2
297 | 146.0;38.0;45.0;0
298 | 107.0;67.0;17.0;2
299 | 111.0;41.0;21.0;1
300 | 123.0;58.0;57.0;2
301 | 136.0;33.0;24.0;2
302 |
--------------------------------------------------------------------------------
/data/insurance-customers-500-test.csv:
--------------------------------------------------------------------------------
1 | speed;age;miles;group
2 | 96.0;26.0;29.0;2
3 | 113.0;43.0;28.0;0
4 | 108.0;64.0;33.0;1
5 | 148.0;32.0;51.0;0
6 | 148.0;36.0;52.0;0
7 | 102.0;38.0;5.0;1
8 | 114.0;53.0;18.0;2
9 | 131.0;37.0;76.0;2
10 | 99.0;48.0;24.0;1
11 | 115.0;62.0;10.0;2
12 | 120.0;53.0;36.0;0
13 | 109.0;42.0;31.0;1
14 | 151.0;44.0;39.0;1
15 | 116.0;57.0;38.0;1
16 | 115.0;73.0;29.0;0
17 | 144.0;38.0;37.0;1
18 | 133.0;37.0;30.0;2
19 | 139.0;38.0;32.0;1
20 | 144.0;34.0;46.0;0
21 | 148.0;47.0;47.0;1
22 | 144.0;49.0;47.0;1
23 | 120.0;41.0;32.0;0
24 | 106.0;21.0;17.0;2
25 | 118.0;49.0;16.0;1
26 | 121.0;43.0;63.0;2
27 | 127.0;58.0;44.0;2
28 | 151.0;30.0;51.0;0
29 | 117.0;48.0;28.0;1
30 | 116.0;65.0;8.0;0
31 | 104.0;23.0;37.0;0
32 | 116.0;72.0;34.0;1
33 | 102.0;57.0;12.0;1
34 | 130.0;22.0;46.0;0
35 | 141.0;28.0;25.0;0
36 | 146.0;43.0;36.0;1
37 | 149.0;33.0;48.0;0
38 | 120.0;27.0;32.0;0
39 | 140.0;37.0;29.0;2
40 | 102.0;23.0;17.0;2
41 | 122.0;43.0;28.0;1
42 | 126.0;65.0;49.0;2
43 | 115.0;79.0;16.0;0
44 | 154.0;32.0;48.0;0
45 | 131.0;51.0;54.0;1
46 | 141.0;34.0;54.0;0
47 | 127.0;54.0;1.0;2
48 | 150.0;39.0;49.0;1
49 | 101.0;82.0;18.0;0
50 | 103.0;28.0;16.0;2
51 | 102.0;45.0;23.0;1
52 | 124.0;28.0;38.0;2
53 | 132.0;42.0;39.0;2
54 | 113.0;47.0;12.0;1
55 | 127.0;55.0;39.0;2
56 | 148.0;33.0;42.0;0
57 | 91.0;51.0;53.0;2
58 | 138.0;50.0;45.0;1
59 | 109.0;59.0;26.0;2
60 | 152.0;40.0;47.0;0
61 | 130.0;42.0;43.0;1
62 | 88.0;47.0;29.0;2
63 | 115.0;30.0;18.0;1
64 | 112.0;80.0;26.0;0
65 | 105.0;16.0;33.0;0
66 | 136.0;41.0;44.0;2
67 | 106.0;25.0;26.0;2
68 | 147.0;57.0;40.0;2
69 | 125.0;83.0;26.0;0
70 | 145.0;44.0;34.0;1
71 | 94.0;28.0;15.0;2
72 | 128.0;70.0;28.0;0
73 | 135.0;40.0;46.0;2
74 | 94.0;19.0;17.0;2
75 | 99.0;48.0;23.0;1
76 | 128.0;76.0;14.0;0
77 | 108.0;63.0;15.0;2
78 | 126.0;60.0;58.0;2
79 | 110.0;46.0;29.0;1
80 | 151.0;32.0;46.0;0
81 | 120.0;27.0;38.0;0
82 | 100.0;24.0;12.0;2
83 | 114.0;21.0;27.0;0
84 | 108.0;39.0;38.0;2
85 | 151.0;33.0;51.0;0
86 | 129.0;41.0;54.0;2
87 | 126.0;56.0;56.0;2
88 | 145.0;63.0;27.0;2
89 | 107.0;22.0;19.0;2
90 | 112.0;58.0;22.0;1
91 | 108.0;40.0;9.0;0
92 | 123.0;55.0;39.0;2
93 | 126.0;78.0;46.0;2
94 | 120.0;80.0;14.0;0
95 | 153.0;36.0;49.0;0
96 | 125.0;47.0;40.0;0
97 | 106.0;41.0;13.0;1
98 | 103.0;55.0;30.0;1
99 | 87.0;53.0;17.0;2
100 | 125.0;48.0;70.0;2
101 | 149.0;33.0;53.0;0
102 | 108.0;46.0;7.0;1
103 | 140.0;42.0;43.0;2
104 | 123.0;29.0;22.0;0
105 | 108.0;28.0;19.0;1
106 | 106.0;53.0;9.0;1
107 | 124.0;77.0;10.0;0
108 | 145.0;46.0;20.0;2
109 | 100.0;28.0;10.0;2
110 | 113.0;33.0;1.0;1
111 | 97.0;29.0;2.0;2
112 | 98.0;17.0;19.0;2
113 | 115.0;43.0;17.0;1
114 | 125.0;34.0;31.0;0
115 | 96.0;26.0;11.0;2
116 | 100.0;26.0;15.0;2
117 | 114.0;51.0;7.0;1
118 | 122.0;26.0;20.0;0
119 | 94.0;72.0;20.0;2
120 | 120.0;83.0;9.0;0
121 | 123.0;29.0;29.0;0
122 | 110.0;41.0;21.0;1
123 | 140.0;47.0;42.0;1
124 | 133.0;65.0;49.0;2
125 | 134.0;45.0;47.0;1
126 | 109.0;47.0;25.0;1
127 | 152.0;32.0;54.0;0
128 | 106.0;25.0;17.0;2
129 | 110.0;66.0;39.0;2
130 | 147.0;46.0;45.0;1
131 | 151.0;36.0;53.0;0
132 | 158.0;31.0;47.0;0
133 | 107.0;58.0;34.0;2
134 | 139.0;41.0;37.0;1
135 | 131.0;70.0;30.0;0
136 | 134.0;72.0;29.0;0
137 | 151.0;36.0;59.0;0
138 | 116.0;48.0;20.0;1
139 | 152.0;35.0;46.0;0
140 | 121.0;51.0;25.0;1
141 | 136.0;45.0;38.0;1
142 | 120.0;65.0;57.0;2
143 | 142.0;36.0;39.0;1
144 | 132.0;50.0;46.0;1
145 | 125.0;29.0;29.0;0
146 | 139.0;31.0;27.0;2
147 | 141.0;52.0;11.0;2
148 | 105.0;26.0;24.0;2
149 | 112.0;45.0;17.0;1
150 | 110.0;58.0;32.0;1
151 | 138.0;43.0;36.0;1
152 | 137.0;41.0;36.0;1
153 | 110.0;42.0;28.0;1
154 | 139.0;38.0;38.0;2
155 | 125.0;74.0;21.0;0
156 | 107.0;36.0;10.0;1
157 | 103.0;25.0;14.0;2
158 | 128.0;57.0;35.0;2
159 | 115.0;55.0;59.0;2
160 | 97.0;28.0;20.0;2
161 | 147.0;38.0;50.0;0
162 | 122.0;21.0;25.0;0
163 | 116.0;51.0;28.0;0
164 | 109.0;26.0;22.0;2
165 | 133.0;75.0;38.0;2
166 | 107.0;61.0;12.0;1
167 | 105.0;41.0;14.0;0
168 | 130.0;54.0;38.0;1
169 | 105.0;25.0;26.0;0
170 | 125.0;50.0;27.0;2
171 | 115.0;69.0;13.0;0
172 | 114.0;42.0;16.0;1
173 | 136.0;45.0;25.0;0
174 | 115.0;63.0;10.0;0
175 | 140.0;58.0;48.0;1
176 | 134.0;67.0;30.0;2
177 | 133.0;44.0;36.0;1
178 | 122.0;16.0;39.0;2
179 | 113.0;37.0;34.0;0
180 | 143.0;58.0;54.0;2
181 | 127.0;90.0;17.0;0
182 | 102.0;47.0;31.0;1
183 | 126.0;69.0;23.0;0
184 | 145.0;43.0;43.0;1
185 | 147.0;33.0;60.0;0
186 | 118.0;55.0;27.0;1
187 | 115.0;39.0;35.0;1
188 | 100.0;25.0;12.0;2
189 | 106.0;25.0;12.0;2
190 | 142.0;38.0;57.0;0
191 | 112.0;43.0;2.0;1
192 | 116.0;76.0;25.0;0
193 | 152.0;40.0;52.0;0
194 | 127.0;86.0;17.0;0
195 | 120.0;27.0;29.0;1
196 | 96.0;32.0;10.0;2
197 | 97.0;23.0;18.0;2
198 | 139.0;38.0;37.0;1
199 | 152.0;34.0;54.0;0
200 | 146.0;32.0;45.0;0
201 | 152.0;32.0;52.0;0
202 | 129.0;34.0;24.0;0
203 | 123.0;30.0;15.0;0
204 | 131.0;44.0;45.0;2
205 | 106.0;42.0;11.0;1
206 | 111.0;45.0;14.0;1
207 | 128.0;33.0;20.0;2
208 | 104.0;52.0;14.0;1
209 | 137.0;47.0;34.0;1
210 | 101.0;52.0;39.0;2
211 | 96.0;50.0;26.0;1
212 | 112.0;41.0;19.0;1
213 | 124.0;58.0;69.0;2
214 | 106.0;42.0;47.0;0
215 | 95.0;27.0;5.0;2
216 | 103.0;73.0;14.0;0
217 | 150.0;31.0;50.0;0
218 | 100.0;81.0;30.0;1
219 | 139.0;45.0;46.0;1
220 | 127.0;77.0;22.0;0
221 | 109.0;88.0;21.0;0
222 | 108.0;36.0;18.0;1
223 | 144.0;83.0;32.0;0
224 | 115.0;49.0;15.0;1
225 | 125.0;72.0;38.0;2
226 | 145.0;41.0;41.0;1
227 | 112.0;76.0;1.0;2
228 | 141.0;47.0;33.0;1
229 | 127.0;76.0;17.0;0
230 | 113.0;35.0;13.0;1
231 | 118.0;57.0;22.0;1
232 | 98.0;33.0;19.0;1
233 | 109.0;38.0;16.0;1
234 | 134.0;64.0;20.0;0
235 | 147.0;31.0;48.0;0
236 | 131.0;44.0;38.0;1
237 | 153.0;36.0;41.0;0
238 | 149.0;31.0;47.0;0
239 | 124.0;28.0;32.0;0
240 | 109.0;19.0;19.0;2
241 | 134.0;48.0;66.0;2
242 | 147.0;37.0;54.0;0
243 | 129.0;43.0;37.0;1
244 | 109.0;38.0;4.0;1
245 | 124.0;58.0;49.0;2
246 | 104.0;47.0;25.0;1
247 | 124.0;75.0;22.0;0
248 | 120.0;54.0;40.0;2
249 | 108.0;32.0;52.0;0
250 | 132.0;52.0;42.0;1
251 | 113.0;74.0;18.0;0
252 | 129.0;54.0;9.0;1
253 | 95.0;33.0;10.0;2
254 | 135.0;84.0;15.0;0
255 | 153.0;56.0;54.0;2
256 | 112.0;42.0;5.0;1
257 | 94.0;18.0;19.0;2
258 | 110.0;37.0;26.0;0
259 | 113.0;38.0;7.0;1
260 | 125.0;16.0;34.0;0
261 | 136.0;63.0;18.0;0
262 | 144.0;39.0;34.0;1
263 | 111.0;22.0;16.0;2
264 | 130.0;42.0;32.0;2
265 | 99.0;59.0;40.0;2
266 | 127.0;36.0;48.0;0
267 | 151.0;38.0;47.0;0
268 | 115.0;41.0;19.0;1
269 | 106.0;54.0;24.0;1
270 | 138.0;48.0;36.0;1
271 | 119.0;28.0;37.0;1
272 | 149.0;38.0;52.0;0
273 | 121.0;40.0;20.0;1
274 | 117.0;76.0;51.0;2
275 | 107.0;31.0;21.0;1
276 | 122.0;37.0;29.0;0
277 | 139.0;46.0;32.0;1
278 | 146.0;31.0;53.0;0
279 | 113.0;32.0;35.0;0
280 | 133.0;47.0;44.0;1
281 | 108.0;56.0;18.0;1
282 | 113.0;54.0;25.0;1
283 | 97.0;27.0;10.0;2
284 | 119.0;26.0;33.0;0
285 | 109.0;46.0;34.0;1
286 | 118.0;39.0;28.0;1
287 | 121.0;52.0;10.0;1
288 | 111.0;17.0;43.0;0
289 | 119.0;33.0;24.0;1
290 | 160.0;61.0;60.0;2
291 | 101.0;45.0;22.0;2
292 | 111.0;79.0;31.0;2
293 | 154.0;32.0;48.0;0
294 | 127.0;76.0;7.0;0
295 | 127.0;35.0;27.0;0
296 | 138.0;48.0;31.0;1
297 | 154.0;32.0;52.0;0
298 | 93.0;51.0;18.0;1
299 | 94.0;52.0;10.0;2
300 | 105.0;41.0;40.0;1
301 | 99.0;23.0;19.0;2
302 | 119.0;50.0;15.0;1
303 | 121.0;45.0;3.0;1
304 | 106.0;36.0;39.0;0
305 | 107.0;68.0;27.0;0
306 | 109.0;41.0;19.0;1
307 | 117.0;79.0;62.0;2
308 | 132.0;40.0;35.0;0
309 | 155.0;38.0;56.0;0
310 | 121.0;77.0;40.0;0
311 | 140.0;49.0;57.0;2
312 | 146.0;35.0;38.0;1
313 | 117.0;59.0;29.0;1
314 | 119.0;48.0;58.0;2
315 | 92.0;21.0;7.0;2
316 | 141.0;33.0;53.0;0
317 | 129.0;31.0;30.0;2
318 | 152.0;29.0;47.0;0
319 | 137.0;42.0;49.0;1
320 | 139.0;38.0;50.0;2
321 | 143.0;35.0;50.0;0
322 | 110.0;45.0;33.0;1
323 | 110.0;17.0;14.0;2
324 | 115.0;42.0;11.0;1
325 | 103.0;23.0;14.0;2
326 | 98.0;27.0;17.0;2
327 | 115.0;45.0;1.0;2
328 | 137.0;51.0;58.0;2
329 | 106.0;34.0;25.0;2
330 | 133.0;58.0;25.0;0
331 | 111.0;48.0;20.0;1
332 | 130.0;63.0;44.0;2
333 | 104.0;27.0;17.0;1
334 | 134.0;44.0;41.0;2
335 | 121.0;40.0;35.0;1
336 | 151.0;36.0;49.0;0
337 | 93.0;28.0;16.0;2
338 | 120.0;51.0;22.0;1
339 | 149.0;36.0;43.0;0
340 | 122.0;77.0;28.0;0
341 | 119.0;68.0;5.0;2
342 | 123.0;46.0;18.0;2
343 | 94.0;26.0;22.0;2
344 | 140.0;47.0;35.0;1
345 | 129.0;90.0;13.0;0
346 | 98.0;27.0;19.0;2
347 | 118.0;79.0;13.0;0
348 | 119.0;22.0;12.0;0
349 | 99.0;25.0;12.0;2
350 | 97.0;66.0;25.0;2
351 | 152.0;33.0;48.0;0
352 | 129.0;61.0;28.0;2
353 | 149.0;34.0;57.0;0
354 | 155.0;43.0;50.0;0
355 | 115.0;74.0;32.0;0
356 | 144.0;40.0;20.0;2
357 | 116.0;75.0;20.0;0
358 | 136.0;49.0;37.0;1
359 | 115.0;68.0;10.0;0
360 | 144.0;46.0;41.0;1
361 | 105.0;28.0;7.0;2
362 | 112.0;32.0;28.0;0
363 | 100.0;25.0;11.0;2
364 | 123.0;53.0;48.0;2
365 | 125.0;20.0;34.0;0
366 | 136.0;49.0;37.0;1
367 | 143.0;40.0;35.0;1
368 | 131.0;35.0;32.0;1
369 | 120.0;44.0;33.0;0
370 | 130.0;27.0;36.0;0
371 | 152.0;43.0;48.0;0
372 | 128.0;18.0;29.0;0
373 | 99.0;37.0;34.0;2
374 | 160.0;71.0;46.0;2
375 | 105.0;27.0;4.0;2
376 | 100.0;47.0;22.0;1
377 | 102.0;20.0;13.0;2
378 | 101.0;24.0;13.0;2
379 | 117.0;75.0;5.0;0
380 | 118.0;21.0;34.0;0
381 | 109.0;43.0;14.0;1
382 | 104.0;43.0;1.0;1
383 | 102.0;45.0;1.0;1
384 | 106.0;73.0;28.0;1
385 | 155.0;39.0;46.0;0
386 | 109.0;46.0;8.0;1
387 | 113.0;65.0;9.0;0
388 | 130.0;60.0;11.0;2
389 | 120.0;67.0;19.0;0
390 | 151.0;39.0;52.0;0
391 | 150.0;34.0;55.0;0
392 | 131.0;42.0;18.0;2
393 | 124.0;41.0;27.0;0
394 | 118.0;46.0;60.0;2
395 | 106.0;33.0;50.0;0
396 | 99.0;55.0;33.0;1
397 | 120.0;63.0;26.0;0
398 | 126.0;55.0;34.0;2
399 | 137.0;41.0;32.0;1
400 | 117.0;81.0;20.0;2
401 | 122.0;96.0;33.0;0
402 | 121.0;70.0;15.0;0
403 | 125.0;42.0;30.0;2
404 | 111.0;74.0;20.0;0
405 | 106.0;35.0;6.0;1
406 | 104.0;54.0;9.0;1
407 | 152.0;36.0;48.0;0
408 | 114.0;32.0;34.0;0
409 | 125.0;58.0;3.0;2
410 | 128.0;32.0;33.0;0
411 | 115.0;85.0;15.0;0
412 | 134.0;42.0;37.0;1
413 | 113.0;82.0;31.0;0
414 | 150.0;47.0;51.0;2
415 | 128.0;24.0;28.0;0
416 | 122.0;69.0;26.0;0
417 | 91.0;31.0;31.0;1
418 | 124.0;65.0;5.0;2
419 | 145.0;32.0;53.0;0
420 | 148.0;52.0;47.0;1
421 | 109.0;40.0;26.0;1
422 | 129.0;39.0;39.0;2
423 | 107.0;23.0;1.0;2
424 | 102.0;20.0;26.0;0
425 | 104.0;29.0;18.0;2
426 | 101.0;32.0;16.0;2
427 | 127.0;56.0;50.0;2
428 | 116.0;53.0;1.0;2
429 | 143.0;25.0;35.0;2
430 | 101.0;29.0;15.0;2
431 | 109.0;60.0;9.0;1
432 | 123.0;62.0;18.0;0
433 | 148.0;37.0;47.0;0
434 | 98.0;30.0;12.0;2
435 | 105.0;49.0;19.0;1
436 | 134.0;33.0;47.0;2
437 | 105.0;33.0;33.0;1
438 | 149.0;41.0;44.0;0
439 | 115.0;57.0;61.0;2
440 | 113.0;34.0;11.0;1
441 | 118.0;22.0;31.0;0
442 | 93.0;20.0;12.0;2
443 | 129.0;58.0;33.0;2
444 | 109.0;54.0;4.0;1
445 | 102.0;69.0;18.0;2
446 | 110.0;32.0;13.0;1
447 | 112.0;27.0;1.0;1
448 | 141.0;49.0;33.0;1
449 | 123.0;81.0;30.0;2
450 | 119.0;37.0;36.0;1
451 | 113.0;83.0;44.0;2
452 | 125.0;37.0;51.0;2
453 | 147.0;33.0;49.0;0
454 | 102.0;61.0;35.0;1
455 | 136.0;50.0;30.0;2
456 | 108.0;20.0;18.0;2
457 | 133.0;55.0;14.0;2
458 | 113.0;53.0;26.0;1
459 | 141.0;55.0;55.0;2
460 | 151.0;34.0;57.0;2
461 | 120.0;76.0;7.0;0
462 | 127.0;38.0;29.0;0
463 | 102.0;34.0;50.0;0
464 | 136.0;42.0;39.0;1
465 | 113.0;43.0;35.0;2
466 | 143.0;39.0;32.0;1
467 | 99.0;37.0;26.0;1
468 | 119.0;53.0;22.0;1
469 | 117.0;59.0;42.0;2
470 | 149.0;33.0;53.0;0
471 | 119.0;76.0;23.0;0
472 | 146.0;36.0;53.0;0
473 | 143.0;43.0;43.0;1
474 | 145.0;31.0;47.0;0
475 | 131.0;71.0;12.0;0
476 | 110.0;33.0;29.0;1
477 | 116.0;23.0;19.0;1
478 | 111.0;40.0;43.0;1
479 | 111.0;49.0;12.0;1
480 | 110.0;45.0;22.0;1
481 | 139.0;54.0;36.0;1
482 | 135.0;45.0;42.0;1
483 | 119.0;77.0;11.0;0
484 | 99.0;31.0;10.0;2
485 | 134.0;16.0;33.0;2
486 | 133.0;17.0;32.0;0
487 | 123.0;63.0;38.0;2
488 | 120.0;34.0;14.0;2
489 | 117.0;68.0;41.0;2
490 | 98.0;16.0;15.0;2
491 | 91.0;25.0;16.0;2
492 | 135.0;45.0;40.0;1
493 | 98.0;28.0;20.0;2
494 | 114.0;45.0;32.0;1
495 | 130.0;65.0;41.0;2
496 | 118.0;70.0;20.0;0
497 | 115.0;37.0;31.0;1
498 | 143.0;63.0;19.0;2
499 | 123.0;81.0;4.0;0
500 | 113.0;50.0;20.0;1
501 | 110.0;42.0;28.0;1
502 |
--------------------------------------------------------------------------------
/U4-M6-cloud.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# Hosting your model on Google Cloud ML\n",
8 | "\n",
9 | "https://cloud.google.com/ml-engine/docs/tensorflow/deploying-models\n",
10 | "\n",
11 | "This requires installation of the Google Cloud SDK\n",
12 | "* https://cloud.google.com/sdk/install\n",
13 | " * https://cloud.google.com/sdk/docs/downloads-interactive\n"
14 | ]
15 | },
16 | {
17 | "cell_type": "code",
18 | "execution_count": 3,
19 | "metadata": {},
20 | "outputs": [
21 | {
22 | "name": "stdout",
23 | "output_type": "stream",
24 | "text": [
25 | "total 616\n",
26 | "-rw-r--r-- 1 olive 197609 625641 Sep 14 09:35 saved_model.pb\n",
27 | "drwxr-xr-x 1 olive 197609 0 Sep 14 09:35 variables\n"
28 | ]
29 | }
30 | ],
31 | "source": [
32 | "!ls -l tf/1"
33 | ]
34 | },
35 | {
36 | "cell_type": "markdown",
37 | "metadata": {},
38 | "source": [
39 | "## First we need to create a bucket on the Goolge Cloud and upload our model to it\n",
40 | "\n",
41 | "https://cloud.google.com/storage/docs/creating-buckets#storage-create-bucket-gsutil\n"
42 | ]
43 | },
44 | {
45 | "cell_type": "code",
46 | "execution_count": 17,
47 | "metadata": {},
48 | "outputs": [
49 | {
50 | "name": "stderr",
51 | "output_type": "stream",
52 | "text": [
53 | "'gsutil' is not recognized as an internal or external command,\n",
54 | "operable program or batch file.\n"
55 | ]
56 | }
57 | ],
58 | "source": [
59 | "!gsutil mb gs://manning_bucket\n",
60 | "!gsutil cp -R tf/1 gs://manning_bucket"
61 | ]
62 | },
63 | {
64 | "cell_type": "code",
65 | "execution_count": null,
66 | "metadata": {},
67 | "outputs": [],
68 | "source": [
69 | "!gcloud ml-engine models create \"manning_insurance_1\"\n",
70 | "!gcloud ml-engine versions create \"v1\" --model \"manning_insurance_1\" --origin gs://manning_bucket/1 \n",
71 | "!gcloud ml-engine versions describe \"v1\" --model \"manning_insurance_1\""
72 | ]
73 | },
74 | {
75 | "cell_type": "markdown",
76 | "metadata": {},
77 | "source": [
78 | "## Try it out on a few samples"
79 | ]
80 | },
81 | {
82 | "cell_type": "code",
83 | "execution_count": 19,
84 | "metadata": {},
85 | "outputs": [
86 | {
87 | "name": "stdout",
88 | "output_type": "stream",
89 | "text": [
90 | "{\"inputs\": [ 160, 18, 100]}\n",
91 | "{\"inputs\": [ 100, 47, 10]}\n",
92 | "{\"inputs\": [ 90, 20, 20]}\n"
93 | ]
94 | }
95 | ],
96 | "source": [
97 | "# one of each category\n",
98 | "!cat sample_insurance.json"
99 | ]
100 | },
101 | {
102 | "cell_type": "code",
103 | "execution_count": 4,
104 | "metadata": {},
105 | "outputs": [
106 | {
107 | "name": "stderr",
108 | "output_type": "stream",
109 | "text": [
110 | "ERROR: (gcloud.ml-engine.predict) HTTP request failed. Response: {\n",
111 | " \"error\": {\n",
112 | " \"code\": 403,\n",
113 | " \"message\": \"Cloud Machine Learning Engine has not been used in project 564044401623 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/ml.googleapis.com/overview?project=564044401623 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.\",\n",
114 | " \"status\": \"PERMISSION_DENIED\",\n",
115 | " \"details\": [\n",
116 | " {\n",
117 | " \"@type\": \"type.googleapis.com/google.rpc.Help\",\n",
118 | " \"links\": [\n",
119 | " {\n",
120 | " \"description\": \"Google developers console API activation\",\n",
121 | " \"url\": \"https://console.developers.google.com/apis/api/ml.googleapis.com/overview?project=564044401623\"\n",
122 | " }\n",
123 | " ]\n",
124 | " }\n",
125 | " ]\n",
126 | " }\n",
127 | "}\n",
128 | "\n"
129 | ]
130 | }
131 | ],
132 | "source": [
133 | "# 0: red\n",
134 | "# 1: green\n",
135 | "# 2: yellow\n",
136 | "\n",
137 | "# https://cloud.google.com/ml-engine/docs/tensorflow/prediction-overview#getting_predictions\n",
138 | "!gcloud ml-engine predict --model \"manning_insurance_1\" --version \"v1\" --json-instances ./sample_insurance.json\n",
139 | "\n",
140 | "# SCORES\n",
141 | "# [0.8658562898635864, 7.318668918511809e-14, 0.13414366543293]\n",
142 | "# [0.002760800765827298, 0.8720880746841431, 0.12515118718147278]\n",
143 | "# [5.452934419736266e-05, 0.005952719133347273, 0.9939927458763123]"
144 | ]
145 | },
146 | {
147 | "cell_type": "markdown",
148 | "metadata": {},
149 | "source": [
150 | "## You can also access our deployed model programmatically\n",
151 | "\n",
152 | "https://cloud.google.com/ml-engine/docs/tensorflow/online-predict"
153 | ]
154 | },
155 | {
156 | "cell_type": "code",
157 | "execution_count": 3,
158 | "metadata": {},
159 | "outputs": [
160 | {
161 | "name": "stdout",
162 | "output_type": "stream",
163 | "text": [
164 | "Requirement already satisfied: google-api-python-client in c:\\programdata\\anaconda3\\lib\\site-packages (1.7.4)\n",
165 | "Requirement already satisfied: httplib2<1dev,>=0.9.2 in c:\\programdata\\anaconda3\\lib\\site-packages (from google-api-python-client) (0.11.3)\n",
166 | "Requirement already satisfied: google-auth-httplib2>=0.0.3 in c:\\programdata\\anaconda3\\lib\\site-packages (from google-api-python-client) (0.0.3)\n",
167 | "Requirement already satisfied: uritemplate<4dev,>=3.0.0 in c:\\programdata\\anaconda3\\lib\\site-packages (from google-api-python-client) (3.0.0)\n",
168 | "Requirement already satisfied: google-auth>=1.4.1 in c:\\programdata\\anaconda3\\lib\\site-packages (from google-api-python-client) (1.5.1)\n",
169 | "Requirement already satisfied: six<2dev,>=1.6.1 in c:\\programdata\\anaconda3\\lib\\site-packages (from google-api-python-client) (1.11.0)\n",
170 | "Requirement already satisfied: rsa>=3.1.4 in c:\\programdata\\anaconda3\\lib\\site-packages (from google-auth>=1.4.1->google-api-python-client) (3.4.2)\n",
171 | "Requirement already satisfied: pyasn1-modules>=0.2.1 in c:\\programdata\\anaconda3\\lib\\site-packages (from google-auth>=1.4.1->google-api-python-client) (0.2.2)\n",
172 | "Requirement already satisfied: cachetools>=2.0.0 in c:\\programdata\\anaconda3\\lib\\site-packages (from google-auth>=1.4.1->google-api-python-client) (2.1.0)\n",
173 | "Requirement already satisfied: pyasn1>=0.1.3 in c:\\programdata\\anaconda3\\lib\\site-packages (from rsa>=3.1.4->google-auth>=1.4.1->google-api-python-client) (0.4.4)\n"
174 | ]
175 | },
176 | {
177 | "name": "stderr",
178 | "output_type": "stream",
179 | "text": [
180 | "twisted 18.7.0 requires PyHamcrest>=1.9.0, which is not installed.\n",
181 | "thinc 6.11.2 requires hypothesis<3,>=2, which is not installed.\n",
182 | "thinc 6.11.2 requires msgpack-python==0.5.4, which is not installed.\n",
183 | "thinc 6.11.2 has requirement msgpack-numpy==0.4.1, but you'll have msgpack-numpy 0.4.3 which is incompatible.\n",
184 | "tensorflow-tensorboard 1.5.1 has requirement bleach==1.5.0, but you'll have bleach 2.1.3 which is incompatible.\n",
185 | "tensorflow-tensorboard 1.5.1 has requirement html5lib==0.9999999, but you'll have html5lib 1.0.1 which is incompatible.\n",
186 | "spacy 2.0.11 has requirement regex==2017.4.5, but you'll have regex 2018.6.21 which is incompatible.\n",
187 | "spacy 2.0.11 has requirement thinc<6.11.0,>=6.10.1, but you'll have thinc 6.11.2 which is incompatible.\n",
188 | "You are using pip version 10.0.1, however version 18.0 is available.\n",
189 | "You should consider upgrading via the 'python -m pip install --upgrade pip' command.\n"
190 | ]
191 | }
192 | ],
193 | "source": [
194 | "!pip install google-api-python-client"
195 | ]
196 | },
197 | {
198 | "cell_type": "code",
199 | "execution_count": 24,
200 | "metadata": {},
201 | "outputs": [
202 | {
203 | "name": "stdout",
204 | "output_type": "stream",
205 | "text": [
206 | "Requirement already satisfied: tensorflow-serving-api in c:\\programdata\\anaconda3\\lib\\site-packages (1.9.1)\n",
207 | "Requirement already satisfied: grpcio>=1.0<2 in c:\\programdata\\anaconda3\\lib\\site-packages (from tensorflow-serving-api) (1.14.1)\n",
208 | "Requirement already satisfied: protobuf==3.6.0 in c:\\programdata\\anaconda3\\lib\\site-packages (from tensorflow-serving-api) (3.6.0)\n",
209 | "Requirement already satisfied: tensorflow<2,>=1.2.0 in c:\\programdata\\anaconda3\\lib\\site-packages (from tensorflow-serving-api) (1.10.0)\n",
210 | "Requirement already satisfied: six>=1.5.2 in c:\\programdata\\anaconda3\\lib\\site-packages (from grpcio>=1.0<2->tensorflow-serving-api) (1.11.0)\n",
211 | "Requirement already satisfied: setuptools in c:\\programdata\\anaconda3\\lib\\site-packages (from protobuf==3.6.0->tensorflow-serving-api) (39.1.0)\n",
212 | "Requirement already satisfied: tensorboard<1.11.0,>=1.10.0 in c:\\programdata\\anaconda3\\lib\\site-packages (from tensorflow<2,>=1.2.0->tensorflow-serving-api) (1.10.0)\n",
213 | "Requirement already satisfied: numpy<=1.14.5,>=1.13.3 in c:\\programdata\\anaconda3\\lib\\site-packages (from tensorflow<2,>=1.2.0->tensorflow-serving-api) (1.14.5)\n",
214 | "Requirement already satisfied: wheel>=0.26 in c:\\programdata\\anaconda3\\lib\\site-packages (from tensorflow<2,>=1.2.0->tensorflow-serving-api) (0.31.1)\n",
215 | "Requirement already satisfied: astor>=0.6.0 in c:\\programdata\\anaconda3\\lib\\site-packages (from tensorflow<2,>=1.2.0->tensorflow-serving-api) (0.7.1)\n",
216 | "Requirement already satisfied: termcolor>=1.1.0 in c:\\programdata\\anaconda3\\lib\\site-packages (from tensorflow<2,>=1.2.0->tensorflow-serving-api) (1.1.0)\n",
217 | "Requirement already satisfied: gast>=0.2.0 in c:\\programdata\\anaconda3\\lib\\site-packages (from tensorflow<2,>=1.2.0->tensorflow-serving-api) (0.2.0)\n",
218 | "Requirement already satisfied: absl-py>=0.1.6 in c:\\programdata\\anaconda3\\lib\\site-packages (from tensorflow<2,>=1.2.0->tensorflow-serving-api) (0.3.0)\n",
219 | "Requirement already satisfied: markdown>=2.6.8 in c:\\programdata\\anaconda3\\lib\\site-packages (from tensorboard<1.11.0,>=1.10.0->tensorflow<2,>=1.2.0->tensorflow-serving-api) (2.6.11)\n",
220 | "Requirement already satisfied: werkzeug>=0.11.10 in c:\\programdata\\anaconda3\\lib\\site-packages (from tensorboard<1.11.0,>=1.10.0->tensorflow<2,>=1.2.0->tensorflow-serving-api) (0.14.1)\n"
221 | ]
222 | },
223 | {
224 | "name": "stderr",
225 | "output_type": "stream",
226 | "text": [
227 | "twisted 18.7.0 requires PyHamcrest>=1.9.0, which is not installed.\n",
228 | "thinc 6.11.2 requires hypothesis<3,>=2, which is not installed.\n",
229 | "thinc 6.11.2 requires msgpack-python==0.5.4, which is not installed.\n",
230 | "thinc 6.11.2 has requirement msgpack-numpy==0.4.1, but you'll have msgpack-numpy 0.4.3 which is incompatible.\n",
231 | "tensorflow-tensorboard 1.5.1 has requirement bleach==1.5.0, but you'll have bleach 2.1.3 which is incompatible.\n",
232 | "tensorflow-tensorboard 1.5.1 has requirement html5lib==0.9999999, but you'll have html5lib 1.0.1 which is incompatible.\n",
233 | "spacy 2.0.11 has requirement regex==2017.4.5, but you'll have regex 2018.6.21 which is incompatible.\n",
234 | "spacy 2.0.11 has requirement thinc<6.11.0,>=6.10.1, but you'll have thinc 6.11.2 which is incompatible.\n",
235 | "You are using pip version 10.0.1, however version 18.0 is available.\n",
236 | "You should consider upgrading via the 'python -m pip install --upgrade pip' command.\n"
237 | ]
238 | }
239 | ],
240 | "source": [
241 | "!pip install tensorflow-serving-api"
242 | ]
243 | },
244 | {
245 | "cell_type": "code",
246 | "execution_count": 1,
247 | "metadata": {},
248 | "outputs": [],
249 | "source": [
250 | "# https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/ml_engine/online_prediction/predict.py\n",
251 | "# https://cloud.google.com/ml-engine/docs/tensorflow/online-predict\n",
252 | "\n",
253 | "import googleapiclient.discovery\n",
254 | "\n",
255 | "def predict_json(project, model, instances, version=None):\n",
256 | " \"\"\"Send json data to a deployed model for prediction.\n",
257 | "\n",
258 | " Args:\n",
259 | " project (str): project where the Cloud ML Engine Model is deployed.\n",
260 | " model (str): model name.\n",
261 | " instances ([Mapping[str: Any]]): Keys should be the names of Tensors\n",
262 | " your deployed model expects as inputs. Values should be datatypes\n",
263 | " convertible to Tensors, or (potentially nested) lists of datatypes\n",
264 | " convertible to tensors.\n",
265 | " version: str, version of the model to target.\n",
266 | " Returns:\n",
267 | " Mapping[str: any]: dictionary of prediction results defined by the\n",
268 | " model.\n",
269 | " \"\"\"\n",
270 | " # Create the ML Engine service object.\n",
271 | " # To authenticate set the environment variable\n",
272 | " # GOOGLE_APPLICATION_CREDENTIALS=| \n", 263 | " | speed | \n", 264 | "age | \n", 265 | "miles | \n", 266 | "group | \n", 267 | "
|---|---|---|---|---|
| count | \n", 272 | "1500.000000 | \n", 273 | "1500.000000 | \n", 274 | "1500.000000 | \n", 275 | "1500.000000 | \n", 276 | "
| mean | \n", 279 | "122.492667 | \n", 280 | "44.980667 | \n", 281 | "30.434000 | \n", 282 | "0.998667 | \n", 283 | "
| std | \n", 286 | "17.604333 | \n", 287 | "17.130400 | \n", 288 | "15.250815 | \n", 289 | "0.816768 | \n", 290 | "
| min | \n", 293 | "68.000000 | \n", 294 | "16.000000 | \n", 295 | "1.000000 | \n", 296 | "0.000000 | \n", 297 | "
| 25% | \n", 300 | "108.000000 | \n", 301 | "32.000000 | \n", 302 | "18.000000 | \n", 303 | "0.000000 | \n", 304 | "
| 50% | \n", 307 | "120.000000 | \n", 308 | "42.000000 | \n", 309 | "29.000000 | \n", 310 | "1.000000 | \n", 311 | "
| 75% | \n", 314 | "137.000000 | \n", 315 | "55.000000 | \n", 316 | "42.000000 | \n", 317 | "2.000000 | \n", 318 | "
| max | \n", 321 | "166.000000 | \n", 322 | "100.000000 | \n", 323 | "84.000000 | \n", 324 | "2.000000 | \n", 325 | "
| \n", 463 | " | speed | \n", 464 | "age | \n", 465 | "miles | \n", 466 | "group | \n", 467 | "
|---|---|---|---|---|
| count | \n", 472 | "1500.000000 | \n", 473 | "1500.000000 | \n", 474 | "1500.000000 | \n", 475 | "1500.000000 | \n", 476 | "
| mean | \n", 479 | "122.492667 | \n", 480 | "44.980667 | \n", 481 | "30.434000 | \n", 482 | "0.998667 | \n", 483 | "
| std | \n", 486 | "17.604333 | \n", 487 | "17.130400 | \n", 488 | "15.250815 | \n", 489 | "0.816768 | \n", 490 | "
| min | \n", 493 | "68.000000 | \n", 494 | "16.000000 | \n", 495 | "1.000000 | \n", 496 | "0.000000 | \n", 497 | "
| 25% | \n", 500 | "108.000000 | \n", 501 | "32.000000 | \n", 502 | "18.000000 | \n", 503 | "0.000000 | \n", 504 | "
| 50% | \n", 507 | "120.000000 | \n", 508 | "42.000000 | \n", 509 | "29.000000 | \n", 510 | "1.000000 | \n", 511 | "
| 75% | \n", 514 | "137.000000 | \n", 515 | "55.000000 | \n", 516 | "42.000000 | \n", 517 | "2.000000 | \n", 518 | "
| max | \n", 521 | "166.000000 | \n", 522 | "100.000000 | \n", 523 | "84.000000 | \n", 524 | "2.000000 | \n", 525 | "
`s get reset. However, we also reset the\n// bottom margin to use `rem` units instead of `em`.\np {\n margin-top: 0;\n margin-bottom: $paragraph-margin-bottom;\n}\n\n// Abbreviations\n//\n// 1. Remove the bottom border in Firefox 39-.\n// 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.\n// 3. Add explicit cursor to indicate changed behavior.\n// 4. Duplicate behavior to the data-* attribute for our tooltip plugin\n\nabbr[title],\nabbr[data-original-title] { // 4\n text-decoration: underline; // 2\n text-decoration: underline dotted; // 2\n cursor: help; // 3\n border-bottom: 0; // 1\n}\n\naddress {\n margin-bottom: 1rem;\n font-style: normal;\n line-height: inherit;\n}\n\nol,\nul,\ndl {\n margin-top: 0;\n margin-bottom: 1rem;\n}\n\nol ol,\nul ul,\nol ul,\nul ol {\n margin-bottom: 0;\n}\n\ndt {\n font-weight: $dt-font-weight;\n}\n\ndd {\n margin-bottom: .5rem;\n margin-left: 0; // Undo browser default\n}\n\nblockquote {\n margin: 0 0 1rem;\n}\n\ndfn {\n font-style: italic; // Add the correct font style in Android 4.3-\n}\n\n// stylelint-disable font-weight-notation\nb,\nstrong {\n font-weight: bolder; // Add the correct font weight in Chrome, Edge, and Safari\n}\n// stylelint-enable font-weight-notation\n\nsmall {\n font-size: 80%; // Add the correct font size in all browsers\n}\n\n//\n// Prevent `sub` and `sup` elements from affecting the line height in\n// all browsers.\n//\n\nsub,\nsup {\n position: relative;\n font-size: 75%;\n line-height: 0;\n vertical-align: baseline;\n}\n\nsub { bottom: -.25em; }\nsup { top: -.5em; }\n\n\n//\n// Links\n//\n\na {\n color: $link-color;\n text-decoration: $link-decoration;\n background-color: transparent; // Remove the gray background on active links in IE 10.\n -webkit-text-decoration-skip: objects; // Remove gaps in links underline in iOS 8+ and Safari 8+.\n\n @include hover {\n color: $link-hover-color;\n text-decoration: $link-hover-decoration;\n }\n}\n\n// And undo these styles for placeholder links/named anchors (without href)\n// which have not been made explicitly keyboard-focusable (without tabindex).\n// It would be more straightforward to just use a[href] in previous block, but that\n// causes specificity issues in many other styles that are too complex to fix.\n// See https://github.com/twbs/bootstrap/issues/19402\n\na:not([href]):not([tabindex]) {\n color: inherit;\n text-decoration: none;\n\n @include hover-focus {\n color: inherit;\n text-decoration: none;\n }\n\n &:focus {\n outline: 0;\n }\n}\n\n\n//\n// Code\n//\n\npre,\ncode,\nkbd,\nsamp {\n font-family: $font-family-monospace;\n font-size: 1em; // Correct the odd `em` font sizing in all browsers.\n}\n\npre {\n // Remove browser default top margin\n margin-top: 0;\n // Reset browser default of `1em` to use `rem`s\n margin-bottom: 1rem;\n // Don't allow content to break outside\n overflow: auto;\n // We have @viewport set which causes scrollbars to overlap content in IE11 and Edge, so\n // we force a non-overlapping, non-auto-hiding scrollbar to counteract.\n -ms-overflow-style: scrollbar;\n}\n\n\n//\n// Figures\n//\n\nfigure {\n // Apply a consistent margin strategy (matches our type styles).\n margin: 0 0 1rem;\n}\n\n\n//\n// Images and content\n//\n\nimg {\n vertical-align: middle;\n border-style: none; // Remove the border on images inside links in IE 10-.\n}\n\nsvg {\n // Workaround for the SVG overflow bug in IE10/11 is still required.\n // See https://github.com/twbs/bootstrap/issues/26878\n overflow: hidden;\n vertical-align: middle;\n}\n\n\n//\n// Tables\n//\n\ntable {\n border-collapse: collapse; // Prevent double borders\n}\n\ncaption {\n padding-top: $table-cell-padding;\n padding-bottom: $table-cell-padding;\n color: $table-caption-color;\n text-align: left;\n caption-side: bottom;\n}\n\nth {\n // Matches default `