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.
tv-script-generation/dlnd_tv_script_generation.i...

1999 lines
139 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": 2,
"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": 3,
"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": 4,
"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": 5,
"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=\"a1d47867-3c6a-4b12-b791-9b6e6f68b735\">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(\"a1d47867-3c6a-4b12-b791-9b6e6f68b735\").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(\"a1d47867-3c6a-4b12-b791-9b6e6f68b735\");\n",
" if (element == null) {\n",
" console.log(\"Bokeh: ERROR: autoload.js configured with elementid 'a1d47867-3c6a-4b12-b791-9b6e6f68b735' 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(\"a1d47867-3c6a-4b12-b791-9b6e6f68b735\").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(\"a1d47867-3c6a-4b12-b791-9b6e6f68b735\")).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=\"e6d57401-77d4-4f94-812f-47bd9fad17a0\"></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(\"e6d57401-77d4-4f94-812f-47bd9fad17a0\").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(\"e6d57401-77d4-4f94-812f-47bd9fad17a0\");\n",
" if (element == null) {\n",
" console.log(\"Bokeh: ERROR: autoload.js configured with elementid 'e6d57401-77d4-4f94-812f-47bd9fad17a0' 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 = {\"9f84cecc-8ae3-424e-8008-c4f2108b2e40\":{\"roots\":{\"references\":[{\"attributes\":{\"data_source\":{\"id\":\"fdaeaceb-0288-46c0-a3ed-cc8e5329d5fc\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"c60cc52f-8af6-4a0e-8f95-98660c27806b\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"46c7b025-d143-4c0a-aad3-ec3ba8ecd967\",\"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\":\"a6e61952-558e-4f91-8773-7122b3d8490f\",\"type\":\"Rect\"},{\"attributes\":{\"data_source\":{\"id\":\"62753b64-cb80-435c-9f49-f02f92ea10ab\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"7bd3db7f-ca82-4af9-8ae4-932205f39a77\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"68605d7e-c637-42e9-a2b2-e979863f1dca\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"61883ba6-7728-4d19-8e42-f2b9ccf02545\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"5d178311-517a-4c92-93a4-0b4a1918cbaa\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"97178744-60f4-497f-a8db-df41897cb3ec\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"f4f4a97e-ae8d-41ae-ba25-7805ae6e7955\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"76f24404-d5c1-4726-a6f6-c842fe71d574\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"134495f4-8520-45ad-ba70-e6b149b727a4\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"7afb01b6-44e2-4243-8821-5e5ba1f2dc7f\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"ed6b2dc8-cf08-4d3c-af21-779b91ba087e\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"d8de2099-da01-457b-b66d-f201e63a3cc2\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data_source\":{\"id\":\"bf00b15f-04e2-4cb7-935c-ccbd195caea1\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"9a70bd68-22a8-4e19-bd94-d632c7837a47\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"6476ec4f-262b-4548-8d5e-9e3aa89a5e30\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"360493dd-4ef0-40df-9ad1-3416985980a1\",\"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\":\"27ed2932-debe-461a-afa2-7f8125bd038f\",\"type\":\"Rect\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"3b91e3d9-7e03-4cac-9d11-7a3754381c8f\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"axis_label\":\"Count( X )\",\"formatter\":{\"id\":\"b30cd8c9-c534-4c22-84bc-b3902cade211\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"72dc7dee-c815-47a1-ac56-5227256aa304\",\"subtype\":\"Chart\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"8ab847ed-fb0b-4e7c-b2ec-d7d2b0e1cc9b\",\"type\":\"BasicTicker\"}},\"id\":\"56e1bb16-fc6f-40e0-becd-71a8872d9e65\",\"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\":\"7009ab47-3809-427f-8ea3-3b9205dfeb63\",\"type\":\"Rect\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"3da62201-1a25-469f-abfe-12d2446026d7\",\"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\":\"80e8bf4a-1074-42c1-9455-b62754415aa1\",\"type\":\"Rect\"},{\"attributes\":{\"data_source\":{\"id\":\"0b9b6621-2b33-4b0b-8476-7e8e9de82fb1\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"97aad34a-ae13-4cc5-b6f9-0006366c521f\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"53da2b5c-fb54-461d-97c1-3bed79e30940\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"1e76ea4b-1912-4cb7-8857-44bac35c544a\",\"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\":\"5b004cc5-cc8a-4120-a5a0-9b4ddb009e38\",\"type\":\"Rect\"},{\"attributes\":{\"data_source\":{\"id\":\"0dd7c353-f1c7-4d13-9cf0-adf6fdfb19b0\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"5d1f6649-e399-432f-a4dc-19ead6a44d39\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"6ea78de2-d897-497a-b67b-6e307240eead\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"6b6dcc39-8c3d-4349-80a0-6b3502c40c42\",\"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\":\"a483e3ba-1ddf-4ffd-aea6-e94e618ad690\",\"type\":\"Rect\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"1a63a0b8-1a2e-48fc-a1dd-94875c2a3637\",\"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\":\"01574f78-a558-46a6-82f7-8e9d226ed450\",\"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\":\"9b87fa67-fc83-4fd2-a6f6-bdf7da4b81d2\",\"type\":\"Rect\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"0d505469-40f0-49d1-8373-94ae32e8eeca\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"plot\":{\"id\":\"72dc7dee-c815-47a1-ac56-5227256aa304\",\"subtype\":\"Chart\",\"type\":\"Plot\"}},\"id\":\"1a4a633c-13b4-43d5-9193-1c69dc90dadd\",\"type\":\"HelpTool\"},{\"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\":\"7bd3db7f-ca82-4af9-8ae4-932205f39a77\",\"type\":\"Rect\"},{\"attributes\":{\"data_source\":{\"id\":\"afc886b4-f0e3-4052-851d-4c683d18c35a\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"cd043fcf-1752-405b-9bba-8f4fe1c47f39\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"f9b8acab-91ed-4366-9ec8-0e62d29075c3\",\"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\":\"97178744-60f4-497f-a8db-df41897cb3ec\",\"type\":\"Rect\"},{\"attributes\":{\"data_source\":{\"id\":\"6b6dcc39-8c3d-4349-80a0-6b3502c40c42\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"a8dc7d55-1c41-4169-b424-3557015ed694\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"2c460e7e-e565-4b47-9fee-0c8fed2f7437\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data_source\":{\"id\":\"1e76ea4b-1912-4cb7-8857-44bac35c544a\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"12eb67ab-f001-49dc-93c1-feff55e119fb\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"f95c8652-c78e-4e4e-a434-c567cd40d252\",\"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\":\"ed6b2dc8-cf08-4d3c-af21-779b91ba087e\",\"type\":\"Rect\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"7afb01b6-44e2-4243-8821-5e5ba1f2dc7f\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"axis_label\":\"sentence lengths\",\"formatter\":{\"id\":\"48e64649-d6ca-4e01-ac5f-61494978243f\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"72dc7dee-c815-47a1-ac56-5227256aa304\",\"subtype\":\"Chart\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"02febd63-0900-4e3f-81ec-0f39fb4e70d3\",\"type\":\"BasicTicker\"}},\"id\":\"645f58dc-809a-434f-8319-57f973253043\",\"type\":\"LinearAxis\"},{\"attributes\":{\"data_source\":{\"id\":\"fa2e3a6b-7adc-467a-a29a-b1c6f55571cd\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"f7ff7bc5-ecfa-4e47-97d0-4d20d6792029\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"3eb1eca7-d9c0-44d0-8ae8-2455c16e6a63\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data_source\":{\"id\":\"48e9f968-f5db-4be6-9371-1fead15dd0db\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"4c27ad6e-c021-491f-8996-198638988727\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"56b77ec0-f61b-441a-bc74-0b8ef3e46ec2\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data_source\":{\"id\":\"396df32f-887e-45f3-8b7e-1803681bb859\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"3a3ec46d-8572-4755-9a93-118ec5a68d2d\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"6b8e0a7a-ebf2-43e9-abcb-3b78be3be4dd\",\"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\":\"5d1f6649-e399-432f-a4dc-19ead6a44d39\",\"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\":\"a6263af5-bd87-48f9-b40d-6ed233253dd7\",\"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\":\"226c2e8f-ddc6-4439-8fcb-9bd853839770\",\"type\":\"Rect\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"9b131333-6c77-469b-bcb3-7ea6220fa5ce\",\"type\":\"PanTool\"},{\"id\":\"ade63397-0fb9-495b-a0be-a786be5e55e0\",\"type\":\"WheelZoomTool\"},{\"id\":\"463f5d2c-e878-43b7-8911-696d029c1fa8\",\"type\":\"BoxZoomTool\"},{\"id\":\"f1415b0b-3dd8-4c31-b8cf-4e64ca488032\",\"type\":\"SaveTool\"},{\"id\":\"5aff4e8a-cd49-4722-a267-f2b5adc63daa\",\"type\":\"ResetTool\"},{\"id\":\"1a4a633c-13b4-43d5-9193-1c69dc90dadd\",\"type\":\"HelpTool\"}]},\"id\":\"bc4e492b-cbaf-4be8-97d7-af349a8499db\",\"type\":\"Toolbar\"},{\"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\":\"1995c744-dc35-440a-b263-ffc009ce6df5\",\"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\":\"39a266f9-7a69-4db4-ad91-d4a3c9916384\",\"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\":\"aab1ed0a-9e93-4e71-bfb6-7c0bd82262dc\",\"type\":\"Rect\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"22743ccd-0df0-41a0-af88-ca8c09ec2d0b\",\"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\":\"7cb0ef38-e46a-4b4f-bff0-cad647e703a8\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"data_source\":{\"id\":\"0d505469-40f0-49d1-8373-94ae32e8eeca\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"5b004cc5-cc8a-4120-a5a0-9b4ddb009e38\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"fc56e978-efab-4f52-b4c2-6f33fce0e8bc\",\"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\":\"cd043fcf-1752-405b-9bba-8f4fe1c47f39\",\"type\":\"Rect\"},{\"attributes\":{\"plot\":{\"id\":\"72dc7dee-c815-47a1-ac56-5227256aa304\",\"subtype\":\"Chart\",\"type\":\"Plot\"}},\"id\":\"5aff4e8a-cd49-4722-a267-f2b5adc63daa\",\"type\":\"ResetTool\"},{\"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\":\"a8dc7d55-1c41-4169-b424-3557015ed694\",\"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\":\"12eb67ab-f001-49dc-93c1-feff55e119fb\",\"type\":\"Rect\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"4ee997b2-0979-4b94-93de-1aff90107e6d\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"0cbc881a-fa00-4c52-a4c7-e7c83ab64600\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"226c2e8f-ddc6-4439-8fcb-9bd853839770\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"409ae39d-f1de-4af1-a535-c2fcfa795bff\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"396df32f-887e-45f3-8b7e-1803681bb859\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"f8ad9903-95f4-4872-8a36-1321b8b42884\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"5467f4a1-8c70-4a0c-bcc5-b3739761393c\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"a483e3ba-1ddf-4ffd-aea6-e94e618ad690\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"e91327c9-4e5a-4646-9121-2a5883edb6da\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"f349e8be-8227-4f3b-a971-13f4f8e66155\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"76f24404-d5c1-4726-a6f6-c842fe71d574\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"a6e61952-558e-4f91-8773-7122b3d8490f\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"f01a80c5-df04-4733-b426-c6b9286b8a0d\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"end\":133.3,\"start\":-1.3000000000000007},\"id\":\"179fe29c-366f-472a-ac87-848d437a90a9\",\"type\":\"Range1d\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"947f904c-a07c-48fd-b44c-6a8669b417a9\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"25c4ee68-3501-4b78-b931-3727437dad3b\",\"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\":\"e14aa943-93e4-4a86-98a1-dcc6ba7c5a0c\",\"type\":\"Rect\"},{\"attributes\":{\"data_source\":{\"id\":\"3b91e3d9-7e03-4cac-9d11-7a3754381c8f\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"726b831a-eee4-49c8-8314-7c6b761cd32b\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"495ef3e7-bca9-4578-9a49-17abd4545ea7\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data_source\":{\"id\":\"f05886d0-622f-4048-8f2b-cacbd435c4ba\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"9b87fa67-fc83-4fd2-a6f6-bdf7da4b81d2\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"29bf62cc-38a2-48d9-91e0-c70787b995fd\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"plot\":null,\"text\":null},\"id\":\"c080e8ad-c195-46c4-87b8-253d35765c3c\",\"type\":\"Title\"},{\"attributes\":{\"overlay\":{\"id\":\"7cb0ef38-e46a-4b4f-bff0-cad647e703a8\",\"type\":\"BoxAnnotation\"},\"plot\":{\"id\":\"72dc7dee-c815-47a1-ac56-5227256aa304\",\"subtype\":\"Chart\",\"type\":\"Plot\"}},\"id\":\"463f5d2c-e878-43b7-8911-696d029c1fa8\",\"type\":\"BoxZoomTool\"},{\"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\":\"b4ec435f-4e92-4d05-b60c-f12fd127c0f0\",\"type\":\"Rect\"},{\"attributes\":{\"data_source\":{\"id\":\"9bfd7f53-6fd8-420d-9309-77fdf41a1bd6\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"df2d3324-3072-4c5b-bea9-32c80a9700f2\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"379b0425-2c26-4a96-8857-6dcc84c96e09\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data_source\":{\"id\":\"6a14d8ed-9d5d-4b33-a0b7-193ad3d249e9\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"aab1ed0a-9e93-4e71-bfb6-7c0bd82262dc\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"a07c4be3-79f1-4701-971c-65dd57d77ce9\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"plot\":{\"id\":\"72dc7dee-c815-47a1-ac56-5227256aa304\",\"subtype\":\"Chart\",\"type\":\"Plot\"}},\"id\":\"f1415b0b-3dd8-4c31-b8cf-4e64ca488032\",\"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\":\"ecdf0f6e-55ed-453d-bef2-9f88975e7639\",\"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\":\"94659fff-6bbe-485d-8f08-8ed06837037a\",\"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\":\"81e440ec-b982-4b39-a907-364801183e9f\",\"type\":\"Rect\"},{\"attributes\":{\"data_source\":{\"id\":\"f8ad9903-95f4-4872-8a36-1321b8b42884\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"1995c744-dc35-440a-b263-ffc009ce6df5\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"cfd52cae-48cf-4e13-8dc1-b2ecdb3a8fd9\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"9a112a7f-acba-4c2a-a1ff-12a26eae84ea\",\"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\":\"173d5e41-b2c7-4391-876b-2fff132c03d9\",\"type\":\"Rect\"},{\"attributes\":{\"data_source\":{\"id\":\"39816792-a218-4246-b7ba-777b823f58ab\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"5b90c715-16a9-4460-a1dc-f38d9cf8da87\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"55c79cf7-bc0b-4275-9932-5d3678c8cdba\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"location\":\"top_left\",\"plot\":{\"id\":\"72dc7dee-c815-47a1-ac56-5227256aa304\",\"subtype\":\"Chart\",\"type\":\"Plot\"}},\"id\":\"84777c30-1f34-4cd0-a63c-4b84df131f9b\",\"type\":\"Legend\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"fa2e3a6b-7adc-467a-a29a-b1c6f55571cd\",\"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\":\"5eeaa9b4-d6b1-4aac-a1c9-530af2962192\",\"type\":\"Rect\"},{\"attributes\":{\"data_source\":{\"id\":\"f349e8be-8227-4f3b-a971-13f4f8e66155\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"80e8bf4a-1074-42c1-9455-b62754415aa1\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"caf3047e-4d1d-4ebc-aa01-28b7b4fd39c3\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"fdaeaceb-0288-46c0-a3ed-cc8e5329d5fc\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"1a63a0b8-1a2e-48fc-a1dd-94875c2a3637\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"ecdf0f6e-55ed-453d-bef2-9f88975e7639\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"cc999369-ed24-4ff6-af75-66d497d2f95e\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"end\":1483.9},\"id\":\"7e63d989-6be5-4a4b-8813-93a781a80d06\",\"type\":\"Range1d\"},{\"attributes\":{\"data_source\":{\"id\":\"25c4ee68-3501-4b78-b931-3727437dad3b\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"39a266f9-7a69-4db4-ad91-d4a3c9916384\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"46888a5d-370d-434d-9b3d-accef03604c0\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"9bfd7f53-6fd8-420d-9309-77fdf41a1bd6\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"02febd63-0900-4e3f-81ec-0f39fb4e70d3\",\"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\":\"4c27ad6e-c021-491f-8996-198638988727\",\"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\":\"c184c73e-d436-4597-be99-e48ee1159577\",\"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\":\"3a3ec46d-8572-4755-9a93-118ec5a68d2d\",\"type\":\"Rect\"},{\"attributes\":{\"plot\":{\"id\":\"72dc7dee-c815-47a1-ac56-5227256aa304\",\"subtype\":\"Chart\",\"type\":\"Plot\"}},\"id\":\"9b131333-6c77-469b-bcb3-7ea6220fa5ce\",\"type\":\"PanTool\"},{\"attributes\":{\"data_source\":{\"id\":\"725fd89c-ef0c-46f7-92af-243cd15b8ae4\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"bf0b0f05-6dc3-4f4e-ba9a-0418dbb06cd2\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"6097d581-3e7f-4437-8992-b9c8bfc04c75\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"39816792-a218-4246-b7ba-777b823f58ab\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"70ea4bf2-a39b-4650-ad44-1379b689eb93\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"6d6b4c4d-bb6d-455e-9e51-a01bd9e6f1f4\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"01574f78-a558-46a6-82f7-8e9d226ed450\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"84a670fc-02bf-4293-966c-91b2d66378d3\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data_source\":{\"id\":\"48f10d83-5529-485d-8b5c-7c6d749ba248\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"41bc4f06-4b83-4e97-a2af-ca976dc58b58\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"1401e513-edcd-4d62-949a-4a3b09cb7ffe\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"0cbc881a-fa00-4c52-a4c7-e7c83ab64600\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"48e64649-d6ca-4e01-ac5f-61494978243f\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"data_source\":{\"id\":\"cc0e9648-3751-474e-845d-fc442bc9d990\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"b4ec435f-4e92-4d05-b60c-f12fd127c0f0\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"019148e6-5f18-4a8a-bada-38887339060b\",\"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\":\"97aad34a-ae13-4cc5-b6f9-0006366c521f\",\"type\":\"Rect\"},{\"attributes\":{\"data_source\":{\"id\":\"360493dd-4ef0-40df-9ad1-3416985980a1\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"285eb0c1-76ee-4680-934f-d7047d858623\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"9430d154-78a9-4120-9f5f-25036d8a72cd\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"624a4deb-817f-4609-a054-4a04898eafa8\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"895b89c6-cec6-4472-a96a-71e8ac30c09a\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"dde29ff3-344f-4df3-add5-7f0d2b22b23e\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"e14aa943-93e4-4a86-98a1-dcc6ba7c5a0c\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"ffdc61ca-bb7a-49d7-bbdf-2f6a7c40f8f9\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"48f10d83-5529-485d-8b5c-7c6d749ba248\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"a118cc81-fab5-4348-b9dd-e2feb79916ff\",\"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\":\"5b90c715-16a9-4460-a1dc-f38d9cf8da87\",\"type\":\"Rect\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"dde29ff3-344f-4df3-add5-7f0d2b22b23e\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"aaa5037f-7dc2-43bb-86f7-7a991893fc45\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"81e440ec-b982-4b39-a907-364801183e9f\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"5a5c4594-63bd-4962-a2b0-0bf805de916e\",\"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\":\"c60cc52f-8af6-4a0e-8f95-98660c27806b\",\"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\":\"83db8ed5-412a-459a-a5ff-75045ed5d2f1\",\"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\":\"bdef5256-45f1-403b-a80b-460404bee8e5\",\"type\":\"Rect\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"f05886d0-622f-4048-8f2b-cacbd435c4ba\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"d3e84467-1121-4794-895e-3f91ed226214\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"a6263af5-bd87-48f9-b40d-6ed233253dd7\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"3f3bf28f-241d-4cff-afc8-3f96ad23314c\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data_source\":{\"id\":\"bc4edc77-fc52-409b-ab06-786c4d971342\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"5eeaa9b4-d6b1-4aac-a1c9-530af2962192\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"0c40240a-1fdb-41a3-8b39-e759cc2de480\",\"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\":\"f7ff7bc5-ecfa-4e47-97d0-4d20d6792029\",\"type\":\"Rect\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"0b9b6621-2b33-4b0b-8476-7e8e9de82fb1\",\"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\":\"7bcc347e-0945-4046-9909-ceff7d32da6c\",\"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\":\"337eaddb-5266-4697-a059-62f306e291d9\",\"type\":\"Rect\"},{\"attributes\":{\"data_source\":{\"id\":\"947f904c-a07c-48fd-b44c-6a8669b417a9\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"94659fff-6bbe-485d-8f08-8ed06837037a\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"d5acb926-a47f-4645-9f08-40424f4ae350\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"6a14d8ed-9d5d-4b33-a0b7-193ad3d249e9\",\"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\":\"bf209114-65f9-4c78-b60e-7a8c24acfa8d\",\"type\":\"Rect\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"62753b64-cb80-435c-9f49-f02f92ea10ab\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"6d6b4c4d-bb6d-455e-9e51-a01bd9e6f1f4\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"8441f470-1813-4b1b-a75d-10882d74f3c4\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"bf00b15f-04e2-4cb7-935c-ccbd195caea1\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"5467f4a1-8c70-4a0c-bcc5-b3739761393c\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"0dd7c353-f1c7-4d13-9cf0-adf6fdfb19b0\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"bc4edc77-fc52-409b-ab06-786c4d971342\",\"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\":\"9a70bd68-22a8-4e19-bd94-d632c7837a47\",\"type\":\"Rect\"},{\"attributes\":{\"data_source\":{\"id\":\"4ee997b2-0979-4b94-93de-1aff90107e6d\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"27ed2932-debe-461a-afa2-7f8125bd038f\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"9ea709da-c7cd-4881-8aca-cd47b1aee042\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data_source\":{\"id\":\"8441f470-1813-4b1b-a75d-10882d74f3c4\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"78616d71-a9a4-4706-82b3-eca21d69f38a\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"dd5d006a-ca41-49c6-902a-77b060a8d933\",\"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\":\"41bc4f06-4b83-4e97-a2af-ca976dc58b58\",\"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\":\"181d12a5-edea-42e1-933b-8082684768ca\",\"type\":\"Rect\"},{\"attributes\":{\"data_source\":{\"id\":\"5ea291eb-2b63-49d7-9caa-5449ca9fb2fa\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"773d7690-faee-4e37-96c5-4c54e18b9cff\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"be491811-b2e5-4058-a0ed-163dde279ccf\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data_source\":{\"id\":\"b7b06d74-05c1-4358-8b82-a5a017b82eca\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"c184c73e-d436-4597-be99-e48ee1159577\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"763c8cf1-ac5e-4117-b9dc-d21ec8fb659c\",\"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\":\"285eb0c1-76ee-4680-934f-d7047d858623\",\"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\":\"d52ff6f4-5267-45d9-be55-ad6a692abb37\",\"type\":\"Rect\"},{\"attributes\":{\"data_source\":{\"id\":\"a118cc81-fab5-4348-b9dd-e2feb79916ff\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"83db8ed5-412a-459a-a5ff-75045ed5d2f1\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"78cd7987-7026-4cef-b8ac-0b395143b374\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data_source\":{\"id\":\"61883ba6-7728-4d19-8e42-f2b9ccf02545\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"7bcc347e-0945-4046-9909-ceff7d32da6c\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"c2f3032a-bdaf-4e87-9756-44ca7d72a246\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"8ab847ed-fb0b-4e7c-b2ec-d7d2b0e1cc9b\",\"type\":\"BasicTicker\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"5d178311-517a-4c92-93a4-0b4a1918cbaa\",\"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\":\"bf0b0f05-6dc3-4f4e-ba9a-0418dbb06cd2\",\"type\":\"Rect\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"48e9f968-f5db-4be6-9371-1fead15dd0db\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"70ea4bf2-a39b-4650-ad44-1379b689eb93\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"d95aaf60-18ae-447f-84e8-5f083e51af31\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"4a1742fc-3678-4877-813a-56ebdd2a3588\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"5ea291eb-2b63-49d7-9caa-5449ca9fb2fa\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"e6c43d16-108c-4784-8253-d599fdc98f7d\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"181d12a5-edea-42e1-933b-8082684768ca\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"1a82132b-9a24-4a8c-a1f6-79a361865848\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data_source\":{\"id\":\"134495f4-8520-45ad-ba70-e6b149b727a4\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"d52ff6f4-5267-45d9-be55-ad6a692abb37\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"91ed5797-c4b4-4558-b8ea-fe42b95b9344\",\"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\":\"df2d3324-3072-4c5b-bea9-32c80a9700f2\",\"type\":\"Rect\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"d3e84467-1121-4794-895e-3f91ed226214\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"below\":[{\"id\":\"645f58dc-809a-434f-8319-57f973253043\",\"type\":\"LinearAxis\"}],\"css_classes\":null,\"left\":[{\"id\":\"56e1bb16-fc6f-40e0-becd-71a8872d9e65\",\"type\":\"LinearAxis\"}],\"renderers\":[{\"id\":\"7cb0ef38-e46a-4b4f-bff0-cad647e703a8\",\"type\":\"BoxAnnotation\"},{\"id\":\"6476ec4f-262b-4548-8d5e-9e3aa89a5e30\",\"type\":\"GlyphRenderer\"},{\"id\":\"53da2b5c-fb54-461d-97c1-3bed79e30940\",\"type\":\"GlyphRenderer\"},{\"id\":\"9ea709da-c7cd-4881-8aca-cd47b1aee042\",\"type\":\"GlyphRenderer\"},{\"id\":\"d8de2099-da01-457b-b66d-f201e63a3cc2\",\"type\":\"GlyphRenderer\"},{\"id\":\"88c59ec8-a54c-475a-bdf4-bbef1d59334c\",\"type\":\"GlyphRenderer\"},{\"id\":\"6b8e0a7a-ebf2-43e9-abcb-3b78be3be4dd\",\"type\":\"GlyphRenderer\"},{\"id\":\"6097d581-3e7f-4437-8992-b9c8bfc04c75\",\"type\":\"GlyphRenderer\"},{\"id\":\"56b77ec0-f61b-441a-bc74-0b8ef3e46ec2\",\"type\":\"GlyphRenderer\"},{\"id\":\"0c40240a-1fdb-41a3-8b39-e759cc2de480\",\"type\":\"GlyphRenderer\"},{\"id\":\"c2f3032a-bdaf-4e87-9756-44ca7d72a246\",\"type\":\"GlyphRenderer\"},{\"id\":\"3eb1eca7-d9c0-44d0-8ae8-2455c16e6a63\",\"type\":\"GlyphRenderer\"},{\"id\":\"5a5c4594-63bd-4962-a2b0-0bf805de916e\",\"type\":\"GlyphRenderer\"},{\"id\":\"b426abc2-a156-4d5c-9418-299b9ef6d5fe\",\"type\":\"GlyphRenderer\"},{\"id\":\"dd5d006a-ca41-49c6-902a-77b060a8d933\",\"type\":\"GlyphRenderer\"},{\"id\":\"019148e6-5f18-4a8a-bada-38887339060b\",\"type\":\"GlyphRenderer\"},{\"id\":\"495ef3e7-bca9-4578-9a49-17abd4545ea7\",\"type\":\"GlyphRenderer\"},{\"id\":\"6ea78de2-d897-497a-b67b-6e307240eead\",\"type\":\"GlyphRenderer\"},{\"id\":\"e91327c9-4e5a-4646-9121-2a5883edb6da\",\"type\":\"GlyphRenderer\"},{\"id\":\"cfd52cae-48cf-4e13-8dc1-b2ecdb3a8fd9\",\"type\":\"GlyphRenderer\"},{\"id\":\"f01a80c5-df04-4733-b426-c6b9286b8a0d\",\"type\":\"GlyphRenderer\"},{\"id\":\"f9b8acab-91ed-4366-9ec8-0e62d29075c3\",\"type\":\"GlyphRenderer\"},{\"id\":\"763c8cf1-ac5e-4117-b9dc-d21ec8fb659c\",\"type\":\"GlyphRenderer\"},{\"id\":\"2c460e7e-e565-4b47-9fee-0c8fed2f7437\",\"type\":\"GlyphRenderer\"},{\"id\":\"f4f4a97e-ae8d-41ae-ba25-7805ae6e7955\",\"type\":\"GlyphRenderer\"},{\"id\":\"673dc7bd-f84f-4b22-9045-a6eb7d2822e4\",\"type\":\"GlyphRenderer\"},{\"id\":\"409ae39d-f1de-4af1-a535-c2fcfa795bff\",\"type\":\"GlyphRenderer\"},{\"id\":\"78cd7987-7026-4cef-b8ac-0b395143b374\",\"type\":\"GlyphRenderer\"},{\"id\":\"9430d154-78a9-4120-9f5f-25036d8a72cd\",\"type\":\"GlyphRenderer\"},{\"id\":\"46888a5d-370d-434d-9b3d-accef03604c0\",\"type\":\"GlyphRenderer\"},{\"id\":\"a07c4be3-79f1-4701-971c-65dd57d77ce9\",\"type\":\"GlyphRenderer\"},{\"id\":\"be491811-b2e5-4058-a0ed-163dde279ccf\",\"type\":\"GlyphRenderer\"},{\"id\":\"4a1742fc-3678-4877-813a-56ebdd2a3588\",\"type\":\"GlyphRenderer\"},{\"id\":\"a4329407-f831-4d25-85d1-66960fe7d31e\",\"type\":\"GlyphRenderer\"},{\"id\":\"cc999369-ed24-4ff6-af75-66d497d2f95e\",\"type\":\"GlyphRenderer\"},{\"id\":\"91ed5797-c4b4-4558-b8ea-fe42b95b9344\",\"type\":\"GlyphRenderer\"},{\"id\":\"fc56e978-efab-4f52-b4c2-6f33fce0e8bc\",\"type\":\"GlyphRenderer\"},{\"id\":\"1a82132b-9a24-4a8c-a1f6-79a361865848\",\"type\":\"GlyphRenderer\"},{\"id\":\"f95c8652-c78e-4e4e-a434-c567cd40d252\",\"type\":\"GlyphRenderer\"},{\"id\":\"1401e513-edcd-4d62-949a-4a3b09cb7ffe\",\"type\":\"GlyphRenderer\"},{\"id\":\"caf3047e-4d1d-4ebc-aa01-28b7b4fd39c3\",\"type\":\"GlyphRenderer\"},{\"id\":\"d5acb926-a47f-4645-9f08-40424f4ae350\",\"type\":\"GlyphRenderer\"},{\"id\":\"379b0425-2c26-4a96-8857-6dcc84c96e09\",\"type\":\"GlyphRenderer\"},{\"id\":\"46c7b025-d143-4c0a-aad3-ec3ba8ecd967\",\"type\":\"GlyphRenderer\"},{\"id\":\"ffdc61ca-bb7a-49d7-bbdf-2f6a7c40f8f9\",\"type\":\"GlyphRenderer\"},{\"id\":\"68605d7e-c637-42e9-a2b2-e979863f1dca\",\"type\":\"GlyphRenderer\"},{\"id\":\"55c79cf7-bc0b-4275-9932-5d3678c8cdba\",\"type\":\"GlyphRenderer\"},{\"id\":\"2cd54bb2-d37e-432b-863f-dea9fb8502c9\",\"type\":\"GlyphRenderer\"},{\"id\":\"84a670fc-02bf-4293-966c-91b2d66378d3\",\"type\":\"GlyphRenderer\"},{\"id\":\"29bf62cc-38a2-48d9-91e0-c70787b995fd\",\"type\":\"GlyphRenderer\"},{\"id\":\"3f3bf28f-241d-4cff-afc8-3f96ad23314c\",\"type\":\"GlyphRenderer\"},{\"id\":\"84777c30-1f34-4cd0-a63c-4b84df131f9b\",\"type\":\"Legend\"},{\"id\":\"645f58dc-809a-434f-8319-57f973253043\",\"type\":\"LinearAxis\"},{\"id\":\"56e1bb16-fc6f-40e0-becd-71a8872d9e65\",\"type\":\"LinearAxis\"},{\"id\":\"56b3ebb8-63c4-45b8-9268-0b378b603322\",\"type\":\"Grid\"}],\"title\":{\"id\":\"c080e8ad-c195-46c4-87b8-253d35765c3c\",\"type\":\"Title\"},\"tool_events\":{\"id\":\"11d3a5b2-10bd-4027-a836-781f952a42f3\",\"type\":\"ToolEvents\"},\"toolbar\":{\"id\":\"bc4e492b-cbaf-4be8-97d7-af349a8499db\",\"type\":\"Toolbar\"},\"x_mapper_type\":\"auto\",\"x_range\":{\"id\":\"179fe29c-366f-472a-ac87-848d437a90a9\",\"type\":\"Range1d\"},\"y_mapper_type\":\"auto\",\"y_range\":{\"id\":\"7e63d989-6be5-4a4b-8813-93a781a80d06\",\"type\":\"Range1d\"}},\"id\":\"72dc7dee-c815-47a1-ac56-5227256aa304\",\"subtype\":\"Chart\",\"type\":\"Plot\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"cc0e9648-3751-474e-845d-fc442bc9d990\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"9a112a7f-acba-4c2a-a1ff-12a26eae84ea\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"337eaddb-5266-4697-a059-62f306e291d9\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"2cd54bb2-d37e-432b-863f-dea9fb8502c9\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data_source\":{\"id\":\"3da62201-1a25-469f-abfe-12d2446026d7\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"bdef5256-45f1-403b-a80b-460404bee8e5\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"88c59ec8-a54c-475a-bdf4-bbef1d59334c\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"e6c43d16-108c-4784-8253-d599fdc98f7d\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"895b89c6-cec6-4472-a96a-71e8ac30c09a\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"7009ab47-3809-427f-8ea3-3b9205dfeb63\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"673dc7bd-f84f-4b22-9045-a6eb7d2822e4\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"11d3a5b2-10bd-4027-a836-781f952a42f3\",\"type\":\"ToolEvents\"},{\"attributes\":{\"data_source\":{\"id\":\"22743ccd-0df0-41a0-af88-ca8c09ec2d0b\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"bf209114-65f9-4c78-b60e-7a8c24acfa8d\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"b426abc2-a156-4d5c-9418-299b9ef6d5fe\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"afc886b4-f0e3-4052-851d-4c683d18c35a\",\"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\":\"d95aaf60-18ae-447f-84e8-5f083e51af31\",\"type\":\"Rect\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"b7b06d74-05c1-4358-8b82-a5a017b82eca\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"plot\":{\"id\":\"72dc7dee-c815-47a1-ac56-5227256aa304\",\"subtype\":\"Chart\",\"type\":\"Plot\"}},\"id\":\"ade63397-0fb9-495b-a0be-a786be5e55e0\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"dimension\":1,\"plot\":{\"id\":\"72dc7dee-c815-47a1-ac56-5227256aa304\",\"subtype\":\"Chart\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"8ab847ed-fb0b-4e7c-b2ec-d7d2b0e1cc9b\",\"type\":\"BasicTicker\"}},\"id\":\"56b3ebb8-63c4-45b8-9268-0b378b603322\",\"type\":\"Grid\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"aaa5037f-7dc2-43bb-86f7-7a991893fc45\",\"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\":\"726b831a-eee4-49c8-8314-7c6b761cd32b\",\"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\":\"773d7690-faee-4e37-96c5-4c54e18b9cff\",\"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\":\"78616d71-a9a4-4706-82b3-eca21d69f38a\",\"type\":\"Rect\"},{\"attributes\":{},\"id\":\"b30cd8c9-c534-4c22-84bc-b3902cade211\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"width\",\"line_color\",\"color\",\"y\",\"line_alpha\",\"label\",\"x\",\"height\",\"fill_alpha\"],\"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\":\"725fd89c-ef0c-46f7-92af-243cd15b8ae4\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"624a4deb-817f-4609-a054-4a04898eafa8\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"173d5e41-b2c7-4391-876b-2fff132c03d9\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"a4329407-f831-4d25-85d1-66960fe7d31e\",\"type\":\"GlyphRenderer\"}],\"root_ids\":[\"72dc7dee-c815-47a1-ac56-5227256aa304\"]},\"title\":\"Bokeh Application\",\"version\":\"0.12.4\"}};\n",
" var render_items = [{\"docid\":\"9f84cecc-8ae3-424e-8008-c4f2108b2e40\",\"elementid\":\"e6d57401-77d4-4f94-812f-47bd9fad17a0\",\"modelid\":\"72dc7dee-c815-47a1-ac56-5227256aa304\"}];\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(\"e6d57401-77d4-4f94-812f-47bd9fad17a0\")).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": 6,
"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": 7,
"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": 8,
"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": 9,
"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": 10,
"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": 11,
"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": 12,
"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": 13,
"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": 14,
"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": 15,
"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": 16,
"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": 17,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"array([4, 2, 1, 3])"
]
},
"execution_count": 17,
"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": 123,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true,
"scrolled": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"n_batches 7\n",
"\n",
"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",
" print('n_batches {}\\n'.format(n_batches))\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",
" # Group inputs, targets into n_batches x seq_len items \n",
" inputs, targets = np.reshape(_inputs, (-1, n_batches, seq_length)), np.reshape(_targets, (-1, n_batches, seq_length))\n",
" \n",
" \n",
" \n",
" # Look through the n_batches axes\n",
" #print(inputs[:,0,:])\n",
" \n",
" # Swatch the 0 axis with n_batches axes, now 0 axis is n_batches axis\n",
" inputs, targets = np.swapaxes(inputs, 0,1), np.swapaxes(targets, 0,1)\n",
" \n",
" \n",
" # stack inputs and targets on columns\n",
" batches = np.column_stack((inputs, targets))\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",
"#Check first batch result\n",
"#print(get_batches(np.arange(1,200,1), 20, 3)[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": 107,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"# Number of Epochs\n",
"num_epochs = 100\n",
"# Batch Size\n",
"batch_size = 256\n",
"# RNN Size\n",
"rnn_size = 128\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": 109,
"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": 110,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"n_batches 24\n",
"\n",
"Epoch 0 Batch 0/24 train_loss = 8.821\n",
"Epoch 0 Batch 10/24 train_loss = 6.639\n",
"Epoch 0 Batch 20/24 train_loss = 6.516\n",
"Epoch 1 Batch 6/24 train_loss = 6.023\n",
"Epoch 1 Batch 16/24 train_loss = 6.070\n",
"Epoch 2 Batch 2/24 train_loss = 5.976\n",
"Epoch 2 Batch 12/24 train_loss = 6.045\n",
"Epoch 2 Batch 22/24 train_loss = 5.987\n",
"Epoch 3 Batch 8/24 train_loss = 5.959\n",
"Epoch 3 Batch 18/24 train_loss = 5.839\n",
"Epoch 4 Batch 4/24 train_loss = 5.702\n",
"Epoch 4 Batch 14/24 train_loss = 5.684\n",
"Epoch 5 Batch 0/24 train_loss = 5.578\n",
"Epoch 5 Batch 10/24 train_loss = 5.687\n",
"Epoch 5 Batch 20/24 train_loss = 5.597\n",
"Epoch 6 Batch 6/24 train_loss = 5.504\n",
"Epoch 6 Batch 16/24 train_loss = 5.442\n",
"Epoch 7 Batch 2/24 train_loss = 5.276\n",
"Epoch 7 Batch 12/24 train_loss = 5.422\n",
"Epoch 7 Batch 22/24 train_loss = 5.317\n",
"Epoch 8 Batch 8/24 train_loss = 5.296\n",
"Epoch 8 Batch 18/24 train_loss = 5.165\n",
"Epoch 9 Batch 4/24 train_loss = 5.019\n",
"Epoch 9 Batch 14/24 train_loss = 4.972\n",
"Epoch 10 Batch 0/24 train_loss = 4.883\n",
"Epoch 10 Batch 10/24 train_loss = 4.991\n",
"Epoch 10 Batch 20/24 train_loss = 4.891\n",
"Epoch 11 Batch 6/24 train_loss = 4.799\n",
"Epoch 11 Batch 16/24 train_loss = 4.764\n",
"Epoch 12 Batch 2/24 train_loss = 4.581\n",
"Epoch 12 Batch 12/24 train_loss = 4.673\n",
"Epoch 12 Batch 22/24 train_loss = 4.586\n",
"Epoch 13 Batch 8/24 train_loss = 4.603\n",
"Epoch 13 Batch 18/24 train_loss = 4.454\n",
"Epoch 14 Batch 4/24 train_loss = 4.280\n",
"Epoch 14 Batch 14/24 train_loss = 4.301\n",
"Epoch 15 Batch 0/24 train_loss = 4.275\n",
"Epoch 15 Batch 10/24 train_loss = 4.371\n",
"Epoch 15 Batch 20/24 train_loss = 4.248\n",
"Epoch 16 Batch 6/24 train_loss = 4.220\n",
"Epoch 16 Batch 16/24 train_loss = 4.169\n",
"Epoch 17 Batch 2/24 train_loss = 3.998\n",
"Epoch 17 Batch 12/24 train_loss = 4.083\n",
"Epoch 17 Batch 22/24 train_loss = 3.965\n",
"Epoch 18 Batch 8/24 train_loss = 3.985\n",
"Epoch 18 Batch 18/24 train_loss = 3.911\n",
"Epoch 19 Batch 4/24 train_loss = 3.733\n",
"Epoch 19 Batch 14/24 train_loss = 3.779\n",
"Epoch 20 Batch 0/24 train_loss = 3.714\n",
"Epoch 20 Batch 10/24 train_loss = 3.793\n",
"Epoch 20 Batch 20/24 train_loss = 3.735\n",
"Epoch 21 Batch 6/24 train_loss = 3.713\n",
"Epoch 21 Batch 16/24 train_loss = 3.677\n",
"Epoch 22 Batch 2/24 train_loss = 3.518\n",
"Epoch 22 Batch 12/24 train_loss = 3.561\n",
"Epoch 22 Batch 22/24 train_loss = 3.501\n",
"Epoch 23 Batch 8/24 train_loss = 3.499\n",
"Epoch 23 Batch 18/24 train_loss = 3.451\n",
"Epoch 24 Batch 4/24 train_loss = 3.291\n",
"Epoch 24 Batch 14/24 train_loss = 3.295\n",
"Epoch 25 Batch 0/24 train_loss = 3.271\n",
"Epoch 25 Batch 10/24 train_loss = 3.331\n",
"Epoch 25 Batch 20/24 train_loss = 3.256\n",
"Epoch 26 Batch 6/24 train_loss = 3.238\n",
"Epoch 26 Batch 16/24 train_loss = 3.167\n",
"Epoch 27 Batch 2/24 train_loss = 3.038\n",
"Epoch 27 Batch 12/24 train_loss = 3.106\n",
"Epoch 27 Batch 22/24 train_loss = 2.985\n",
"Epoch 28 Batch 8/24 train_loss = 3.011\n",
"Epoch 28 Batch 18/24 train_loss = 2.991\n",
"Epoch 29 Batch 4/24 train_loss = 2.907\n",
"Epoch 29 Batch 14/24 train_loss = 2.891\n",
"Epoch 30 Batch 0/24 train_loss = 2.911\n",
"Epoch 30 Batch 10/24 train_loss = 2.948\n",
"Epoch 30 Batch 20/24 train_loss = 2.903\n",
"Epoch 31 Batch 6/24 train_loss = 2.885\n",
"Epoch 31 Batch 16/24 train_loss = 2.808\n",
"Epoch 32 Batch 2/24 train_loss = 2.670\n",
"Epoch 32 Batch 12/24 train_loss = 2.701\n",
"Epoch 32 Batch 22/24 train_loss = 2.591\n",
"Epoch 33 Batch 8/24 train_loss = 2.579\n",
"Epoch 33 Batch 18/24 train_loss = 2.603\n",
"Epoch 34 Batch 4/24 train_loss = 2.498\n",
"Epoch 34 Batch 14/24 train_loss = 2.504\n",
"Epoch 35 Batch 0/24 train_loss = 2.482\n",
"Epoch 35 Batch 10/24 train_loss = 2.530\n",
"Epoch 35 Batch 20/24 train_loss = 2.489\n",
"Epoch 36 Batch 6/24 train_loss = 2.486\n",
"Epoch 36 Batch 16/24 train_loss = 2.417\n",
"Epoch 37 Batch 2/24 train_loss = 2.320\n",
"Epoch 37 Batch 12/24 train_loss = 2.348\n",
"Epoch 37 Batch 22/24 train_loss = 2.287\n",
"Epoch 38 Batch 8/24 train_loss = 2.245\n",
"Epoch 38 Batch 18/24 train_loss = 2.322\n",
"Epoch 39 Batch 4/24 train_loss = 2.230\n",
"Epoch 39 Batch 14/24 train_loss = 2.234\n",
"Epoch 40 Batch 0/24 train_loss = 2.223\n",
"Epoch 40 Batch 10/24 train_loss = 2.263\n",
"Epoch 40 Batch 20/24 train_loss = 2.267\n",
"Epoch 41 Batch 6/24 train_loss = 2.251\n",
"Epoch 41 Batch 16/24 train_loss = 2.179\n",
"Epoch 42 Batch 2/24 train_loss = 2.121\n",
"Epoch 42 Batch 12/24 train_loss = 2.155\n",
"Epoch 42 Batch 22/24 train_loss = 2.100\n",
"Epoch 43 Batch 8/24 train_loss = 2.031\n",
"Epoch 43 Batch 18/24 train_loss = 2.134\n",
"Epoch 44 Batch 4/24 train_loss = 2.016\n",
"Epoch 44 Batch 14/24 train_loss = 2.027\n",
"Epoch 45 Batch 0/24 train_loss = 2.049\n",
"Epoch 45 Batch 10/24 train_loss = 2.042\n",
"Epoch 45 Batch 20/24 train_loss = 2.060\n",
"Epoch 46 Batch 6/24 train_loss = 2.031\n",
"Epoch 46 Batch 16/24 train_loss = 1.943\n",
"Epoch 47 Batch 2/24 train_loss = 1.888\n",
"Epoch 47 Batch 12/24 train_loss = 1.901\n",
"Epoch 47 Batch 22/24 train_loss = 1.881\n",
"Epoch 48 Batch 8/24 train_loss = 1.794\n",
"Epoch 48 Batch 18/24 train_loss = 1.910\n",
"Epoch 49 Batch 4/24 train_loss = 1.802\n",
"Epoch 49 Batch 14/24 train_loss = 1.839\n",
"Epoch 50 Batch 0/24 train_loss = 1.860\n",
"Epoch 50 Batch 10/24 train_loss = 1.836\n",
"Epoch 50 Batch 20/24 train_loss = 1.834\n",
"Epoch 51 Batch 6/24 train_loss = 1.841\n",
"Epoch 51 Batch 16/24 train_loss = 1.803\n",
"Epoch 52 Batch 2/24 train_loss = 1.735\n",
"Epoch 52 Batch 12/24 train_loss = 1.723\n",
"Epoch 52 Batch 22/24 train_loss = 1.692\n",
"Epoch 53 Batch 8/24 train_loss = 1.636\n",
"Epoch 53 Batch 18/24 train_loss = 1.754\n",
"Epoch 54 Batch 4/24 train_loss = 1.671\n",
"Epoch 54 Batch 14/24 train_loss = 1.657\n",
"Epoch 55 Batch 0/24 train_loss = 1.722\n",
"Epoch 55 Batch 10/24 train_loss = 1.697\n",
"Epoch 55 Batch 20/24 train_loss = 1.719\n",
"Epoch 56 Batch 6/24 train_loss = 1.689\n",
"Epoch 56 Batch 16/24 train_loss = 1.624\n",
"Epoch 57 Batch 2/24 train_loss = 1.592\n",
"Epoch 57 Batch 12/24 train_loss = 1.616\n",
"Epoch 57 Batch 22/24 train_loss = 1.556\n",
"Epoch 58 Batch 8/24 train_loss = 1.525\n",
"Epoch 58 Batch 18/24 train_loss = 1.592\n",
"Epoch 59 Batch 4/24 train_loss = 1.547\n",
"Epoch 59 Batch 14/24 train_loss = 1.549\n",
"Epoch 60 Batch 0/24 train_loss = 1.570\n",
"Epoch 60 Batch 10/24 train_loss = 1.530\n",
"Epoch 60 Batch 20/24 train_loss = 1.580\n",
"Epoch 61 Batch 6/24 train_loss = 1.540\n",
"Epoch 61 Batch 16/24 train_loss = 1.496\n",
"Epoch 62 Batch 2/24 train_loss = 1.459\n",
"Epoch 62 Batch 12/24 train_loss = 1.450\n",
"Epoch 62 Batch 22/24 train_loss = 1.432\n",
"Epoch 63 Batch 8/24 train_loss = 1.387\n",
"Epoch 63 Batch 18/24 train_loss = 1.483\n",
"Epoch 64 Batch 4/24 train_loss = 1.414\n",
"Epoch 64 Batch 14/24 train_loss = 1.430\n",
"Epoch 65 Batch 0/24 train_loss = 1.452\n",
"Epoch 65 Batch 10/24 train_loss = 1.433\n",
"Epoch 65 Batch 20/24 train_loss = 1.496\n",
"Epoch 66 Batch 6/24 train_loss = 1.447\n",
"Epoch 66 Batch 16/24 train_loss = 1.436\n",
"Epoch 67 Batch 2/24 train_loss = 1.398\n",
"Epoch 67 Batch 12/24 train_loss = 1.409\n",
"Epoch 67 Batch 22/24 train_loss = 1.404\n",
"Epoch 68 Batch 8/24 train_loss = 1.339\n",
"Epoch 68 Batch 18/24 train_loss = 1.429\n",
"Epoch 69 Batch 4/24 train_loss = 1.371\n",
"Epoch 69 Batch 14/24 train_loss = 1.402\n",
"Epoch 70 Batch 0/24 train_loss = 1.439\n",
"Epoch 70 Batch 10/24 train_loss = 1.382\n",
"Epoch 70 Batch 20/24 train_loss = 1.436\n",
"Epoch 71 Batch 6/24 train_loss = 1.411\n",
"Epoch 71 Batch 16/24 train_loss = 1.379\n",
"Epoch 72 Batch 2/24 train_loss = 1.347\n",
"Epoch 72 Batch 12/24 train_loss = 1.326\n",
"Epoch 72 Batch 22/24 train_loss = 1.335\n",
"Epoch 73 Batch 8/24 train_loss = 1.284\n",
"Epoch 73 Batch 18/24 train_loss = 1.369\n",
"Epoch 74 Batch 4/24 train_loss = 1.308\n",
"Epoch 74 Batch 14/24 train_loss = 1.305\n",
"Epoch 75 Batch 0/24 train_loss = 1.329\n",
"Epoch 75 Batch 10/24 train_loss = 1.291\n",
"Epoch 75 Batch 20/24 train_loss = 1.345\n",
"Epoch 76 Batch 6/24 train_loss = 1.303\n",
"Epoch 76 Batch 16/24 train_loss = 1.287\n",
"Epoch 77 Batch 2/24 train_loss = 1.260\n",
"Epoch 77 Batch 12/24 train_loss = 1.229\n",
"Epoch 77 Batch 22/24 train_loss = 1.228\n",
"Epoch 78 Batch 8/24 train_loss = 1.176\n",
"Epoch 78 Batch 18/24 train_loss = 1.247\n",
"Epoch 79 Batch 4/24 train_loss = 1.176\n",
"Epoch 79 Batch 14/24 train_loss = 1.211\n",
"Epoch 80 Batch 0/24 train_loss = 1.255\n",
"Epoch 80 Batch 10/24 train_loss = 1.214\n",
"Epoch 80 Batch 20/24 train_loss = 1.233\n",
"Epoch 81 Batch 6/24 train_loss = 1.194\n",
"Epoch 81 Batch 16/24 train_loss = 1.173\n",
"Epoch 82 Batch 2/24 train_loss = 1.179\n",
"Epoch 82 Batch 12/24 train_loss = 1.115\n",
"Epoch 82 Batch 22/24 train_loss = 1.123\n",
"Epoch 83 Batch 8/24 train_loss = 1.058\n",
"Epoch 83 Batch 18/24 train_loss = 1.138\n",
"Epoch 84 Batch 4/24 train_loss = 1.085\n",
"Epoch 84 Batch 14/24 train_loss = 1.120\n",
"Epoch 85 Batch 0/24 train_loss = 1.157\n",
"Epoch 85 Batch 10/24 train_loss = 1.081\n",
"Epoch 85 Batch 20/24 train_loss = 1.157\n",
"Epoch 86 Batch 6/24 train_loss = 1.129\n",
"Epoch 86 Batch 16/24 train_loss = 1.081\n",
"Epoch 87 Batch 2/24 train_loss = 1.078\n",
"Epoch 87 Batch 12/24 train_loss = 1.033\n",
"Epoch 87 Batch 22/24 train_loss = 1.048\n",
"Epoch 88 Batch 8/24 train_loss = 1.021\n",
"Epoch 88 Batch 18/24 train_loss = 1.088\n",
"Epoch 89 Batch 4/24 train_loss = 1.019\n",
"Epoch 89 Batch 14/24 train_loss = 1.046\n",
"Epoch 90 Batch 0/24 train_loss = 1.085\n",
"Epoch 90 Batch 10/24 train_loss = 1.045\n",
"Epoch 90 Batch 20/24 train_loss = 1.093\n",
"Epoch 91 Batch 6/24 train_loss = 1.056\n",
"Epoch 91 Batch 16/24 train_loss = 1.035\n",
"Epoch 92 Batch 2/24 train_loss = 1.047\n",
"Epoch 92 Batch 12/24 train_loss = 1.002\n",
"Epoch 92 Batch 22/24 train_loss = 1.011\n",
"Epoch 93 Batch 8/24 train_loss = 0.952\n",
"Epoch 93 Batch 18/24 train_loss = 1.036\n",
"Epoch 94 Batch 4/24 train_loss = 0.982\n",
"Epoch 94 Batch 14/24 train_loss = 1.020\n",
"Epoch 95 Batch 0/24 train_loss = 1.029\n",
"Epoch 95 Batch 10/24 train_loss = 0.961\n",
"Epoch 95 Batch 20/24 train_loss = 0.999\n",
"Epoch 96 Batch 6/24 train_loss = 0.982\n",
"Epoch 96 Batch 16/24 train_loss = 0.979\n",
"Epoch 97 Batch 2/24 train_loss = 0.980\n",
"Epoch 97 Batch 12/24 train_loss = 0.938\n",
"Epoch 97 Batch 22/24 train_loss = 0.939\n",
"Epoch 98 Batch 8/24 train_loss = 0.902\n",
"Epoch 98 Batch 18/24 train_loss = 0.976\n",
"Epoch 99 Batch 4/24 train_loss = 0.920\n",
"Epoch 99 Batch 14/24 train_loss = 0.949\n",
"Model Trained and Saved\n"
]
}
],
"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": 111,
"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": 112,
"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": 113,
"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": "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": 121,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Tests Passed\n"
]
}
],
"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 = probabilities.tolist().index(word_p)\n",
" \n",
" \n",
" return int_to_vocab[word]\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": 122,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"moe_szyslak: okay, you can't sell it till it blows at the mr.\n",
"moe_szyslak: what?\n",
"homer_simpson: do you goin' homer?\n",
"moe_szyslak: oh, why don't you had? he's just a day?\n",
"homer_simpson: marge if it isn't little call? i'm gonna invite me out.\n",
"barney_gumble:(to homer) all knows me? hey, but all day it's everyone anymore.\n",
"moe_szyslak: aw, behind not one about us, like how about the last guy old.\n",
"lenny_leonard: hey, what that can hide!\n",
"seymour_skinner: i had to my time you say, big day...\n",
"kirk_van_houten: oh, nuts.\n",
"homer_simpson: when i'm not your best friend because i'm gonna plotz.\n",
"homer_simpson: don't be lost in a grampa.\n",
"homer_simpson: oh, right. it wasn't up from the\" sex on the car.\n",
"moe_szyslak: ah, he's down for a man. to be a friend.\n",
"\n",
"\n",
"homer_simpson:(moans) we're sure is.\n",
"\n",
"\n",
"\n",
"\n",
"homer_simpson:(to tv) hey, hibachi head.\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
}