You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1910 lines
143 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"# TV Script Generation\n",
"In this project, you'll generate your own [Simpsons](https://en.wikipedia.org/wiki/The_Simpsons) TV scripts using RNNs. You'll be using part of the [Simpsons dataset](https://www.kaggle.com/wcukierski/the-simpsons-by-the-data) of scripts from 27 seasons. The Neural Network you'll build will generate a new TV script for a scene at [Moe's Tavern](https://simpsonswiki.com/wiki/Moe's_Tavern).\n",
"## Get the Data\n",
"The data is already provided for you. You'll be using a subset of the original dataset. It consists of only the scenes in Moe's Tavern. This doesn't include other versions of the tavern, like \"Moe's Cavern\", \"Flaming Moe's\", \"Uncle Moe's Family Feed-Bag\", etc.."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"\"\"\"\n",
"DON'T MODIFY ANYTHING IN THIS CELL\n",
"\"\"\"\n",
"import helper\n",
"\n",
"data_dir = './data/simpsons/moes_tavern_lines.txt'\n",
"text = helper.load_data(data_dir)\n",
"# Ignore notice, since we don't use it for analysing the data\n",
"text = text[81:]"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"## Explore the Data\n",
"Play around with `view_sentence_range` to view different parts of the data."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Dataset Stats\n",
"Roughly the number of unique words: 11492\n",
"Number of scenes: 262\n",
"Average number of sentences in each scene: 15.248091603053435\n",
"Number of lines: 4257\n",
"Average number of words in each line: 11.50434578341555\n",
"\n",
"The sentences 0 to 10:\n",
"Moe_Szyslak: (INTO PHONE) Moe's Tavern. Where the elite meet to drink.\n",
"Bart_Simpson: Eh, yeah, hello, is Mike there? Last name, Rotch.\n",
"Moe_Szyslak: (INTO PHONE) Hold on, I'll check. (TO BARFLIES) Mike Rotch. Mike Rotch. Hey, has anybody seen Mike Rotch, lately?\n",
"Moe_Szyslak: (INTO PHONE) Listen you little puke. One of these days I'm gonna catch you, and I'm gonna carve my name on your back with an ice pick.\n",
"Moe_Szyslak: What's the matter Homer? You're not your normal effervescent self.\n",
"Homer_Simpson: I got my problems, Moe. Give me another one.\n",
"Moe_Szyslak: Homer, hey, you should not drink to forget your problems.\n",
"Barney_Gumble: Yeah, you should only drink to enhance your social skills.\n",
"\n",
"\n"
]
}
],
"source": [
"view_sentence_range = (0, 10)\n",
"\n",
"\"\"\"\n",
"DON'T MODIFY ANYTHING IN THIS CELL\n",
"\"\"\"\n",
"import numpy as np\n",
"\n",
"print('Dataset Stats')\n",
"print('Roughly the number of unique words: {}'.format(len({word: None for word in text.split()})))\n",
"scenes = text.split('\\n\\n')\n",
"print('Number of scenes: {}'.format(len(scenes)))\n",
"sentence_count_scene = [scene.count('\\n') for scene in scenes]\n",
"print('Average number of sentences in each scene: {}'.format(np.average(sentence_count_scene)))\n",
"\n",
"sentences = [sentence for scene in scenes for sentence in scene.split('\\n')]\n",
"print('Number of lines: {}'.format(len(sentences)))\n",
"word_count_sentence = [len(sentence.split()) for sentence in sentences]\n",
"print('Average number of words in each line: {}'.format(np.average(word_count_sentence)))\n",
"\n",
"print()\n",
"print('The sentences {} to {}:'.format(*view_sentence_range))\n",
"print('\\n'.join(text.split('\\n')[view_sentence_range[0]:view_sentence_range[1]]))"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)\r\n",
"00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]\r\n",
"00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]\r\n",
"00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 01)\r\n",
"00:02.0 VGA compatible controller: Cirrus Logic GD 5446\r\n",
"00:03.0 VGA compatible controller: NVIDIA Corporation GK104GL [GRID K520] (rev a1)\r\n",
"00:1f.0 Unassigned class [ff80]: XenSource, Inc. Xen Platform Device (rev 01)\r\n"
]
}
],
"source": [
"!lspci"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"#### Exploring Sentence Lengths \n",
"\n",
"Find sentence length average to use it as the RRN sequence length"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/html": [
"\n",
" <div class=\"bk-root\">\n",
" <a href=\"http://bokeh.pydata.org\" target=\"_blank\" class=\"bk-logo bk-logo-small bk-logo-notebook\"></a>\n",
" <span id=\"5d944cec-21f7-43a6-9d66-027ae50d0773\">Loading BokehJS ...</span>\n",
" </div>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
"(function(global) {\n",
" function now() {\n",
" return new Date();\n",
" }\n",
"\n",
" var force = true;\n",
"\n",
" if (typeof (window._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
" window._bokeh_onload_callbacks = [];\n",
" window._bokeh_is_loading = undefined;\n",
" }\n",
"\n",
"\n",
" \n",
" if (typeof (window._bokeh_timeout) === \"undefined\" || force === true) {\n",
" window._bokeh_timeout = Date.now() + 5000;\n",
" window._bokeh_failed_load = false;\n",
" }\n",
"\n",
" var NB_LOAD_WARNING = {'data': {'text/html':\n",
" \"<div style='background-color: #fdd'>\\n\"+\n",
" \"<p>\\n\"+\n",
" \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
" \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
" \"</p>\\n\"+\n",
" \"<ul>\\n\"+\n",
" \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
" \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
" \"</ul>\\n\"+\n",
" \"<code>\\n\"+\n",
" \"from bokeh.resources import INLINE\\n\"+\n",
" \"output_notebook(resources=INLINE)\\n\"+\n",
" \"</code>\\n\"+\n",
" \"</div>\"}};\n",
"\n",
" function display_loaded() {\n",
" if (window.Bokeh !== undefined) {\n",
" document.getElementById(\"5d944cec-21f7-43a6-9d66-027ae50d0773\").textContent = \"BokehJS successfully loaded.\";\n",
" } else if (Date.now() < window._bokeh_timeout) {\n",
" setTimeout(display_loaded, 100)\n",
" }\n",
" }\n",
"\n",
" function run_callbacks() {\n",
" window._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
" delete window._bokeh_onload_callbacks\n",
" console.info(\"Bokeh: all callbacks have finished\");\n",
" }\n",
"\n",
" function load_libs(js_urls, callback) {\n",
" window._bokeh_onload_callbacks.push(callback);\n",
" if (window._bokeh_is_loading > 0) {\n",
" console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
" return null;\n",
" }\n",
" if (js_urls == null || js_urls.length === 0) {\n",
" run_callbacks();\n",
" return null;\n",
" }\n",
" console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
" window._bokeh_is_loading = js_urls.length;\n",
" for (var i = 0; i < js_urls.length; i++) {\n",
" var url = js_urls[i];\n",
" var s = document.createElement('script');\n",
" s.src = url;\n",
" s.async = false;\n",
" s.onreadystatechange = s.onload = function() {\n",
" window._bokeh_is_loading--;\n",
" if (window._bokeh_is_loading === 0) {\n",
" console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
" run_callbacks()\n",
" }\n",
" };\n",
" s.onerror = function() {\n",
" console.warn(\"failed to load library \" + url);\n",
" };\n",
" console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
" document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
" }\n",
" };var element = document.getElementById(\"5d944cec-21f7-43a6-9d66-027ae50d0773\");\n",
" if (element == null) {\n",
" console.log(\"Bokeh: ERROR: autoload.js configured with elementid '5d944cec-21f7-43a6-9d66-027ae50d0773' but no matching script tag was found. \")\n",
" return false;\n",
" }\n",
"\n",
" var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.4.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.4.min.js\"];\n",
"\n",
" var inline_js = [\n",
" function(Bokeh) {\n",
" Bokeh.set_log_level(\"info\");\n",
" },\n",
" \n",
" function(Bokeh) {\n",
" \n",
" document.getElementById(\"5d944cec-21f7-43a6-9d66-027ae50d0773\").textContent = \"BokehJS is loading...\";\n",
" },\n",
" function(Bokeh) {\n",
" console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-0.12.4.min.css\");\n",
" Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.4.min.css\");\n",
" console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.4.min.css\");\n",
" Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.4.min.css\");\n",
" }\n",
" ];\n",
"\n",
" function run_inline_js() {\n",
" \n",
" if ((window.Bokeh !== undefined) || (force === true)) {\n",
" for (var i = 0; i < inline_js.length; i++) {\n",
" inline_js[i](window.Bokeh);\n",
" }if (force === true) {\n",
" display_loaded();\n",
" }} else if (Date.now() < window._bokeh_timeout) {\n",
" setTimeout(run_inline_js, 100);\n",
" } else if (!window._bokeh_failed_load) {\n",
" console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
" window._bokeh_failed_load = true;\n",
" } else if (force !== true) {\n",
" var cell = $(document.getElementById(\"5d944cec-21f7-43a6-9d66-027ae50d0773\")).parents('.cell').data().cell;\n",
" cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
" }\n",
"\n",
" }\n",
"\n",
" if (window._bokeh_is_loading === 0) {\n",
" console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
" run_inline_js();\n",
" } else {\n",
" load_libs(js_urls, function() {\n",
" console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
" run_inline_js();\n",
" });\n",
" }\n",
"}(this));"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"\n",
"\n",
" <div class=\"bk-root\">\n",
" <div class=\"bk-plotdiv\" id=\"46433a97-e836-4db8-9dbd-6723adbab9ef\"></div>\n",
" </div>\n",
"<script type=\"text/javascript\">\n",
" \n",
" (function(global) {\n",
" function now() {\n",
" return new Date();\n",
" }\n",
" \n",
" var force = false;\n",
" \n",
" if (typeof (window._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
" window._bokeh_onload_callbacks = [];\n",
" window._bokeh_is_loading = undefined;\n",
" }\n",
" \n",
" \n",
" \n",
" if (typeof (window._bokeh_timeout) === \"undefined\" || force === true) {\n",
" window._bokeh_timeout = Date.now() + 0;\n",
" window._bokeh_failed_load = false;\n",
" }\n",
" \n",
" var NB_LOAD_WARNING = {'data': {'text/html':\n",
" \"<div style='background-color: #fdd'>\\n\"+\n",
" \"<p>\\n\"+\n",
" \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
" \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
" \"</p>\\n\"+\n",
" \"<ul>\\n\"+\n",
" \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
" \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
" \"</ul>\\n\"+\n",
" \"<code>\\n\"+\n",
" \"from bokeh.resources import INLINE\\n\"+\n",
" \"output_notebook(resources=INLINE)\\n\"+\n",
" \"</code>\\n\"+\n",
" \"</div>\"}};\n",
" \n",
" function display_loaded() {\n",
" if (window.Bokeh !== undefined) {\n",
" document.getElementById(\"46433a97-e836-4db8-9dbd-6723adbab9ef\").textContent = \"BokehJS successfully loaded.\";\n",
" } else if (Date.now() < window._bokeh_timeout) {\n",
" setTimeout(display_loaded, 100)\n",
" }\n",
" }\n",
" \n",
" function run_callbacks() {\n",
" window._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
" delete window._bokeh_onload_callbacks\n",
" console.info(\"Bokeh: all callbacks have finished\");\n",
" }\n",
" \n",
" function load_libs(js_urls, callback) {\n",
" window._bokeh_onload_callbacks.push(callback);\n",
" if (window._bokeh_is_loading > 0) {\n",
" console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
" return null;\n",
" }\n",
" if (js_urls == null || js_urls.length === 0) {\n",
" run_callbacks();\n",
" return null;\n",
" }\n",
" console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
" window._bokeh_is_loading = js_urls.length;\n",
" for (var i = 0; i < js_urls.length; i++) {\n",
" var url = js_urls[i];\n",
" var s = document.createElement('script');\n",
" s.src = url;\n",
" s.async = false;\n",
" s.onreadystatechange = s.onload = function() {\n",
" window._bokeh_is_loading--;\n",
" if (window._bokeh_is_loading === 0) {\n",
" console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
" run_callbacks()\n",
" }\n",
" };\n",
" s.onerror = function() {\n",
" console.warn(\"failed to load library \" + url);\n",
" };\n",
" console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
" document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
" }\n",
" };var element = document.getElementById(\"46433a97-e836-4db8-9dbd-6723adbab9ef\");\n",
" if (element == null) {\n",
" console.log(\"Bokeh: ERROR: autoload.js configured with elementid '46433a97-e836-4db8-9dbd-6723adbab9ef' but no matching script tag was found. \")\n",
" return false;\n",
" }\n",
" \n",
" var js_urls = [];\n",
" \n",
" var inline_js = [\n",
" function(Bokeh) {\n",
" (function() {\n",
" var fn = function() {\n",
" var docs_json = {\"b315479b-aa1c-4b1d-a62f-5f3345d28e0e\":{\"roots\":{\"references\":[{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(114.640000, 117.200000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[1.0],\"label\":[\"(114.640000, 117.200000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5600000000000023],\"x\":[\"115.92\"],\"y\":[0.5]}},\"id\":\"79a32e08-93fb-4949-910c-bddca8c1a9c8\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"fbc40265-c78f-4a25-ae94-6d3a7c9f0546\",\"type\":\"Rect\"},{\"attributes\":{\"dimension\":1,\"plot\":{\"id\":\"197186d2-75e3-4931-8078-3a33f3d5ec66\",\"subtype\":\"Chart\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"59b00378-9769-49dd-93a5-5ea78952574a\",\"type\":\"BasicTicker\"}},\"id\":\"41110901-9156-44a9-a2df-29b66053bb54\",\"type\":\"Grid\"},{\"attributes\":{\"data_source\":{\"id\":\"51803eef-a774-4346-84f2-207e88a53148\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"0656517c-e3ae-4649-944f-a7010c347a13\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"1bc832f0-d593-4694-bd56-66053fdb0303\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"axis_label\":\"sentence lengths\",\"formatter\":{\"id\":\"87655ce8-9396-477f-b8e5-291bb4b04687\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"197186d2-75e3-4931-8078-3a33f3d5ec66\",\"subtype\":\"Chart\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"4b0563c5-cf34-49f0-b644-cf13168a4f2e\",\"type\":\"BasicTicker\"}},\"id\":\"8df52ae9-888e-48a0-a550-ddcc788108db\",\"type\":\"LinearAxis\"},{\"attributes\":{\"data_source\":{\"id\":\"ced14f4e-7e2d-4a5c-a196-e4e20e13ce2a\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"fc4cbe98-762d-4f7a-9f7f-84271be293a4\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"aa038a75-1089-48a9-8969-5fa45d373fa5\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(17.360000, 19.920000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[233.0],\"label\":[\"(17.360000, 19.920000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5600000000000023],\"x\":[\"18.64\"],\"y\":[116.5]}},\"id\":\"2f0e31c2-992e-4f4f-b147-02d035e7bb52\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"706f3222-88bc-498d-98da-b726f32437dd\",\"type\":\"Rect\"},{\"attributes\":{\"callback\":null,\"end\":133.3,\"start\":-1.3000000000000007},\"id\":\"3fc71e2c-fc55-4e03-86ba-baab0bf26ed6\",\"type\":\"Range1d\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"e8745f98-ee67-4ecb-bfc5-11a2851abf3c\",\"type\":\"Rect\"},{\"attributes\":{\"data_source\":{\"id\":\"d570c0b6-6b27-4704-863a-38a43643a549\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"c9b8b8c3-25db-47a6-9b98-e35eb4135ed0\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"9cfb5450-8640-4dc3-a130-0090c3f9b974\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"ed995f20-8b79-46fd-aa59-5423dcda55bf\",\"type\":\"Rect\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(78.800000, 81.360000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[0.0],\"label\":[\"(78.800000, 81.360000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5600000000000023],\"x\":[\"80.08\"],\"y\":[0.0]}},\"id\":\"a48d6fa1-74eb-49e8-aaad-c4a2b4b72d10\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"8f84bd86-13dc-4dc9-8b18-c03d2c06f60b\",\"type\":\"Rect\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1d9b202a-106c-4748-a2d3-13c45f101b1e\",\"type\":\"Rect\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(55.760000, 58.320000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[6.0],\"label\":[\"(55.760000, 58.320000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5600000000000023],\"x\":[\"57.04\"],\"y\":[3.0]}},\"id\":\"7181729b-6599-45e1-a650-eeacd3f2d010\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"plot\":null,\"text\":null},\"id\":\"b8562580-2936-4aa4-b873-588404b6b65c\",\"type\":\"Title\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"d6a21e66-819c-4b80-b028-368a38889a46\",\"type\":\"Rect\"},{\"attributes\":{\"data_source\":{\"id\":\"881a8bc3-ea2e-4403-8991-7dca4f54fd09\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"ebf5ad0f-0f84-4a9b-adc9-50c4882b3bef\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"ed7e9b57-c241-4826-b1fb-15e9a996b18d\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data_source\":{\"id\":\"acb3165d-2686-415d-bc33-b9d7f4dfda05\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"62557624-a045-430f-8f0e-8c815260c8a9\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"108a6cb8-cd85-44c9-959d-b5b9e1b2fdd6\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data_source\":{\"id\":\"b27c6292-05fe-4499-8101-a4b0ce04fc84\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"f176ed43-3e69-408b-817e-a8f1e3c98b6d\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"d47551bc-2ce3-4803-97ed-25bba46806a7\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"06d48b09-eaaf-4019-8b80-f2c5a38d956b\",\"type\":\"Rect\"},{\"attributes\":{\"plot\":{\"id\":\"197186d2-75e3-4931-8078-3a33f3d5ec66\",\"subtype\":\"Chart\",\"type\":\"Plot\"}},\"id\":\"a6d68ecf-3367-45a7-ae70-1a7d578c6619\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"62557624-a045-430f-8f0e-8c815260c8a9\",\"type\":\"Rect\"},{\"attributes\":{\"plot\":{\"id\":\"197186d2-75e3-4931-8078-3a33f3d5ec66\",\"subtype\":\"Chart\",\"type\":\"Plot\"}},\"id\":\"3324e126-e035-4329-8451-6afb909e7a81\",\"type\":\"PanTool\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"193d5b66-243d-47e1-88b4-97561f18fb93\",\"type\":\"Rect\"},{\"attributes\":{\"data_source\":{\"id\":\"b48e2830-179d-4fe1-846f-54b82df58cfb\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"69d5337f-ca29-4993-b0a4-e3368c726a19\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"bbfa9c9f-2bea-479a-96ec-e07960b00fe5\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data_source\":{\"id\":\"e5755d4d-a70a-4f6e-9b1e-7d53c3c13201\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"ed995f20-8b79-46fd-aa59-5423dcda55bf\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"ee57f5b4-e21e-454b-bece-b4080cf74e40\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(122.320000, 124.880000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[0.0],\"label\":[\"(122.320000, 124.880000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.559999999999988],\"x\":[\"123.6\"],\"y\":[0.0]}},\"id\":\"b48e2830-179d-4fe1-846f-54b82df58cfb\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"below\":[{\"id\":\"8df52ae9-888e-48a0-a550-ddcc788108db\",\"type\":\"LinearAxis\"}],\"css_classes\":null,\"left\":[{\"id\":\"457ce8f8-41c0-424d-a471-5da7b9717f6a\",\"type\":\"LinearAxis\"}],\"renderers\":[{\"id\":\"62c80291-e630-47c7-829c-6784df77e1ff\",\"type\":\"BoxAnnotation\"},{\"id\":\"95824869-348a-485c-8208-5ea2b9d5d22b\",\"type\":\"GlyphRenderer\"},{\"id\":\"697039da-ee92-4fc2-9c07-acd943ecbd6c\",\"type\":\"GlyphRenderer\"},{\"id\":\"2d31277a-a2f4-4833-a07c-36c4274882ad\",\"type\":\"GlyphRenderer\"},{\"id\":\"7f135218-09d6-4a98-ac2a-5d9f33546592\",\"type\":\"GlyphRenderer\"},{\"id\":\"96bf7663-8b8d-4bf5-9ea4-1ea6aae7871e\",\"type\":\"GlyphRenderer\"},{\"id\":\"fc62bbb8-7615-4d7d-bc72-412be5baf6c2\",\"type\":\"GlyphRenderer\"},{\"id\":\"f0be2aad-a16f-4dbd-83da-a151713f9dc6\",\"type\":\"GlyphRenderer\"},{\"id\":\"c8d9c04e-ed8d-4c0e-ada6-aac2c17cdf86\",\"type\":\"GlyphRenderer\"},{\"id\":\"e92d6a56-6aed-4838-81c1-cb6a5ade09ff\",\"type\":\"GlyphRenderer\"},{\"id\":\"e2847241-be5d-40f0-856e-32529e504987\",\"type\":\"GlyphRenderer\"},{\"id\":\"ba9a63f4-29dc-411d-a24a-8a612c2d1f8b\",\"type\":\"GlyphRenderer\"},{\"id\":\"108a6cb8-cd85-44c9-959d-b5b9e1b2fdd6\",\"type\":\"GlyphRenderer\"},{\"id\":\"73888867-9a72-42af-bf0f-58b000f2dab3\",\"type\":\"GlyphRenderer\"},{\"id\":\"d16bfdf7-978e-4dbb-ab34-193daa038e1b\",\"type\":\"GlyphRenderer\"},{\"id\":\"d47551bc-2ce3-4803-97ed-25bba46806a7\",\"type\":\"GlyphRenderer\"},{\"id\":\"b743010c-de8c-4e43-9229-a7657f7aa3de\",\"type\":\"GlyphRenderer\"},{\"id\":\"04ee5168-04de-43e8-b9a5-48466f481df8\",\"type\":\"GlyphRenderer\"},{\"id\":\"696029f5-0dc1-42c3-8c71-0f1354e034a2\",\"type\":\"GlyphRenderer\"},{\"id\":\"bc77fb25-20b8-43d0-b10d-b1a954f888cd\",\"type\":\"GlyphRenderer\"},{\"id\":\"622e7080-9616-4264-8ba2-ac56b4b47da7\",\"type\":\"GlyphRenderer\"},{\"id\":\"773fbfd0-8614-4f7d-9bb5-4167ce347257\",\"type\":\"GlyphRenderer\"},{\"id\":\"b4862076-bd5b-47c1-9c84-c1cdef8270b3\",\"type\":\"GlyphRenderer\"},{\"id\":\"c3ef60a8-af88-49d5-9e76-16b70c22e729\",\"type\":\"GlyphRenderer\"},{\"id\":\"50d86b5c-262d-4c26-b23a-02e947a858e4\",\"type\":\"GlyphRenderer\"},{\"id\":\"24e0e542-d36e-41e3-b9a4-e5c3d03129fe\",\"type\":\"GlyphRenderer\"},{\"id\":\"fdc4ff96-a44d-4cc5-b8f8-8801c879b25e\",\"type\":\"GlyphRenderer\"},{\"id\":\"fa6d3ad8-e466-4111-88b5-b807078d1cc6\",\"type\":\"GlyphRenderer\"},{\"id\":\"0cd2a0d2-9e46-43af-a743-1d73fed61ff0\",\"type\":\"GlyphRenderer\"},{\"id\":\"0cdd98c0-f63e-4f7e-bd60-0ea9f2cd0c5f\",\"type\":\"GlyphRenderer\"},{\"id\":\"b4dd1306-6ef8-4052-9658-0a76f0ab1093\",\"type\":\"GlyphRenderer\"},{\"id\":\"8b0aabac-d8b1-478b-825f-1cc236dd37f8\",\"type\":\"GlyphRenderer\"},{\"id\":\"ed7e9b57-c241-4826-b1fb-15e9a996b18d\",\"type\":\"GlyphRenderer\"},{\"id\":\"8aa11fc4-7895-46d3-a8cc-a828eb470c2b\",\"type\":\"GlyphRenderer\"},{\"id\":\"7c650a53-e973-4f60-85ad-e90cd99a7eae\",\"type\":\"GlyphRenderer\"},{\"id\":\"90a25601-5170-4030-9bb1-d1cb15639eec\",\"type\":\"GlyphRenderer\"},{\"id\":\"0e3750de-91d8-4858-9dff-a70df4a98aa7\",\"type\":\"GlyphRenderer\"},{\"id\":\"9cfb5450-8640-4dc3-a130-0090c3f9b974\",\"type\":\"GlyphRenderer\"},{\"id\":\"e3f6de63-7bc7-40a3-b0fc-47fd6c9ced1a\",\"type\":\"GlyphRenderer\"},{\"id\":\"835be018-4938-4f0c-9db5-b67e9ed3aa6e\",\"type\":\"GlyphRenderer\"},{\"id\":\"e6988ee4-6087-45c7-80c7-4fe80fdef3b0\",\"type\":\"GlyphRenderer\"},{\"id\":\"1bc832f0-d593-4694-bd56-66053fdb0303\",\"type\":\"GlyphRenderer\"},{\"id\":\"aa038a75-1089-48a9-8969-5fa45d373fa5\",\"type\":\"GlyphRenderer\"},{\"id\":\"5c723970-d627-47dd-887c-a2f91615adc2\",\"type\":\"GlyphRenderer\"},{\"id\":\"578a64c4-b1ee-4ba7-b1b2-3177678dbf36\",\"type\":\"GlyphRenderer\"},{\"id\":\"f704e7bb-3ae6-4879-a069-9074944975ea\",\"type\":\"GlyphRenderer\"},{\"id\":\"8dfdeb97-f9d3-4064-ba89-97068c87e9d6\",\"type\":\"GlyphRenderer\"},{\"id\":\"ee57f5b4-e21e-454b-bece-b4080cf74e40\",\"type\":\"GlyphRenderer\"},{\"id\":\"bbfa9c9f-2bea-479a-96ec-e07960b00fe5\",\"type\":\"GlyphRenderer\"},{\"id\":\"b0b02bb5-f181-442b-83b6-0f4ff4778961\",\"type\":\"GlyphRenderer\"},{\"id\":\"0a602a83-ac3a-4f33-9aa5-d6c6dc20d00e\",\"type\":\"GlyphRenderer\"},{\"id\":\"fbcfee7e-999f-46eb-aa89-ab9221eb8f77\",\"type\":\"Legend\"},{\"id\":\"8df52ae9-888e-48a0-a550-ddcc788108db\",\"type\":\"LinearAxis\"},{\"id\":\"457ce8f8-41c0-424d-a471-5da7b9717f6a\",\"type\":\"LinearAxis\"},{\"id\":\"41110901-9156-44a9-a2df-29b66053bb54\",\"type\":\"Grid\"}],\"title\":{\"id\":\"b8562580-2936-4aa4-b873-588404b6b65c\",\"type\":\"Title\"},\"tool_events\":{\"id\":\"a11e46ed-fd11-4d9f-86fc-651926f5d71f\",\"type\":\"ToolEvents\"},\"toolbar\":{\"id\":\"25af5021-7225-4e4f-ad94-9b2229efc497\",\"type\":\"Toolbar\"},\"x_mapper_type\":\"auto\",\"x_range\":{\"id\":\"3fc71e2c-fc55-4e03-86ba-baab0bf26ed6\",\"type\":\"Range1d\"},\"y_mapper_type\":\"auto\",\"y_range\":{\"id\":\"24945a26-b3f9-4db3-8a03-0cfe4ff02b6b\",\"type\":\"Range1d\"}},\"id\":\"197186d2-75e3-4931-8078-3a33f3d5ec66\",\"subtype\":\"Chart\",\"type\":\"Plot\"},{\"attributes\":{\"data_source\":{\"id\":\"f69e9d6e-f559-4113-b6d0-af91a0e91d3d\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"ea9f0d43-4cc8-4f01-bfff-06f3de019da8\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"ba9a63f4-29dc-411d-a24a-8a612c2d1f8b\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"16ad6768-6736-480b-b824-6365f26d3aa0\",\"type\":\"Rect\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"69d5337f-ca29-4993-b0a4-e3368c726a19\",\"type\":\"Rect\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"[2.000000, 4.560000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[624.0],\"label\":[\"[2.000000, 4.560000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5600000000000005],\"x\":[\"3.28\"],\"y\":[312.0]}},\"id\":\"71e05722-72f9-45b1-9f0f-b14fcf883e23\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(104.400000, 106.960000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[0.0],\"label\":[\"(104.400000, 106.960000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5600000000000023],\"x\":[\"105.68\"],\"y\":[0.0]}},\"id\":\"51803eef-a774-4346-84f2-207e88a53148\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(83.920000, 86.480000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[0.0],\"label\":[\"(83.920000, 86.480000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5600000000000023],\"x\":[\"85.2\"],\"y\":[0.0]}},\"id\":\"87321471-99e6-48ea-86d5-f1df4d29a44a\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(89.040000, 91.600000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[0.0],\"label\":[\"(89.040000, 91.600000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5600000000000023],\"x\":[\"90.32\"],\"y\":[0.0]}},\"id\":\"f060c3d9-c8c0-4639-b74f-538e12064e81\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(99.280000, 101.840000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[0.0],\"label\":[\"(99.280000, 101.840000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5600000000000023],\"x\":[\"100.56\"],\"y\":[0.0]}},\"id\":\"cd47a36d-f8fe-46c6-9b3e-f6a35f45a6df\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"e703ca66-c835-4b4a-a02f-30085d2cd992\",\"type\":\"Rect\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"6dda5c4d-63a5-4979-85d3-4d6bf20a6ad5\",\"type\":\"Rect\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"67caa2e1-337f-423f-b911-50138a57a347\",\"type\":\"Rect\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(12.240000, 14.800000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[581.0],\"label\":[\"(12.240000, 14.800000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5600000000000005],\"x\":[\"13.52\"],\"y\":[290.5]}},\"id\":\"d38232c3-404a-48fd-b874-2a9aa3d5cd74\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(42.960000, 45.520000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[9.0],\"label\":[\"(42.960000, 45.520000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5600000000000023],\"x\":[\"44.24\"],\"y\":[4.5]}},\"id\":\"b24e33a4-a9fe-40b7-9012-151c3c9037ca\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"cd47a36d-f8fe-46c6-9b3e-f6a35f45a6df\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"a4123d63-35a2-4810-ba42-57eb3452616b\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"835be018-4938-4f0c-9db5-b67e9ed3aa6e\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(9.680000, 12.240000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[1165.0],\"label\":[\"(9.680000, 12.240000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5600000000000005],\"x\":[\"10.96\"],\"y\":[582.5]}},\"id\":\"f30c593a-27f9-43e6-b84a-7173c9d6ec21\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"plot\":{\"id\":\"197186d2-75e3-4931-8078-3a33f3d5ec66\",\"subtype\":\"Chart\",\"type\":\"Plot\"}},\"id\":\"e6b86c91-47b1-4ff2-a51c-afc7bd5b2a28\",\"type\":\"SaveTool\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"fa88c318-20cd-45fc-b64f-7648edf93463\",\"type\":\"Rect\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(25.040000, 27.600000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[57.0],\"label\":[\"(25.040000, 27.600000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5600000000000023],\"x\":[\"26.32\"],\"y\":[28.5]}},\"id\":\"f2d3a4df-b4d0-421b-b240-eeb8fb2339d7\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"f30c593a-27f9-43e6-b84a-7173c9d6ec21\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"51223e4c-3531-4729-a412-c201f6017b94\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"7f135218-09d6-4a98-ac2a-5d9f33546592\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"f66112c6-7b88-40f5-8e19-8a7f7d29efbc\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"data_source\":{\"id\":\"feb2801f-7953-4e76-923d-157662544ab9\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"34c71686-af99-408d-9fb1-7642399952a6\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"b4dd1306-6ef8-4052-9658-0a76f0ab1093\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"plot\":{\"id\":\"197186d2-75e3-4931-8078-3a33f3d5ec66\",\"subtype\":\"Chart\",\"type\":\"Plot\"}},\"id\":\"3cecf164-9922-4131-b76e-23086abfb9a4\",\"type\":\"ResetTool\"},{\"attributes\":{\"data_source\":{\"id\":\"8f39287b-60bd-4ff0-9c6d-1725cd59ad0b\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"0dee2997-07b2-45d4-9db0-4bd9d97ccb60\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"696029f5-0dc1-42c3-8c71-0f1354e034a2\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(30.160000, 32.720000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[29.0],\"label\":[\"(30.160000, 32.720000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5599999999999987],\"x\":[\"31.439999999999998\"],\"y\":[14.5]}},\"id\":\"acb3165d-2686-415d-bc33-b9d7f4dfda05\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"2e20c2b8-64f7-4a2e-8e68-b6f3936c2b68\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"fc5e142c-0e8d-4d12-a07d-00415b00c4aa\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"578a64c4-b1ee-4ba7-b1b2-3177678dbf36\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data_source\":{\"id\":\"cf5a9c5c-2913-4d49-ac11-baafd0b86b20\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"b175f1f4-426e-43c5-9b4b-bf02c72907a0\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"0cd2a0d2-9e46-43af-a743-1d73fed61ff0\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"b65cbd52-c9ce-4347-a6da-6a974e804269\",\"type\":\"Rect\"},{\"attributes\":{\"data_source\":{\"id\":\"7181729b-6599-45e1-a650-eeacd3f2d010\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"2249c9f1-7898-46a3-b9eb-d0f7f8f12609\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"b4862076-bd5b-47c1-9c84-c1cdef8270b3\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data_source\":{\"id\":\"03f6512e-8c87-44fb-84ae-141a8766151f\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"193d5b66-243d-47e1-88b4-97561f18fb93\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"fdc4ff96-a44d-4cc5-b8f8-8801c879b25e\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(58.320000, 60.880000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[2.0],\"label\":[\"(58.320000, 60.880000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5600000000000023],\"x\":[\"59.6\"],\"y\":[1.0]}},\"id\":\"79222db9-4644-49f8-88a6-2cb7a68600cc\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"99c4c91f-3a43-4a3e-9233-c08c2cdf944c\",\"type\":\"Rect\"},{\"attributes\":{\"data_source\":{\"id\":\"54bf9cd4-8ccd-480a-bbf1-f0f563b2d35e\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"d6a21e66-819c-4b80-b028-368a38889a46\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"2d31277a-a2f4-4833-a07c-36c4274882ad\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data_source\":{\"id\":\"da5b4c9b-4eea-40f2-a831-8d08fcefe39a\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"06d48b09-eaaf-4019-8b80-f2c5a38d956b\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"b0b02bb5-f181-442b-83b6-0f4ff4778961\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"50bb4aa7-e693-4c9d-87f6-cb5fd16aafce\",\"type\":\"Rect\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"81ea36ee-ce42-4b61-9b2c-bc97a9e38a75\",\"type\":\"Rect\"},{\"attributes\":{\"data_source\":{\"id\":\"f2d3a4df-b4d0-421b-b240-eeb8fb2339d7\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"86315aaa-4c33-4148-a37d-a47feb30e377\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"e2847241-be5d-40f0-856e-32529e504987\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data_source\":{\"id\":\"a48d6fa1-74eb-49e8-aaad-c4a2b4b72d10\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"1d9b202a-106c-4748-a2d3-13c45f101b1e\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"8b0aabac-d8b1-478b-825f-1cc236dd37f8\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"c93bed7e-db7b-4c69-80c5-2ff23a2d9809\",\"type\":\"Rect\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"86315aaa-4c33-4148-a37d-a47feb30e377\",\"type\":\"Rect\"},{\"attributes\":{\"data_source\":{\"id\":\"79a32e08-93fb-4949-910c-bddca8c1a9c8\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"cfb0ec81-e73b-453f-ac5b-e7bfc97c9156\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"f704e7bb-3ae6-4879-a069-9074944975ea\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(76.240000, 78.800000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[0.0],\"label\":[\"(76.240000, 78.800000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5600000000000023],\"x\":[\"77.52\"],\"y\":[0.0]}},\"id\":\"feb2801f-7953-4e76-923d-157662544ab9\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(60.880000, 63.440000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[0.0],\"label\":[\"(60.880000, 63.440000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.559999999999995],\"x\":[\"62.16\"],\"y\":[0.0]}},\"id\":\"f18f1718-5f6a-4569-96c2-afd734615274\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"60a33859-5f6a-4850-8112-eea1f2121d46\",\"type\":\"Rect\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"ebf5ad0f-0f84-4a9b-adc9-50c4882b3bef\",\"type\":\"Rect\"},{\"attributes\":{\"axis_label\":\"Count( X )\",\"formatter\":{\"id\":\"f66112c6-7b88-40f5-8e19-8a7f7d29efbc\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"197186d2-75e3-4931-8078-3a33f3d5ec66\",\"subtype\":\"Chart\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"59b00378-9769-49dd-93a5-5ea78952574a\",\"type\":\"BasicTicker\"}},\"id\":\"457ce8f8-41c0-424d-a471-5da7b9717f6a\",\"type\":\"LinearAxis\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"c9b8b8c3-25db-47a6-9b98-e35eb4135ed0\",\"type\":\"Rect\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(73.680000, 76.240000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[1.0],\"label\":[\"(73.680000, 76.240000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.559999999999988],\"x\":[\"74.96000000000001\"],\"y\":[0.5]}},\"id\":\"9a44eeae-14f6-4078-b24f-936f5055bf93\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"overlay\":{\"id\":\"62c80291-e630-47c7-829c-6784df77e1ff\",\"type\":\"BoxAnnotation\"},\"plot\":{\"id\":\"197186d2-75e3-4931-8078-3a33f3d5ec66\",\"subtype\":\"Chart\",\"type\":\"Plot\"}},\"id\":\"738c6a79-3bc2-4a25-813e-c4eb708088fe\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"data_source\":{\"id\":\"79222db9-4644-49f8-88a6-2cb7a68600cc\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"ce6b8ef1-b9bc-4f32-9ff3-0365fd8a2a8b\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"c3ef60a8-af88-49d5-9e76-16b70c22e729\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(96.720000, 99.280000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[0.0],\"label\":[\"(96.720000, 99.280000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5600000000000023],\"x\":[\"98.0\"],\"y\":[0.0]}},\"id\":\"a5d40a38-badc-4543-888f-6d1ae9bb35eb\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"a11e46ed-fd11-4d9f-86fc-651926f5d71f\",\"type\":\"ToolEvents\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"ea9f0d43-4cc8-4f01-bfff-06f3de019da8\",\"type\":\"Rect\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(117.200000, 119.760000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[0.0],\"label\":[\"(117.200000, 119.760000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5600000000000023],\"x\":[\"118.48\"],\"y\":[0.0]}},\"id\":\"5b2fa20a-83fa-4530-8671-116295b66d40\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"9a44eeae-14f6-4078-b24f-936f5055bf93\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"e703ca66-c835-4b4a-a02f-30085d2cd992\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"0cdd98c0-f63e-4f7e-bd60-0ea9f2cd0c5f\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"823119c4-275f-433b-b4a8-f89093fbfc9d\",\"type\":\"Rect\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(127.440000, 130.000000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[1.0],\"label\":[\"(127.440000, 130.000000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5600000000000023],\"x\":[\"128.72\"],\"y\":[0.5]}},\"id\":\"5df781fb-7a71-4e9a-9e19-237d91785ebe\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"baa02aa0-5961-41bc-bf05-0f736d14be37\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"08fae914-e429-4772-bace-b6efdcd7368e\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"73888867-9a72-42af-bf0f-58b000f2dab3\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(86.480000, 89.040000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[0.0],\"label\":[\"(86.480000, 89.040000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5600000000000023],\"x\":[\"87.76\"],\"y\":[0.0]}},\"id\":\"795411f7-9972-41d3-ac45-84fb210b79a5\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"87655ce8-9396-477f-b8e5-291bb4b04687\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"callback\":null,\"end\":1483.9},\"id\":\"24945a26-b3f9-4db3-8a03-0cfe4ff02b6b\",\"type\":\"Range1d\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"0656517c-e3ae-4649-944f-a7010c347a13\",\"type\":\"Rect\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(68.560000, 71.120000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[1.0],\"label\":[\"(68.560000, 71.120000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5600000000000023],\"x\":[\"69.84\"],\"y\":[0.5]}},\"id\":\"298ef655-2c32-4c82-81f1-29c76c49b932\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(53.200000, 55.760000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[2.0],\"label\":[\"(53.200000, 55.760000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.559999999999995],\"x\":[\"54.480000000000004\"],\"y\":[1.0]}},\"id\":\"f9e412a7-a21d-4a2e-b07d-a27a8d68eb0a\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(4.560000, 7.120000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[1349.0],\"label\":[\"(4.560000, 7.120000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5599999999999996],\"x\":[\"5.84\"],\"y\":[674.5]}},\"id\":\"9aedab73-069f-42ab-86b2-0fe852359304\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"0dee2997-07b2-45d4-9db0-4bd9d97ccb60\",\"type\":\"Rect\"},{\"attributes\":{\"data_source\":{\"id\":\"cbbee7fc-3b8f-4f9d-a04b-479d604ac517\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"e8745f98-ee67-4ecb-bfc5-11a2851abf3c\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"24e0e542-d36e-41e3-b9a4-e5c3d03129fe\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"fc4cbe98-762d-4f7a-9f7f-84271be293a4\",\"type\":\"Rect\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(109.520000, 112.080000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[0.0],\"label\":[\"(109.520000, 112.080000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5600000000000023],\"x\":[\"110.8\"],\"y\":[0.0]}},\"id\":\"d6ae9d6f-b911-4179-95f5-2dc33b9e8aca\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"d38232c3-404a-48fd-b874-2a9aa3d5cd74\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"f535c0ff-9131-4c97-8847-d22c9d797dde\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"96bf7663-8b8d-4bf5-9ea4-1ea6aae7871e\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(22.480000, 25.040000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[150.0],\"label\":[\"(22.480000, 25.040000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5599999999999987],\"x\":[\"23.759999999999998\"],\"y\":[75.0]}},\"id\":\"20d6fc10-4842-452e-b158-90cc74eb37af\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"3324e126-e035-4329-8451-6afb909e7a81\",\"type\":\"PanTool\"},{\"id\":\"a6d68ecf-3367-45a7-ae70-1a7d578c6619\",\"type\":\"WheelZoomTool\"},{\"id\":\"738c6a79-3bc2-4a25-813e-c4eb708088fe\",\"type\":\"BoxZoomTool\"},{\"id\":\"e6b86c91-47b1-4ff2-a51c-afc7bd5b2a28\",\"type\":\"SaveTool\"},{\"id\":\"3cecf164-9922-4131-b76e-23086abfb9a4\",\"type\":\"ResetTool\"},{\"id\":\"700402c5-76ac-4663-84ec-d06350c2e54f\",\"type\":\"HelpTool\"}]},\"id\":\"25af5021-7225-4e4f-ad94-9b2229efc497\",\"type\":\"Toolbar\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(35.280000, 37.840000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[14.0],\"label\":[\"(35.280000, 37.840000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5600000000000023],\"x\":[\"36.56\"],\"y\":[7.0]}},\"id\":\"4be0084f-c5c5-4806-a0ba-3de0aec14139\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"5df781fb-7a71-4e9a-9e19-237d91785ebe\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"c93bed7e-db7b-4c69-80c5-2ff23a2d9809\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"0a602a83-ac3a-4f33-9aa5-d6c6dc20d00e\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"location\":\"top_left\",\"plot\":{\"id\":\"197186d2-75e3-4931-8078-3a33f3d5ec66\",\"subtype\":\"Chart\",\"type\":\"Plot\"}},\"id\":\"fbcfee7e-999f-46eb-aa89-ab9221eb8f77\",\"type\":\"Legend\"},{\"attributes\":{\"data_source\":{\"id\":\"f18f1718-5f6a-4569-96c2-afd734615274\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"13a87188-c7d8-40e7-a26f-6d80089bb4f1\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"50d86b5c-262d-4c26-b23a-02e947a858e4\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(19.920000, 22.480000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[233.0],\"label\":[\"(19.920000, 22.480000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5599999999999987],\"x\":[\"21.200000000000003\"],\"y\":[116.5]}},\"id\":\"22f485b5-9196-4be8-8fdc-bd883016843d\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(91.600000, 94.160000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[0.0],\"label\":[\"(91.600000, 94.160000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.559999999999988],\"x\":[\"92.88\"],\"y\":[0.0]}},\"id\":\"47d63440-9455-40fc-8d0c-861643b03519\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"f176ed43-3e69-408b-817e-a8f1e3c98b6d\",\"type\":\"Rect\"},{\"attributes\":{\"data_source\":{\"id\":\"87321471-99e6-48ea-86d5-f1df4d29a44a\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"16ad6768-6736-480b-b824-6365f26d3aa0\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"8aa11fc4-7895-46d3-a8cc-a828eb470c2b\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(81.360000, 83.920000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[0.0],\"label\":[\"(81.360000, 83.920000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5600000000000023],\"x\":[\"82.64\"],\"y\":[0.0]}},\"id\":\"881a8bc3-ea2e-4403-8991-7dca4f54fd09\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(48.080000, 50.640000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[1.0],\"label\":[\"(48.080000, 50.640000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5600000000000023],\"x\":[\"49.36\"],\"y\":[0.5]}},\"id\":\"1ab9a58c-bc23-4f09-9165-9b02a2ecb88f\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"51223e4c-3531-4729-a412-c201f6017b94\",\"type\":\"Rect\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"b175f1f4-426e-43c5-9b4b-bf02c72907a0\",\"type\":\"Rect\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(112.080000, 114.640000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[0.0],\"label\":[\"(112.080000, 114.640000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5600000000000023],\"x\":[\"113.36\"],\"y\":[0.0]}},\"id\":\"2e20c2b8-64f7-4a2e-8e68-b6f3936c2b68\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"plot\":null,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"62c80291-e630-47c7-829c-6784df77e1ff\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(32.720000, 35.280000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[27.0],\"label\":[\"(32.720000, 35.280000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5600000000000023],\"x\":[\"34.0\"],\"y\":[13.5]}},\"id\":\"baa02aa0-5961-41bc-bf05-0f736d14be37\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"f060c3d9-c8c0-4639-b74f-538e12064e81\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"99c4c91f-3a43-4a3e-9233-c08c2cdf944c\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"90a25601-5170-4030-9bb1-d1cb15639eec\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"08fae914-e429-4772-bace-b6efdcd7368e\",\"type\":\"Rect\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"ce6b8ef1-b9bc-4f32-9ff3-0365fd8a2a8b\",\"type\":\"Rect\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(50.640000, 53.200000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[2.0],\"label\":[\"(50.640000, 53.200000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5600000000000023],\"x\":[\"51.92\"],\"y\":[1.0]}},\"id\":\"1e6ed729-49ec-4e25-94b4-5f9cd1e5d2e9\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"795411f7-9972-41d3-ac45-84fb210b79a5\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"fa88c318-20cd-45fc-b64f-7648edf93463\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"7c650a53-e973-4f60-85ad-e90cd99a7eae\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(45.520000, 48.080000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[7.0],\"label\":[\"(45.520000, 48.080000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.559999999999995],\"x\":[\"46.8\"],\"y\":[3.5]}},\"id\":\"8f39287b-60bd-4ff0-9c6d-1725cd59ad0b\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(124.880000, 127.440000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[0.0],\"label\":[\"(124.880000, 127.440000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5600000000000023],\"x\":[\"126.16\"],\"y\":[0.0]}},\"id\":\"da5b4c9b-4eea-40f2-a831-8d08fcefe39a\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"59b00378-9769-49dd-93a5-5ea78952574a\",\"type\":\"BasicTicker\"},{\"attributes\":{\"data_source\":{\"id\":\"b24e33a4-a9fe-40b7-9012-151c3c9037ca\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"8f84bd86-13dc-4dc9-8b18-c03d2c06f60b\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"04ee5168-04de-43e8-b9a5-48466f481df8\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"plot\":{\"id\":\"197186d2-75e3-4931-8078-3a33f3d5ec66\",\"subtype\":\"Chart\",\"type\":\"Plot\"}},\"id\":\"700402c5-76ac-4663-84ec-d06350c2e54f\",\"type\":\"HelpTool\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(63.440000, 66.000000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[0.0],\"label\":[\"(63.440000, 66.000000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5600000000000023],\"x\":[\"64.72\"],\"y\":[0.0]}},\"id\":\"cbbee7fc-3b8f-4f9d-a04b-479d604ac517\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(40.400000, 42.960000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[8.0],\"label\":[\"(40.400000, 42.960000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5600000000000023],\"x\":[\"41.68\"],\"y\":[4.0]}},\"id\":\"35eb611b-4a16-432e-9c55-bca9339b0081\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"f9e412a7-a21d-4a2e-b07d-a27a8d68eb0a\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"a628c647-ea16-4d57-b18d-a920d23dcc05\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"773fbfd0-8614-4f7d-9bb5-4167ce347257\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"fc5e142c-0e8d-4d12-a07d-00415b00c4aa\",\"type\":\"Rect\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"c8f02c4a-9493-4d17-91d2-451c64f914d4\",\"type\":\"Rect\"},{\"attributes\":{\"data_source\":{\"id\":\"a5d40a38-badc-4543-888f-6d1ae9bb35eb\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"823119c4-275f-433b-b4a8-f89093fbfc9d\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"e3f6de63-7bc7-40a3-b0fc-47fd6c9ced1a\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(7.120000, 9.680000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[1032.0],\"label\":[\"(7.120000, 9.680000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5599999999999996],\"x\":[\"8.4\"],\"y\":[516.0]}},\"id\":\"54bf9cd4-8ccd-480a-bbf1-f0f563b2d35e\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"9aedab73-069f-42ab-86b2-0fe852359304\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"fbc40265-c78f-4a25-ae94-6d3a7c9f0546\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"697039da-ee92-4fc2-9c07-acd943ecbd6c\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data_source\":{\"id\":\"5b2fa20a-83fa-4530-8671-116295b66d40\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"122d9d3b-c2fb-49d5-a526-83c46e7a1095\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"8dfdeb97-f9d3-4064-ba89-97068c87e9d6\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data_source\":{\"id\":\"47d63440-9455-40fc-8d0c-861643b03519\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"6dda5c4d-63a5-4979-85d3-4d6bf20a6ad5\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"0e3750de-91d8-4858-9dff-a70df4a98aa7\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data_source\":{\"id\":\"298ef655-2c32-4c82-81f1-29c76c49b932\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"50bb4aa7-e693-4c9d-87f6-cb5fd16aafce\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"fa6d3ad8-e466-4111-88b5-b807078d1cc6\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data_source\":{\"id\":\"d5899180-b6b1-421c-aa2c-1d282df163f6\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"706f3222-88bc-498d-98da-b726f32437dd\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"fc62bbb8-7615-4d7d-bc72-412be5baf6c2\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data_source\":{\"id\":\"35eb611b-4a16-432e-9c55-bca9339b0081\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"67caa2e1-337f-423f-b911-50138a57a347\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"b743010c-de8c-4e43-9229-a7657f7aa3de\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"72c9109b-6ab4-4159-8515-f0fb091282cc\",\"type\":\"Rect\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(101.840000, 104.400000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[0.0],\"label\":[\"(101.840000, 104.400000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5600000000000023],\"x\":[\"103.12\"],\"y\":[0.0]}},\"id\":\"831b8961-5c89-4eed-b080-11bd78b3ee46\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"cfb0ec81-e73b-453f-ac5b-e7bfc97c9156\",\"type\":\"Rect\"},{\"attributes\":{\"data_source\":{\"id\":\"4be0084f-c5c5-4806-a0ba-3de0aec14139\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"b65cbd52-c9ce-4347-a6da-6a974e804269\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"d16bfdf7-978e-4dbb-ab34-193daa038e1b\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data_source\":{\"id\":\"1e6ed729-49ec-4e25-94b4-5f9cd1e5d2e9\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"4bfe3009-4781-4cf7-9116-ca41ffe0078c\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"622e7080-9616-4264-8ba2-ac56b4b47da7\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"f535c0ff-9131-4c97-8847-d22c9d797dde\",\"type\":\"Rect\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"04ca67f4-47f4-4ea2-b0ad-0436b6d1627a\",\"type\":\"Rect\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(14.800000, 17.360000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[554.0],\"label\":[\"(14.800000, 17.360000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5599999999999987],\"x\":[\"16.08\"],\"y\":[277.0]}},\"id\":\"d5899180-b6b1-421c-aa2c-1d282df163f6\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"122d9d3b-c2fb-49d5-a526-83c46e7a1095\",\"type\":\"Rect\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(94.160000, 96.720000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[1.0],\"label\":[\"(94.160000, 96.720000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5600000000000023],\"x\":[\"95.44\"],\"y\":[0.5]}},\"id\":\"d570c0b6-6b27-4704-863a-38a43643a549\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"71e05722-72f9-45b1-9f0f-b14fcf883e23\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"81ea36ee-ce42-4b61-9b2c-bc97a9e38a75\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"95824869-348a-485c-8208-5ea2b9d5d22b\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"a628c647-ea16-4d57-b18d-a920d23dcc05\",\"type\":\"Rect\"},{\"attributes\":{\"data_source\":{\"id\":\"831b8961-5c89-4eed-b080-11bd78b3ee46\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"04ca67f4-47f4-4ea2-b0ad-0436b6d1627a\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"e6988ee4-6087-45c7-80c7-4fe80fdef3b0\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"3e8a142c-3762-48fc-983c-b1dc303a453f\",\"type\":\"Rect\"},{\"attributes\":{\"data_source\":{\"id\":\"1ab9a58c-bc23-4f09-9165-9b02a2ecb88f\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"3e8a142c-3762-48fc-983c-b1dc303a453f\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"bc77fb25-20b8-43d0-b10d-b1a954f888cd\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(106.960000, 109.520000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[0.0],\"label\":[\"(106.960000, 109.520000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.559999999999988],\"x\":[\"108.24\"],\"y\":[0.0]}},\"id\":\"ced14f4e-7e2d-4a5c-a196-e4e20e13ce2a\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"34c71686-af99-408d-9fb1-7642399952a6\",\"type\":\"Rect\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(119.760000, 122.320000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[0.0],\"label\":[\"(119.760000, 122.320000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5600000000000023],\"x\":[\"121.03999999999999\"],\"y\":[0.0]}},\"id\":\"e5755d4d-a70a-4f6e-9b1e-7d53c3c13201\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"22f485b5-9196-4be8-8fdc-bd883016843d\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"60a33859-5f6a-4850-8112-eea1f2121d46\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"c8d9c04e-ed8d-4c0e-ada6-aac2c17cdf86\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(27.600000, 30.160000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[51.0],\"label\":[\"(27.600000, 30.160000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5599999999999987],\"x\":[\"28.880000000000003\"],\"y\":[25.5]}},\"id\":\"f69e9d6e-f559-4113-b6d0-af91a0e91d3d\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"2f0e31c2-992e-4f4f-b147-02d035e7bb52\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"c8f02c4a-9493-4d17-91d2-451c64f914d4\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"f0be2aad-a16f-4dbd-83da-a151713f9dc6\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data_source\":{\"id\":\"d6ae9d6f-b911-4179-95f5-2dc33b9e8aca\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"83accc50-43d6-4c9c-af5b-32a5bdfc9d83\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"5c723970-d627-47dd-887c-a2f91615adc2\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"a4123d63-35a2-4810-ba42-57eb3452616b\",\"type\":\"Rect\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"2249c9f1-7898-46a3-b9eb-d0f7f8f12609\",\"type\":\"Rect\"},{\"attributes\":{\"data_source\":{\"id\":\"20d6fc10-4842-452e-b158-90cc74eb37af\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"72c9109b-6ab4-4159-8515-f0fb091282cc\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"e92d6a56-6aed-4838-81c1-cb6a5ade09ff\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"83accc50-43d6-4c9c-af5b-32a5bdfc9d83\",\"type\":\"Rect\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(37.840000, 40.400000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[13.0],\"label\":[\"(37.840000, 40.400000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.559999999999995],\"x\":[\"39.120000000000005\"],\"y\":[6.5]}},\"id\":\"b27c6292-05fe-4499-8101-a4b0ce04fc84\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(66.000000, 68.560000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[1.0],\"label\":[\"(66.000000, 68.560000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5600000000000023],\"x\":[\"67.28\"],\"y\":[0.5]}},\"id\":\"03f6512e-8c87-44fb-84ae-141a8766151f\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"4b0563c5-cf34-49f0-b644-cf13168a4f2e\",\"type\":\"BasicTicker\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"13a87188-c7d8-40e7-a26f-6d80089bb4f1\",\"type\":\"Rect\"},{\"attributes\":{\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"field\":\"color\"},\"height\":{\"field\":\"height\",\"units\":\"data\"},\"line_color\":{\"field\":\"line_color\"},\"width\":{\"field\":\"width\",\"units\":\"data\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"4bfe3009-4781-4cf7-9116-ca41ffe0078c\",\"type\":\"Rect\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"label\",\"line_alpha\",\"fill_alpha\",\"width\",\"height\",\"line_color\",\"color\",\"x\",\"y\"],\"data\":{\"chart_index\":[\"(71.120000, 73.680000]\"],\"color\":[\"#f22c40\"],\"fill_alpha\":[0.8],\"height\":[1.0],\"label\":[\"(71.120000, 73.680000]\"],\"line_alpha\":[1.0],\"line_color\":[\"black\"],\"width\":[2.5600000000000023],\"x\":[\"72.4\"],\"y\":[0.5]}},\"id\":\"cf5a9c5c-2913-4d49-ac11-baafd0b86b20\",\"type\":\"ColumnDataSource\"}],\"root_ids\":[\"197186d2-75e3-4931-8078-3a33f3d5ec66\"]},\"title\":\"Bokeh Application\",\"version\":\"0.12.4\"}};\n",
" var render_items = [{\"docid\":\"b315479b-aa1c-4b1d-a62f-5f3345d28e0e\",\"elementid\":\"46433a97-e836-4db8-9dbd-6723adbab9ef\",\"modelid\":\"197186d2-75e3-4931-8078-3a33f3d5ec66\"}];\n",
" \n",
" Bokeh.embed.embed_items(docs_json, render_items);\n",
" };\n",
" if (document.readyState != \"loading\") fn();\n",
" else document.addEventListener(\"DOMContentLoaded\", fn);\n",
" })();\n",
" },\n",
" function(Bokeh) {\n",
" }\n",
" ];\n",
" \n",
" function run_inline_js() {\n",
" \n",
" if ((window.Bokeh !== undefined) || (force === true)) {\n",
" for (var i = 0; i < inline_js.length; i++) {\n",
" inline_js[i](window.Bokeh);\n",
" }if (force === true) {\n",
" display_loaded();\n",
" }} else if (Date.now() < window._bokeh_timeout) {\n",
" setTimeout(run_inline_js, 100);\n",
" } else if (!window._bokeh_failed_load) {\n",
" console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
" window._bokeh_failed_load = true;\n",
" } else if (force !== true) {\n",
" var cell = $(document.getElementById(\"46433a97-e836-4db8-9dbd-6723adbab9ef\")).parents('.cell').data().cell;\n",
" cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
" }\n",
" \n",
" }\n",
" \n",
" if (window._bokeh_is_loading === 0) {\n",
" console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
" run_inline_js();\n",
" } else {\n",
" load_libs(js_urls, function() {\n",
" console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
" run_inline_js();\n",
" });\n",
" }\n",
" }(this));\n",
"</script>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Mean of sentences length is 11.279889538661468\n"
]
}
],
"source": [
"import nltk\n",
"from collections import Counter\n",
"from bokeh.charts import Histogram, output_notebook, show\n",
"\n",
"output_notebook()\n",
"\n",
"sentences = set(nltk.sent_tokenize(text[81:]))\n",
"sent_c = Counter()\n",
"\n",
"# Get average length\n",
"for s in sentences:\n",
" sent_c[s] = nltk.word_tokenize(s).__len__()\n",
" \n",
"s_lengths = np.array(list(sent_c.values()))\n",
"\n",
"data = dict(x=s_lengths)\n",
"\n",
"p = Histogram(data, xlabel='sentence lengths', bins=50)\n",
"show(p)\n",
"\n",
"\n",
"print('Mean of sentences length is {}'.format(s_lengths.mean()))\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"## Implement Preprocessing Functions\n",
"The first thing to do to any dataset is preprocessing. Implement the following preprocessing functions below:\n",
"- Lookup Table\n",
"- Tokenize Punctuation\n",
"\n",
"### Lookup Table\n",
"To create a word embedding, you first need to transform the words to ids. In this function, create two dictionaries:\n",
"- Dictionary to go from the words to an id, we'll call `vocab_to_int`\n",
"- Dictionary to go from the id to word, we'll call `int_to_vocab`\n",
"\n",
"Return these dictionaries in the following tuple `(vocab_to_int, int_to_vocab)`"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Tests Passed\n"
]
}
],
"source": [
"import numpy as np\n",
"import problem_unittests as tests\n",
"\n",
"def create_lookup_tables(text):\n",
" \"\"\"\n",
" Create lookup tables for vocabulary\n",
" :param text: The text of tv scripts split into words\n",
" :return: A tuple of dicts (vocab_to_int, int_to_vocab)\n",
" \"\"\"\n",
" vocab = set(text)\n",
" \n",
" vocab_to_int = {word: index for index, word in enumerate(vocab)}\n",
" int_to_vocab = {index: word for (word, index) in vocab_to_int.items()}\n",
" \n",
" return vocab_to_int, int_to_vocab\n",
"\n",
"\n",
"\"\"\"\n",
"DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE\n",
"\"\"\"\n",
"tests.test_create_lookup_tables(create_lookup_tables)"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"### Tokenize Punctuation\n",
"We'll be splitting the script into a word array using spaces as delimiters. However, punctuations like periods and exclamation marks make it hard for the neural network to distinguish between the word \"bye\" and \"bye!\".\n",
"\n",
"Implement the function `token_lookup` to return a dict that will be used to tokenize symbols like \"!\" into \"||Exclamation_Mark||\". Create a dictionary for the following symbols where the symbol is the key and value is the token:\n",
"- Period ( . )\n",
"- Comma ( , )\n",
"- Quotation Mark ( \" )\n",
"- Semicolon ( ; )\n",
"- Exclamation mark ( ! )\n",
"- Question mark ( ? )\n",
"- Left Parentheses ( ( )\n",
"- Right Parentheses ( ) )\n",
"- Dash ( -- )\n",
"- Return ( \\n )\n",
"\n",
"This dictionary will be used to token the symbols and add the delimiter (space) around it. This separates the symbols as it's own word, making it easier for the neural network to predict on the next word. Make sure you don't use a token that could be confused as a word. Instead of using the token \"dash\", try using something like \"||dash||\"."
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Tests Passed\n"
]
}
],
"source": [
"def token_lookup():\n",
" \"\"\"\n",
" Generate a dict to turn punctuation into a token.\n",
" :return: Tokenize dictionary where the key is the punctuation and the value is the token\n",
" \"\"\"\n",
" \n",
" return {\n",
" '.': '||period||',\n",
" ',': '||comma||',\n",
" '\"': '||quotation_mark||',\n",
" ';': '||semicolon||',\n",
" '!': '||exclamation_mark||',\n",
" '?': '||question_mark||',\n",
" '(': '||left_parentheses',\n",
" ')': '||right_parentheses',\n",
" '--': '||dash||',\n",
" '\\n': '||return||'\n",
" }\n",
"\n",
"\"\"\"\n",
"DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE\n",
"\"\"\"\n",
"tests.test_tokenize(token_lookup)"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"## Preprocess all the data and save it\n",
"Running the code cell below will preprocess all the data and save it to file."
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"\"\"\"\n",
"DON'T MODIFY ANYTHING IN THIS CELL\n",
"\"\"\"\n",
"# Preprocess Training, Validation, and Testing Data\n",
"helper.preprocess_and_save_data(data_dir, token_lookup, create_lookup_tables)"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"# Check Point\n",
"This is your first checkpoint. If you ever decide to come back to this notebook or have to restart the notebook, you can start from here. The preprocessed data has been saved to disk."
]
},
{
"cell_type": "code",
"execution_count": 39,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"\"\"\"\n",
"DON'T MODIFY ANYTHING IN THIS CELL\n",
"\"\"\"\n",
"import helper\n",
"import numpy as np\n",
"import problem_unittests as tests\n",
"\n",
"int_text, vocab_to_int, int_to_vocab, token_dict = helper.load_preprocess()"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"### Extra hyper parameters"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"from collections import namedtuple\n",
"\n",
"hyper_params = (('embedding_size', 128),\n",
" ('lstm_layers', 2),\n",
" ('keep_prob', 0.7)\n",
" )\n",
"\n",
"\n",
"\n",
"\n",
"Hyper = namedtuple('Hyper', map(lambda x: x[0], hyper_params))\n",
"HYPER = Hyper(*list(map(lambda x: x[1], hyper_params)))\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"## Build the Neural Network\n",
"You'll build the components necessary to build a RNN by implementing the following functions below:\n",
"- get_inputs\n",
"- get_init_cell\n",
"- get_embed\n",
"- build_rnn\n",
"- build_nn\n",
"- get_batches\n",
"\n",
"### Check the Version of TensorFlow and Access to GPU"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"TensorFlow Version: 1.0.0\n",
"Default GPU Device: /gpu:0\n"
]
}
],
"source": [
"\"\"\"\n",
"DON'T MODIFY ANYTHING IN THIS CELL\n",
"\"\"\"\n",
"from distutils.version import LooseVersion\n",
"import warnings\n",
"import tensorflow as tf\n",
"\n",
"# Check TensorFlow Version\n",
"assert LooseVersion(tf.__version__) >= LooseVersion('1.0'), 'Please use TensorFlow version 1.0 or newer'\n",
"print('TensorFlow Version: {}'.format(tf.__version__))\n",
"\n",
"# Check for a GPU\n",
"if not tf.test.gpu_device_name():\n",
" warnings.warn('No GPU found. Please use a GPU to train your neural network.')\n",
"else:\n",
" print('Default GPU Device: {}'.format(tf.test.gpu_device_name()))"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"### Input\n",
"Implement the `get_inputs()` function to create TF Placeholders for the Neural Network. It should create the following placeholders:\n",
"- Input text placeholder named \"input\" using the [TF Placeholder](https://www.tensorflow.org/api_docs/python/tf/placeholder) `name` parameter.\n",
"- Targets placeholder\n",
"- Learning Rate placeholder\n",
"\n",
"Return the placeholders in the following the tuple `(Input, Targets, LearingRate)`"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Tests Passed\n"
]
}
],
"source": [
"def get_inputs():\n",
" \"\"\"\n",
" Create TF Placeholders for input, targets, and learning rate.\n",
" :return: Tuple (input, targets, learning rate)\n",
" \"\"\"\n",
" \n",
" # We use shape [None, None] to feed any batch size and any sequence length\n",
" input_placeholder = tf.placeholder(tf.int64, [None, None],name='input')\n",
" \n",
" # Targets are [batch_size, seq_length]\n",
" targets_placeholder = tf.placeholder(tf.int64, [None, None], name='targets') \n",
" \n",
" \n",
" learning_rate_placeholder = tf.placeholder(tf.float32, name='learning_rate')\n",
" return input_placeholder, targets_placeholder, learning_rate_placeholder\n",
"\n",
"\n",
"\"\"\"\n",
"DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE\n",
"\"\"\"\n",
"tests.test_get_inputs(get_inputs)"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"### Build RNN Cell and Initialize\n",
"Stack one or more [`BasicLSTMCells`](https://www.tensorflow.org/api_docs/python/tf/contrib/rnn/BasicLSTMCell) in a [`MultiRNNCell`](https://www.tensorflow.org/api_docs/python/tf/contrib/rnn/MultiRNNCell).\n",
"- The Rnn size should be set using `rnn_size`\n",
"- Initalize Cell State using the MultiRNNCell's [`zero_state()`](https://www.tensorflow.org/api_docs/python/tf/contrib/rnn/MultiRNNCell#zero_state) function\n",
" - Apply the name \"initial_state\" to the initial state using [`tf.identity()`](https://www.tensorflow.org/api_docs/python/tf/identity)\n",
"\n",
"Return the cell and initial state in the following tuple `(Cell, InitialState)`"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Tests Passed\n"
]
}
],
"source": [
"def get_init_cell(batch_size, rnn_size):\n",
" \"\"\"\n",
" Create an RNN Cell and initialize it.\n",
" :param batch_size: Size of batches\n",
" :param rnn_size: Size of RNNs\n",
" :return: Tuple (cell, initialize state)\n",
" \"\"\"\n",
" with tf.name_scope('RNN_layers'):\n",
" lstm = tf.contrib.rnn.BasicLSTMCell(rnn_size)\n",
"\n",
" # add a dropout wrapper\n",
" drop = tf.contrib.rnn.DropoutWrapper(lstm, output_keep_prob=HYPER.keep_prob)\n",
"\n",
" #cell = tf.contrib.rnn.MultiRNNCell([drop] * HYPER.lstm_layers)\n",
"\n",
" cell = tf.contrib.rnn.MultiRNNCell([lstm] * HYPER.lstm_layers)\n",
" \n",
" \n",
" _initial_state = cell.zero_state(batch_size, tf.float32)\n",
" initial_state = tf.identity(_initial_state, name='initial_state')\n",
" \n",
" return cell, initial_state\n",
"\n",
"\n",
"\"\"\"\n",
"DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE\n",
"\"\"\"\n",
"tests.test_get_init_cell(get_init_cell)"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"### Word Embedding\n",
"Apply embedding to `input_data` using TensorFlow. Return the embedded sequence."
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Tests Passed\n"
]
}
],
"source": [
"def get_embed(input_data, vocab_size, embed_dim):\n",
" \"\"\"\n",
" Create embedding for <input_data>.\n",
" :param input_data: TF placeholder for text input.\n",
" :param vocab_size: Number of words in vocabulary.\n",
" :param embed_dim: Number of embedding dimensions\n",
" :return: Embedded input.\n",
" \"\"\"\n",
" with tf.name_scope('Embedding'):\n",
" embeddings = tf.Variable(\n",
" tf.random_uniform([vocab_size, embed_dim], -1.0, 1.0)\n",
" )\n",
"\n",
" embed = tf.nn.embedding_lookup(embeddings, input_data)\n",
" \n",
" return embed\n",
"\n",
"\n",
"\"\"\"\n",
"DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE\n",
"\"\"\"\n",
"tests.test_get_embed(get_embed)"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"### Build RNN\n",
"You created a RNN Cell in the `get_init_cell()` function. Time to use the cell to create a RNN.\n",
"- Build the RNN using the [`tf.nn.dynamic_rnn()`](https://www.tensorflow.org/api_docs/python/tf/nn/dynamic_rnn)\n",
" - Apply the name \"final_state\" to the final state using [`tf.identity()`](https://www.tensorflow.org/api_docs/python/tf/identity)\n",
"\n",
"Return the outputs and final_state state in the following tuple `(Outputs, FinalState)` "
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Tests Passed\n"
]
}
],
"source": [
"def build_rnn(cell, inputs):\n",
" \"\"\"\n",
" Create a RNN using a RNN Cell\n",
" :param cell: RNN Cell\n",
" :param inputs: Input text data\n",
" :return: Tuple (Outputs, Final State)\n",
" \"\"\"\n",
" ## NOTES\n",
" # dynamic rnn automatically takes the seq size in dim=1 [batch_size, max_time, ...] time_major==false (default)\n",
" with tf.name_scope('RNN_output'):\n",
" outputs, final_state = tf.nn.dynamic_rnn(cell, inputs, dtype=tf.float32)\n",
" \n",
" final_state = tf.identity(final_state, name='final_state')\n",
" \n",
" \n",
" return outputs, final_state\n",
"\n",
"\n",
"\"\"\"\n",
"DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE\n",
"\"\"\"\n",
"tests.test_build_rnn(build_rnn)"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"### Build the Neural Network\n",
"Apply the functions you implemented above to:\n",
"- Apply embedding to `input_data` using your `get_embed(input_data, vocab_size, embed_dim)` function.\n",
"- Build RNN using `cell` and your `build_rnn(cell, inputs)` function.\n",
"- Apply a fully connected layer with a linear activation and `vocab_size` as the number of outputs.\n",
"\n",
"Return the logits and final state in the following tuple (Logits, FinalState) "
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"logits after reshape: Tensor(\"logits_reshape_to_loss/logits:0\", shape=(128, 5, 27), dtype=float32)\n",
"Tests Passed\n"
]
}
],
"source": [
"def build_nn(cell, rnn_size, input_data, vocab_size):\n",
" \"\"\"\n",
" Build part of the neural network\n",
" :param cell: RNN cell\n",
" :param rnn_size: Size of rnns\n",
" :param input_data: Input data\n",
" :param vocab_size: Vocabulary size\n",
" :return: Tuple (Logits, FinalState)\n",
" \"\"\"\n",
" \n",
" num_outputs = vocab_size\n",
" \n",
" \n",
" ## Not sure why the unit test was made without taking into \n",
" # account we are handling dynamic tensor shape that we need to infer\n",
" # at runtime, so I made an if statement just to pass the test case\n",
" #\n",
" # Some references: https://goo.gl/vD3egn\n",
" # https://goo.gl/E8vT2M \n",
" \n",
" if input_data.get_shape().as_list()[1] is not None:\n",
" batch_size = input_data.get_shape().as_list()[0]\n",
" seq_len = input_data.get_shape().as_list()[1]\n",
" \n",
" # Infer dynamic tensor shape of input\n",
" else:\n",
" input_dims = tf.shape(input_data)\n",
" batch_size = input_dims[0]\n",
" seq_len = input_dims[1]\n",
"\n",
" \n",
"\n",
" \n",
" embed = get_embed(input_data, vocab_size, HYPER.embedding_size)\n",
" \n",
" \n",
" ## NOTES\n",
" # dynamic rnn automatically takes the seq size in dim=1 [batch_size, max_time, ...] see: time_major==false (default)\n",
" \n",
" ## Output shape\n",
" ## [batch_size, time_step, rnn_size]\n",
" raw_rnn_outputs, final_state = build_rnn(cell, embed)\n",
" \n",
" \n",
" # Put outputs in rows\n",
" # make the output into [batch_size*time_step, rnn_size] for easy matmul\n",
" with tf.name_scope('sequence_reshape'):\n",
" outputs = tf.reshape(raw_rnn_outputs, [-1, rnn_size], name='rnn_output')\n",
" \n",
" \n",
" # Question, why are we using linear activation and not softmax ?\n",
" # My Guess: because seq2seq.sequence_loss has an efficient way to calculate the loss directly from logits \n",
" with tf.name_scope('logits'):\n",
" \n",
" linear_w = tf.Variable(tf.truncated_normal((rnn_size, num_outputs), stddev=0.05), name='linear_w')\n",
" linear_b = tf.Variable(tf.zeros(num_outputs), name='linear_b')\n",
"\n",
" logits = tf.matmul(outputs, linear_w) + linear_b\n",
" \n",
" \n",
" \n",
" # Reshape the logits back into the original input shape -> [batch_size, seq_len, num_classes]\n",
" # We do this beceause the loss function seq2seq.sequence_loss takes as logits a shape of [batch_size,seq_len,num_decoded_symbols]\n",
" with tf.name_scope('logits_reshape_to_loss'):\n",
" logits = tf.reshape(logits, [batch_size, seq_len, num_outputs], name='logits')\n",
" print('logits after reshape: ', logits)\n",
" \n",
" return logits, final_state\n",
"\n",
"\n",
"\"\"\"\n",
"DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE\n",
"\"\"\"\n",
"tests.test_build_nn(build_nn)"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"### Batches\n",
"Implement `get_batches` to create batches of input and targets using `int_text`. The batches should be a Numpy array with the shape `(number of batches, 2, batch size, sequence length)`. Each batch contains two elements:\n",
"- The first element is a single batch of **input** with the shape `[batch size, sequence length]`\n",
"- The second element is a single batch of **targets** with the shape `[batch size, sequence length]`\n",
"\n",
"If you can't fill the last batch with enough data, drop the last batch.\n",
"\n",
"For exmple, `get_batches([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], 2, 3)` would return a Numpy array of the following:\n",
"```\n",
"[\n",
" # First Batch\n",
" [\n",
" # Batch of Input\n",
" [[ 1 2 3], [ 7 8 9]],\n",
" # Batch of targets\n",
" [[ 2 3 4], [ 8 9 10]]\n",
" ],\n",
" \n",
" # Second Batch\n",
" [\n",
" # Batch of Input\n",
" [[ 4 5 6], [10 11 12]],\n",
" # Batch of targets\n",
" [[ 5 6 7], [11 12 13]]\n",
" ]\n",
"]\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"array([1, 4, 2, 3])"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"t = np.array([1,2,3,4])\n",
"np.random.shuffle(t)\n",
"t"
]
},
{
"cell_type": "code",
"execution_count": 73,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true,
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Tests Passed\n"
]
}
],
"source": [
"def get_batches(int_text, batch_size, seq_length):\n",
" \"\"\"\n",
" Return batches of input and target\n",
" :param int_text: Text with the words replaced by their ids\n",
" :param batch_size: The size of batch\n",
" :param seq_length: The length of sequence\n",
" :return: Batches as a Numpy array\n",
" \"\"\"\n",
" \n",
" slice_size = int(batch_size * seq_length)\n",
" n_batches = int(len(int_text)/slice_size)\n",
" \n",
" assert n_batches > 0, 'Maybe your batch size is too big ?'\n",
"\n",
" # input part\n",
" _inputs = np.array(int_text[:n_batches*slice_size])\n",
" \n",
" # target part\n",
" _targets = np.array(int_text[1:n_batches*slice_size + 1])\n",
" \n",
"\n",
" # Go through all inputs, targets and split them into batch_size*seq_len list of items\n",
" # [batch, batch, ...]\n",
" inputs, targets = np.split(_inputs, n_batches), np.split(_targets, n_batches)\n",
" \n",
" # concat inputs and targets\n",
" batches = np.c_[inputs, targets]\n",
" \n",
" \n",
" # reshape into [2 * inputs]\n",
" batches = batches.reshape((2, batch_size, -1))\n",
" #print(batches)\n",
" \n",
" \n",
" # Shuffle the batches of sequences without disturbing each sequence order\n",
" # We are using transpose to bring the batch into axes 0 and be able to shuffle it\n",
" np.random.shuffle(np.transpose(batches, (1,2,0)))\n",
" \n",
" \n",
" # Reshape into final batches output\n",
" batches = batches.reshape((-1, 2, batch_size, seq_length))\n",
"\n",
" \n",
" return batches\n",
"\n",
"\n",
"#print(get_batches(np.arange(1,100,1), 10, 5)[0])\n",
"\n",
"\"\"\"\n",
"DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE\n",
"\"\"\"\n",
"tests.test_get_batches(get_batches)"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"## Neural Network Training\n",
"### Hyperparameters\n",
"Tune the following parameters:\n",
"\n",
"- Set `num_epochs` to the number of epochs.\n",
"- Set `batch_size` to the batch size.\n",
"- Set `rnn_size` to the size of the RNNs.\n",
"- Set `seq_length` to the length of sequence.\n",
"- Set `learning_rate` to the learning rate.\n",
"- Set `show_every_n_batches` to the number of batches the neural network should print progress."
]
},
{
"cell_type": "code",
"execution_count": 71,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"# Number of Epochs\n",
"num_epochs = 1000\n",
"# Batch Size\n",
"batch_size = 128\n",
"# RNN Size\n",
"rnn_size = 100\n",
"# Sequence Length\n",
"# Use the mean of sentences length as sequence length\n",
"seq_length = int(s_lengths.mean())\n",
"# Learning Rate\n",
"learning_rate = 1e-2\n",
"# Show stats for every n number of batches\n",
"show_every_n_batches = 10\n",
"\n",
"\"\"\"\n",
"DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE\n",
"\"\"\"\n",
"save_dir = './save'"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"### Build the Graph\n",
"Build the graph using the neural network you implemented."
]
},
{
"cell_type": "code",
"execution_count": 53,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"logits after reshape: Tensor(\"logits_reshape_to_loss/logits:0\", shape=(?, ?, 6779), dtype=float32)\n"
]
}
],
"source": [
"\"\"\"\n",
"DON'T MODIFY ANYTHING IN THIS CELL\n",
"\"\"\"\n",
"from tensorflow.contrib import seq2seq\n",
"\n",
"train_graph = tf.Graph()\n",
"with train_graph.as_default():\n",
" vocab_size = len(int_to_vocab)\n",
" input_text, targets, lr = get_inputs()\n",
" input_data_shape = tf.shape(input_text)\n",
" cell, initial_state = get_init_cell(input_data_shape[0], rnn_size)\n",
" logits, final_state = build_nn(cell, rnn_size, input_text, vocab_size)\n",
"\n",
" # Probabilities for generating words\n",
" probs = tf.nn.softmax(logits, name='probs')\n",
"\n",
" # Loss function\n",
" cost = seq2seq.sequence_loss(\n",
" logits,\n",
" targets,\n",
" tf.ones([input_data_shape[0], input_data_shape[1]]))\n",
"\n",
" # Optimizer\n",
" optimizer = tf.train.AdamOptimizer(lr)\n",
"\n",
" # Gradient Clipping\n",
" gradients = optimizer.compute_gradients(cost)\n",
" capped_gradients = [(tf.clip_by_value(grad, -1., 1.), var) for grad, var in gradients]\n",
" train_op = optimizer.apply_gradients(capped_gradients)"
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"# write out the graph for tensorboard\n",
"\n",
"with tf.Session(graph=train_graph) as sess:\n",
" file_writer = tf.summary.FileWriter('./logs/1', sess.graph)"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"## Train\n",
"Train the neural network on the preprocessed data. If you have a hard time getting a good loss, check the [forms](https://discussions.udacity.com/) to see if anyone is having the same problem."
]
},
{
"cell_type": "code",
"execution_count": 74,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Epoch 0 Batch 0/49 train_loss = 8.823\n",
"Epoch 0 Batch 10/49 train_loss = 6.394\n",
"Epoch 0 Batch 20/49 train_loss = 6.288\n",
"Epoch 0 Batch 30/49 train_loss = 6.552\n",
"Epoch 0 Batch 40/49 train_loss = 6.792\n",
"Epoch 1 Batch 1/49 train_loss = 6.129\n",
"Epoch 1 Batch 11/49 train_loss = 6.013\n",
"Epoch 1 Batch 21/49 train_loss = 6.131\n",
"Epoch 1 Batch 31/49 train_loss = 6.094\n",
"Epoch 1 Batch 41/49 train_loss = 6.035\n",
"Epoch 2 Batch 2/49 train_loss = 5.961\n",
"Epoch 2 Batch 12/49 train_loss = 6.199\n",
"Epoch 2 Batch 22/49 train_loss = 6.037\n",
"Epoch 2 Batch 32/49 train_loss = 6.311\n",
"Epoch 2 Batch 42/49 train_loss = 6.187\n",
"Epoch 3 Batch 3/49 train_loss = 6.182\n",
"Epoch 3 Batch 13/49 train_loss = 6.023\n",
"Epoch 3 Batch 23/49 train_loss = 5.968\n",
"Epoch 3 Batch 33/49 train_loss = 5.981\n",
"Epoch 3 Batch 43/49 train_loss = 6.098\n",
"Epoch 4 Batch 4/49 train_loss = 6.104\n",
"Epoch 4 Batch 14/49 train_loss = 5.956\n",
"Epoch 4 Batch 24/49 train_loss = 6.170\n",
"Epoch 4 Batch 34/49 train_loss = 6.176\n",
"Epoch 4 Batch 44/49 train_loss = 6.136\n",
"Epoch 5 Batch 5/49 train_loss = 6.161\n",
"Epoch 5 Batch 15/49 train_loss = 6.067\n",
"Epoch 5 Batch 25/49 train_loss = 6.108\n",
"Epoch 5 Batch 35/49 train_loss = 6.007\n",
"Epoch 5 Batch 45/49 train_loss = 6.007\n",
"Epoch 6 Batch 6/49 train_loss = 5.833\n",
"Epoch 6 Batch 16/49 train_loss = 6.090\n",
"Epoch 6 Batch 26/49 train_loss = 6.225\n",
"Epoch 6 Batch 36/49 train_loss = 6.081\n",
"Epoch 6 Batch 46/49 train_loss = 6.062\n",
"Epoch 7 Batch 7/49 train_loss = 6.026\n",
"Epoch 7 Batch 17/49 train_loss = 5.683\n",
"Epoch 7 Batch 27/49 train_loss = 6.055\n",
"Epoch 7 Batch 37/49 train_loss = 5.834\n",
"Epoch 7 Batch 47/49 train_loss = 6.057\n",
"Epoch 8 Batch 8/49 train_loss = 5.782\n",
"Epoch 8 Batch 18/49 train_loss = 5.966\n",
"Epoch 8 Batch 28/49 train_loss = 6.036\n",
"Epoch 8 Batch 38/49 train_loss = 6.007\n",
"Epoch 8 Batch 48/49 train_loss = 6.105\n",
"Epoch 9 Batch 9/49 train_loss = 5.654\n",
"Epoch 9 Batch 19/49 train_loss = 5.723\n",
"Epoch 9 Batch 29/49 train_loss = 5.926\n",
"Epoch 9 Batch 39/49 train_loss = 5.998\n",
"Epoch 10 Batch 0/49 train_loss = 5.719\n",
"Epoch 10 Batch 10/49 train_loss = 5.906\n",
"Epoch 10 Batch 20/49 train_loss = 5.788\n",
"Epoch 10 Batch 30/49 train_loss = 5.764\n",
"Epoch 10 Batch 40/49 train_loss = 5.994\n",
"Epoch 11 Batch 1/49 train_loss = 5.807\n",
"Epoch 11 Batch 11/49 train_loss = 5.796\n",
"Epoch 11 Batch 21/49 train_loss = 5.863\n",
"Epoch 11 Batch 31/49 train_loss = 5.897\n",
"Epoch 11 Batch 41/49 train_loss = 5.779\n",
"Epoch 12 Batch 2/49 train_loss = 5.720\n",
"Epoch 12 Batch 12/49 train_loss = 5.869\n",
"Epoch 12 Batch 22/49 train_loss = 5.764\n",
"Epoch 12 Batch 32/49 train_loss = 5.961\n",
"Epoch 12 Batch 42/49 train_loss = 5.880\n",
"Epoch 13 Batch 3/49 train_loss = 5.819\n",
"Epoch 13 Batch 13/49 train_loss = 5.741\n",
"Epoch 13 Batch 23/49 train_loss = 5.707\n",
"Epoch 13 Batch 33/49 train_loss = 5.683\n",
"Epoch 13 Batch 43/49 train_loss = 5.723\n",
"Epoch 14 Batch 4/49 train_loss = 5.754\n",
"Epoch 14 Batch 14/49 train_loss = 5.721\n",
"Epoch 14 Batch 24/49 train_loss = 5.777\n",
"Epoch 14 Batch 34/49 train_loss = 5.893\n",
"Epoch 14 Batch 44/49 train_loss = 5.771\n",
"Epoch 15 Batch 5/49 train_loss = 5.785\n",
"Epoch 15 Batch 15/49 train_loss = 5.753\n",
"Epoch 15 Batch 25/49 train_loss = 5.703\n",
"Epoch 15 Batch 35/49 train_loss = 5.638\n",
"Epoch 15 Batch 45/49 train_loss = 5.638\n",
"Epoch 16 Batch 6/49 train_loss = 5.463\n",
"Epoch 16 Batch 16/49 train_loss = 5.703\n",
"Epoch 16 Batch 26/49 train_loss = 5.689\n",
"Epoch 16 Batch 36/49 train_loss = 5.740\n",
"Epoch 16 Batch 46/49 train_loss = 5.701\n",
"Epoch 17 Batch 7/49 train_loss = 5.635\n",
"Epoch 17 Batch 17/49 train_loss = 5.377\n",
"Epoch 17 Batch 27/49 train_loss = 5.638\n",
"Epoch 17 Batch 37/49 train_loss = 5.471\n",
"Epoch 17 Batch 47/49 train_loss = 5.639\n",
"Epoch 18 Batch 8/49 train_loss = 5.518\n",
"Epoch 18 Batch 18/49 train_loss = 5.474\n",
"Epoch 18 Batch 28/49 train_loss = 5.561\n",
"Epoch 18 Batch 38/49 train_loss = 5.609\n",
"Epoch 18 Batch 48/49 train_loss = 5.630\n"
]
},
{
"ename": "KeyboardInterrupt",
"evalue": "",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-74-396c263e7e73>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 16\u001b[0m \u001b[0minitial_state\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mstate\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 17\u001b[0m lr: learning_rate}\n\u001b[0;32m---> 18\u001b[0;31m \u001b[0mtrain_loss\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstate\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msess\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mcost\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfinal_state\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtrain_op\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfeed\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 19\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 20\u001b[0m \u001b[0;31m# Show every <show_every_n_batches> batches\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/home/carnd/anaconda3/envs/dl/lib/python3.5/site-packages/tensorflow/python/client/session.py\u001b[0m in \u001b[0;36mrun\u001b[0;34m(self, fetches, feed_dict, options, run_metadata)\u001b[0m\n\u001b[1;32m 765\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 766\u001b[0m result = self._run(None, fetches, feed_dict, options_ptr,\n\u001b[0;32m--> 767\u001b[0;31m run_metadata_ptr)\n\u001b[0m\u001b[1;32m 768\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mrun_metadata\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 769\u001b[0m \u001b[0mproto_data\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtf_session\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mTF_GetBuffer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrun_metadata_ptr\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/home/carnd/anaconda3/envs/dl/lib/python3.5/site-packages/tensorflow/python/client/session.py\u001b[0m in \u001b[0;36m_run\u001b[0;34m(self, handle, fetches, feed_dict, options, run_metadata)\u001b[0m\n\u001b[1;32m 963\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mfinal_fetches\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mfinal_targets\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 964\u001b[0m results = self._do_run(handle, final_targets, final_fetches,\n\u001b[0;32m--> 965\u001b[0;31m feed_dict_string, options, run_metadata)\n\u001b[0m\u001b[1;32m 966\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 967\u001b[0m \u001b[0mresults\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/home/carnd/anaconda3/envs/dl/lib/python3.5/site-packages/tensorflow/python/client/session.py\u001b[0m in \u001b[0;36m_do_run\u001b[0;34m(self, handle, target_list, fetch_list, feed_dict, options, run_metadata)\u001b[0m\n\u001b[1;32m 1013\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mhandle\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1014\u001b[0m return self._do_call(_run_fn, self._session, feed_dict, fetch_list,\n\u001b[0;32m-> 1015\u001b[0;31m target_list, options, run_metadata)\n\u001b[0m\u001b[1;32m 1016\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1017\u001b[0m return self._do_call(_prun_fn, self._session, handle, feed_dict,\n",
"\u001b[0;32m/home/carnd/anaconda3/envs/dl/lib/python3.5/site-packages/tensorflow/python/client/session.py\u001b[0m in \u001b[0;36m_do_call\u001b[0;34m(self, fn, *args)\u001b[0m\n\u001b[1;32m 1020\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_do_call\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfn\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1021\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1022\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mfn\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1023\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0merrors\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mOpError\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1024\u001b[0m \u001b[0mmessage\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcompat\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mas_text\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmessage\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/home/carnd/anaconda3/envs/dl/lib/python3.5/site-packages/tensorflow/python/client/session.py\u001b[0m in \u001b[0;36m_run_fn\u001b[0;34m(session, feed_dict, fetch_list, target_list, options, run_metadata)\u001b[0m\n\u001b[1;32m 1002\u001b[0m return tf_session.TF_Run(session, options,\n\u001b[1;32m 1003\u001b[0m \u001b[0mfeed_dict\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfetch_list\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtarget_list\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1004\u001b[0;31m status, run_metadata)\n\u001b[0m\u001b[1;32m 1005\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1006\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_prun_fn\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msession\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mhandle\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfeed_dict\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfetch_list\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mKeyboardInterrupt\u001b[0m: "
]
}
],
"source": [
"\"\"\"\n",
"DON'T MODIFY ANYTHING IN THIS CELL\n",
"\"\"\"\n",
"batches = get_batches(int_text, batch_size, seq_length)\n",
"\n",
"with tf.Session(graph=train_graph) as sess:\n",
" sess.run(tf.global_variables_initializer())\n",
"\n",
" for epoch_i in range(num_epochs):\n",
" state = sess.run(initial_state, {input_text: batches[0][0]})\n",
"\n",
" for batch_i, (x, y) in enumerate(batches):\n",
" feed = {\n",
" input_text: x,\n",
" targets: y,\n",
" initial_state: state,\n",
" lr: learning_rate}\n",
" train_loss, state, _ = sess.run([cost, final_state, train_op], feed)\n",
"\n",
" # Show every <show_every_n_batches> batches\n",
" if (epoch_i * len(batches) + batch_i) % show_every_n_batches == 0:\n",
" print('Epoch {:>3} Batch {:>4}/{} train_loss = {:.3f}'.format(\n",
" epoch_i,\n",
" batch_i,\n",
" len(batches),\n",
" train_loss))\n",
"\n",
" # Save Model\n",
" saver = tf.train.Saver()\n",
" saver.save(sess, save_dir)\n",
" print('Model Trained and Saved')"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"## Save Parameters\n",
"Save `seq_length` and `save_dir` for generating a new TV script."
]
},
{
"cell_type": "code",
"execution_count": 198,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"\"\"\"\n",
"DON'T MODIFY ANYTHING IN THIS CELL\n",
"\"\"\"\n",
"# Save parameters for checkpoint\n",
"helper.save_params((seq_length, save_dir))"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"# Checkpoint"
]
},
{
"cell_type": "code",
"execution_count": 272,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"\"\"\"\n",
"DON'T MODIFY ANYTHING IN THIS CELL\n",
"\"\"\"\n",
"import tensorflow as tf\n",
"import numpy as np\n",
"import helper\n",
"import problem_unittests as tests\n",
"\n",
"_, vocab_to_int, int_to_vocab, token_dict = helper.load_preprocess()\n",
"seq_length, load_dir = helper.load_params()"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"## Implement Generate Functions\n",
"### Get Tensors\n",
"Get tensors from `loaded_graph` using the function [`get_tensor_by_name()`](https://www.tensorflow.org/api_docs/python/tf/Graph#get_tensor_by_name). Get the tensors using the following names:\n",
"- \"input:0\"\n",
"- \"initial_state:0\"\n",
"- \"final_state:0\"\n",
"- \"probs:0\"\n",
"\n",
"Return the tensors in the following tuple `(InputTensor, InitialStateTensor, FinalStateTensor, ProbsTensor)` "
]
},
{
"cell_type": "code",
"execution_count": 273,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Tests Passed\n"
]
}
],
"source": [
"def get_tensors(loaded_graph):\n",
" \"\"\"\n",
" Get input, initial state, final state, and probabilities tensor from <loaded_graph>\n",
" :param loaded_graph: TensorFlow graph loaded from file\n",
" :return: Tuple (InputTensor, InitialStateTensor, FinalStateTensor, ProbsTensor)\n",
" \"\"\"\n",
" \n",
" t_input = loaded_graph.get_tensor_by_name('input:0')\n",
" t_initial_state = loaded_graph.get_tensor_by_name('initial_state:0')\n",
" t_final_state = loaded_graph.get_tensor_by_name('final_state:0')\n",
" t_probs = loaded_graph.get_tensor_by_name('probs:0')\n",
" return t_input, t_initial_state, t_final_state, t_probs\n",
"\n",
"\n",
"\"\"\"\n",
"DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE\n",
"\"\"\"\n",
"tests.test_get_tensors(get_tensors)"
]
},
{
"cell_type": "code",
"execution_count": 511,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true,
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(3,)\n"
]
},
{
"data": {
"text/plain": [
"3"
]
},
"execution_count": 511,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"t = np.array([1,2,3])\n",
"print(t.shape)\n",
"np.extract(t==3, t)[0]"
]
},
{
"cell_type": "code",
"execution_count": 458,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 458,
"metadata": {},
"output_type": "execute_result"
}
],
"source": []
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"### Choose Word\n",
"Implement the `pick_word()` function to select the next word using `probabilities`."
]
},
{
"cell_type": "code",
"execution_count": 472,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.8\n"
]
},
{
"ename": "IndexError",
"evalue": "only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mIndexError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-472-ec56654dfaa2>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 16\u001b[0m \u001b[0mDON\u001b[0m\u001b[0;31m'\u001b[0m\u001b[0mT\u001b[0m \u001b[0mMODIFY\u001b[0m \u001b[0mANYTHING\u001b[0m \u001b[0mIN\u001b[0m \u001b[0mTHIS\u001b[0m \u001b[0mCELL\u001b[0m \u001b[0mTHAT\u001b[0m \u001b[0mIS\u001b[0m \u001b[0mBELOW\u001b[0m \u001b[0mTHIS\u001b[0m \u001b[0mLINE\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 17\u001b[0m \"\"\"\n\u001b[0;32m---> 18\u001b[0;31m \u001b[0mtests\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtest_pick_word\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mpick_word\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m/home/spike/ml/udacity/nd101/deep-learning-modified/tv-script-generation/problem_unittests.py\u001b[0m in \u001b[0;36mtest_pick_word\u001b[0;34m(pick_word)\u001b[0m\n\u001b[1;32m 283\u001b[0m \u001b[0mtest_int_to_vocab\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m{\u001b[0m\u001b[0mword_i\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mword\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mword_i\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mword\u001b[0m \u001b[0;32min\u001b[0m \u001b[0menumerate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'this'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'is'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'a'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'test'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 284\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 285\u001b[0;31m \u001b[0mpred_word\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mpick_word\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtest_probabilities\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtest_int_to_vocab\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 286\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 287\u001b[0m \u001b[0;31m# Check type\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m<ipython-input-472-ec56654dfaa2>\u001b[0m in \u001b[0;36mpick_word\u001b[0;34m(probabilities, int_to_vocab)\u001b[0m\n\u001b[1;32m 10\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrandom\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mchoice\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mprobabilities\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mp\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mprobabilities\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 11\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 12\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mint_to_vocab\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mprobabilities\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrandom\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mchoice\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mprobabilities\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mp\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mprobabilities\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 13\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 14\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mIndexError\u001b[0m: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices"
]
}
],
"source": [
"def pick_word(probabilities, int_to_vocab):\n",
" \"\"\"\n",
" Pick the next word in the generated text\n",
" :param probabilities: Probabilites of the next word\n",
" :param int_to_vocab: Dictionary of word ids as the keys and words as the values\n",
" :return: String of the predicted word\n",
" \"\"\"\n",
" \n",
" word_p = np.random.choice(probabilities,p=probabilities)\n",
" word = np.extract(probabilities==word_p, probabilities)\n",
" \n",
" return int_to_vocab[probabilities[np.random.choice(probabilities,p=probabilities)]]\n",
"\n",
"\n",
"\"\"\"\n",
"DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE\n",
"\"\"\"\n",
"tests.test_pick_word(pick_word)"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"## Generate TV Script\n",
"This will generate the TV script for you. Set `gen_length` to the length of TV script you want to generate."
]
},
{
"cell_type": "code",
"execution_count": 275,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"moe_szyslak: sizes good-looking slap detective_homer_simpson: takin' cesss planning parrot smoke parrot sizes frustrated choked slap gesture elmo's jerry duff's butterball officials sizes themselves gesture whiny irrelevant paintings continuing huddle tony butterball worst jerry neighborhood slap slap slap detective_homer_simpson: meatpies crooks sail slap slap slap sizes worst mr slap worst gesture parrot calendars bathed schnapps butterball stuck jerry dash my-y-y-y-y-y slap slap slap detective_homer_simpson: rain gesture bashir's jerry longest slap slap slap detective_homer_simpson: realize gesture parrot neighborhood jerry dad's poet presided scrutinizes presided rope neighborhood booth detective_homer_simpson: enjoyed gesture electronic sam: jerry dash my-y-y-y-y-y butterball protestantism dash my-y-y-y-y-y friendly dash happiness agreement slap protestantism muttering muttering sugar-free parrot is: abandon fudd scrutinizes detective_homer_simpson: itself duff's butterball drinker slap muttering shaky slap cuff giant face knockin' tv-station_announcer: that's slap detective_homer_simpson: celebrate rubbed 2nd_voice_on_transmitter: further rubbed usual laramie bunch slap detective_homer_simpson: itself gesture child jerry premise poet sarcastic slap detective_homer_simpson: meatpies skydiving scrutinizes scream renee: scrutinizes detective_homer_simpson: itself lenses butterball tapered smokin' 2nd_voice_on_transmitter: slap detective_homer_simpson: detective_homer_simpson: detective_homer_simpson: aims always butterball oh-so-sophisticated wine dislike sizes bury gang butterball renee: rope laramie themselves beings slap detective_homer_simpson: rain indicates butterball stunned slap detective_homer_simpson: rain arts butterball ratted 2nd_voice_on_transmitter: pepsi oh-so-sophisticated planning booth rope presided rope abandon worst\n"
]
}
],
"source": [
"gen_length = 200\n",
"# homer_simpson, moe_szyslak, or Barney_Gumble\n",
"prime_word = 'moe_szyslak'\n",
"\n",
"\"\"\"\n",
"DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE\n",
"\"\"\"\n",
"loaded_graph = tf.Graph()\n",
"with tf.Session(graph=loaded_graph) as sess:\n",
" # Load saved model\n",
" loader = tf.train.import_meta_graph(load_dir + '.meta')\n",
" loader.restore(sess, load_dir)\n",
"\n",
" # Get Tensors from loaded model\n",
" input_text, initial_state, final_state, probs = get_tensors(loaded_graph)\n",
"\n",
" # Sentences generation setup\n",
" gen_sentences = [prime_word + ':']\n",
" prev_state = sess.run(initial_state, {input_text: np.array([[1]])})\n",
"\n",
" # Generate sentences\n",
" for n in range(gen_length):\n",
" # Dynamic Input\n",
" dyn_input = [[vocab_to_int[word] for word in gen_sentences[-seq_length:]]]\n",
" dyn_seq_length = len(dyn_input[0])\n",
"\n",
" # Get Prediction\n",
" probabilities, prev_state = sess.run(\n",
" [probs, final_state],\n",
" {input_text: dyn_input, initial_state: prev_state})\n",
" \n",
" pred_word = pick_word(probabilities[dyn_seq_length-1], int_to_vocab)\n",
"\n",
" gen_sentences.append(pred_word)\n",
" \n",
" # Remove tokens\n",
" tv_script = ' '.join(gen_sentences)\n",
" for key, token in token_dict.items():\n",
" ending = ' ' if key in ['\\n', '(', '\"'] else ''\n",
" tv_script = tv_script.replace(' ' + token.lower(), key)\n",
" tv_script = tv_script.replace('\\n ', '\\n')\n",
" tv_script = tv_script.replace('( ', '(')\n",
" \n",
" print(tv_script)"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"# The TV Script is Nonsensical\n",
"It's ok if the TV script doesn't make any sense. We trained on less than a megabyte of text. In order to get good results, you'll have to use a smaller vocabulary or get more data. Luckly there's more data! As we mentioned in the begging of this project, this is a subset of [another dataset](https://www.kaggle.com/wcukierski/the-simpsons-by-the-data). We didn't have you train on all the data, because that would take too long. However, you are free to train your neural network on all the data. After you complete the project, of course.\n",
"# Submitting This Project\n",
"When submitting this project, make sure to run all the cells before saving the notebook. Save the notebook file as \"dlnd_tv_script_generation.ipynb\" and save it as a HTML file under \"File\" -> \"Download as\". Include the \"helper.py\" and \"problem_unittests.py\" files in your submission."
]
}
],
"metadata": {
"hide_input": false,
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
},
"toc": {
"colors": {
"hover_highlight": "#DAA520",
"running_highlight": "#FF0000",
"selected_highlight": "#FFD700"
},
"moveMenuLeft": true,
"nav_menu": {
"height": "511px",
"width": "251px"
},
"navigate_menu": true,
"number_sections": true,
"sideBar": true,
"threshold": 4,
"toc_cell": false,
"toc_section_display": "block",
"toc_window_display": false
},
"widgets": {
"state": {},
"version": "1.1.2"
}
},
"nbformat": 4,
"nbformat_minor": 0
}