{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "ExecuteTime": { "end_time": "2020-12-02T09:00:22.124286Z", "start_time": "2020-12-02T09:00:18.430379Z" } }, "outputs": [], "source": [ "import pandas as pd\n", "import numpy as np\n", "import tensorflow as tf\n", "from sklearn.model_selection import train_test_split\n", "from sklearn.metrics import mean_absolute_error\n", "from sklearn.ensemble import RandomForestRegressor\n", "import plotly.express as px\n", "import plotly.graph_objects as go" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Data preparation" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Reading data" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "ExecuteTime": { "end_time": "2020-12-02T09:00:34.677869Z", "start_time": "2020-12-02T09:00:22.126491Z" } }, "outputs": [], "source": [ "df_raw = pd.read_csv(\"train_2.csv\")" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "ExecuteTime": { "end_time": "2020-12-02T09:00:34.712531Z", "start_time": "2020-12-02T09:00:34.683457Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Page2015-07-012015-07-022015-07-032015-07-042015-07-052015-07-062015-07-072015-07-082015-07-09...2017-09-012017-09-022017-09-032017-09-042017-09-052017-09-062017-09-072017-09-082017-09-092017-09-10
02NE1_zh.wikipedia.org_all-access_spider18.011.05.013.014.09.09.022.026.0...19.033.033.018.016.027.029.023.054.038.0
12PM_zh.wikipedia.org_all-access_spider11.014.015.018.011.013.022.011.010.0...32.030.011.019.054.025.026.023.013.081.0
23C_zh.wikipedia.org_all-access_spider1.00.01.01.00.04.00.03.04.0...6.06.07.02.04.07.03.04.07.06.0
34minute_zh.wikipedia.org_all-access_spider35.013.010.094.04.026.014.09.011.0...7.019.019.09.06.016.019.030.038.04.0
452_Hz_I_Love_You_zh.wikipedia.org_all-access_s...NaNNaNNaNNaNNaNNaNNaNNaNNaN...16.016.019.09.020.023.028.014.08.07.0
\n", "

5 rows × 804 columns

\n", "
" ], "text/plain": [ " Page 2015-07-01 2015-07-02 \\\n", "0 2NE1_zh.wikipedia.org_all-access_spider 18.0 11.0 \n", "1 2PM_zh.wikipedia.org_all-access_spider 11.0 14.0 \n", "2 3C_zh.wikipedia.org_all-access_spider 1.0 0.0 \n", "3 4minute_zh.wikipedia.org_all-access_spider 35.0 13.0 \n", "4 52_Hz_I_Love_You_zh.wikipedia.org_all-access_s... NaN NaN \n", "\n", " 2015-07-03 2015-07-04 2015-07-05 2015-07-06 2015-07-07 2015-07-08 \\\n", "0 5.0 13.0 14.0 9.0 9.0 22.0 \n", "1 15.0 18.0 11.0 13.0 22.0 11.0 \n", "2 1.0 1.0 0.0 4.0 0.0 3.0 \n", "3 10.0 94.0 4.0 26.0 14.0 9.0 \n", "4 NaN NaN NaN NaN NaN NaN \n", "\n", " 2015-07-09 ... 2017-09-01 2017-09-02 2017-09-03 2017-09-04 \\\n", "0 26.0 ... 19.0 33.0 33.0 18.0 \n", "1 10.0 ... 32.0 30.0 11.0 19.0 \n", "2 4.0 ... 6.0 6.0 7.0 2.0 \n", "3 11.0 ... 7.0 19.0 19.0 9.0 \n", "4 NaN ... 16.0 16.0 19.0 9.0 \n", "\n", " 2017-09-05 2017-09-06 2017-09-07 2017-09-08 2017-09-09 2017-09-10 \n", "0 16.0 27.0 29.0 23.0 54.0 38.0 \n", "1 54.0 25.0 26.0 23.0 13.0 81.0 \n", "2 4.0 7.0 3.0 4.0 7.0 6.0 \n", "3 6.0 16.0 19.0 30.0 38.0 4.0 \n", "4 20.0 23.0 28.0 14.0 8.0 7.0 \n", "\n", "[5 rows x 804 columns]" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_raw.head()" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "ExecuteTime": { "end_time": "2020-12-02T09:00:34.717586Z", "start_time": "2020-12-02T09:00:34.714427Z" } }, "outputs": [ { "data": { "text/plain": [ "(145063, 804)" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_raw.shape" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Cleaning data" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We will use data of only one page" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "ExecuteTime": { "end_time": "2020-12-02T09:00:35.848090Z", "start_time": "2020-12-02T09:00:34.719299Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Page2015-07-012015-07-022015-07-032015-07-042015-07-052015-07-062015-07-072015-07-082015-07-09...2017-09-012017-09-022017-09-032017-09-042017-09-052017-09-062017-09-072017-09-082017-09-092017-09-10
02NE1_zh.wikipedia.org_all-access_spider18.011.05.013.014.09.09.022.026.0...19.033.033.018.016.027.029.023.054.038.0
12PM_zh.wikipedia.org_all-access_spider11.014.015.018.011.013.022.011.010.0...32.030.011.019.054.025.026.023.013.081.0
23C_zh.wikipedia.org_all-access_spider1.00.01.01.00.04.00.03.04.0...6.06.07.02.04.07.03.04.07.06.0
34minute_zh.wikipedia.org_all-access_spider35.013.010.094.04.026.014.09.011.0...7.019.019.09.06.016.019.030.038.04.0
55566_zh.wikipedia.org_all-access_spider12.07.04.05.020.08.05.017.024.0...13.013.045.04.013.020.018.017.014.011.0
\n", "

5 rows × 804 columns

\n", "
" ], "text/plain": [ " Page 2015-07-01 2015-07-02 \\\n", "0 2NE1_zh.wikipedia.org_all-access_spider 18.0 11.0 \n", "1 2PM_zh.wikipedia.org_all-access_spider 11.0 14.0 \n", "2 3C_zh.wikipedia.org_all-access_spider 1.0 0.0 \n", "3 4minute_zh.wikipedia.org_all-access_spider 35.0 13.0 \n", "5 5566_zh.wikipedia.org_all-access_spider 12.0 7.0 \n", "\n", " 2015-07-03 2015-07-04 2015-07-05 2015-07-06 2015-07-07 2015-07-08 \\\n", "0 5.0 13.0 14.0 9.0 9.0 22.0 \n", "1 15.0 18.0 11.0 13.0 22.0 11.0 \n", "2 1.0 1.0 0.0 4.0 0.0 3.0 \n", "3 10.0 94.0 4.0 26.0 14.0 9.0 \n", "5 4.0 5.0 20.0 8.0 5.0 17.0 \n", "\n", " 2015-07-09 ... 2017-09-01 2017-09-02 2017-09-03 2017-09-04 \\\n", "0 26.0 ... 19.0 33.0 33.0 18.0 \n", "1 10.0 ... 32.0 30.0 11.0 19.0 \n", "2 4.0 ... 6.0 6.0 7.0 2.0 \n", "3 11.0 ... 7.0 19.0 19.0 9.0 \n", "5 24.0 ... 13.0 13.0 45.0 4.0 \n", "\n", " 2017-09-05 2017-09-06 2017-09-07 2017-09-08 2017-09-09 2017-09-10 \n", "0 16.0 27.0 29.0 23.0 54.0 38.0 \n", "1 54.0 25.0 26.0 23.0 13.0 81.0 \n", "2 4.0 7.0 3.0 4.0 7.0 6.0 \n", "3 6.0 16.0 19.0 30.0 38.0 4.0 \n", "5 13.0 20.0 18.0 17.0 14.0 11.0 \n", "\n", "[5 rows x 804 columns]" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_no_na = df_raw.dropna()\n", "df_no_na.head()" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "ExecuteTime": { "end_time": "2020-12-02T09:00:38.791763Z", "start_time": "2020-12-02T09:00:35.849778Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
2015-07-012015-07-022015-07-032015-07-042015-07-052015-07-062015-07-072015-07-082015-07-092015-07-10...2017-09-012017-09-022017-09-032017-09-042017-09-052017-09-062017-09-072017-09-082017-09-092017-09-10
711231348.01448.0881.0547.0658.0951.01228.01157.01162.0866.0...2155.01274.01715.02758.03151.02991.02637.01527.0931.01146.0
\n", "

1 rows × 803 columns

\n", "
" ], "text/plain": [ " 2015-07-01 2015-07-02 2015-07-03 2015-07-04 2015-07-05 2015-07-06 \\\n", "71123 1348.0 1448.0 881.0 547.0 658.0 951.0 \n", "\n", " 2015-07-07 2015-07-08 2015-07-09 2015-07-10 ... 2017-09-01 \\\n", "71123 1228.0 1157.0 1162.0 866.0 ... 2155.0 \n", "\n", " 2017-09-02 2017-09-03 2017-09-04 2017-09-05 2017-09-06 2017-09-07 \\\n", "71123 1274.0 1715.0 2758.0 3151.0 2991.0 2637.0 \n", "\n", " 2017-09-08 2017-09-09 2017-09-10 \n", "71123 1527.0 931.0 1146.0 \n", "\n", "[1 rows x 803 columns]" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "means = df_no_na.drop(\"Page\", axis=1).mean(axis=1)\n", "mins = df_no_na.drop(\"Page\", axis=1).min(axis=1)\n", "one_page = df_no_na[(means > 100) & (mins > 10)][\"Page\"].sample(1).values[0]\n", "df_one_page = df_no_na[df_no_na[\"Page\"] == one_page].drop(\"Page\", axis=1)\n", "df_one_page.head()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Windows" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "ExecuteTime": { "end_time": "2020-12-02T09:00:39.112022Z", "start_time": "2020-12-02T09:00:38.796140Z" } }, "outputs": [], "source": [ "window_size = 15\n", "cols = df_one_page.columns\n", "window_data = []\n", "for start_index in range(len(cols) - window_size + 1):\n", " window_data.append(df_one_page[cols[start_index:start_index + window_size]].values[0])" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "ExecuteTime": { "end_time": "2020-12-02T09:00:39.118809Z", "start_time": "2020-12-02T09:00:39.115208Z" } }, "outputs": [ { "data": { "text/plain": [ "789" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(window_data)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Split between train and test set " ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "ExecuteTime": { "end_time": "2020-12-02T09:00:39.124429Z", "start_time": "2020-12-02T09:00:39.120742Z" } }, "outputs": [], "source": [ "test_start_index = int(0.85 * len(window_data))\n", "train_data = np.array(window_data[:test_start_index])\n", "test_data = np.array(window_data[test_start_index:])" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "ExecuteTime": { "end_time": "2020-12-02T09:00:39.129770Z", "start_time": "2020-12-02T09:00:39.126247Z" } }, "outputs": [], "source": [ "x_train = train_data[:, :-1].reshape(len(train_data), window_size - 1, 1)\n", "y_train = train_data[:, -1]\n", "x_test = test_data[:, :-1].reshape(len(test_data), window_size - 1, 1)\n", "y_test = test_data[:, -1]" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "ExecuteTime": { "end_time": "2020-12-02T09:00:39.135977Z", "start_time": "2020-12-02T09:00:39.131794Z" } }, "outputs": [ { "data": { "text/plain": [ "((670, 14, 1), (670,), (119, 14, 1), (119,))" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "x_train.shape, y_train.shape, x_test.shape, y_test.shape" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Apply LSTM" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## LSTM without global scaling" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "ExecuteTime": { "end_time": "2020-12-02T09:00:39.141808Z", "start_time": "2020-12-02T09:00:39.138057Z" } }, "outputs": [], "source": [ "def get_model(x_train):\n", " input_layer = tf.keras.layers.Input((x_train.shape[1], x_train.shape[2]))\n", " lstm_layer = tf.keras.layers.LSTM(128, return_sequences=True)(input_layer)\n", " second_lstm_layer = tf.keras.layers.LSTM(32)(lstm_layer)\n", " dense_layer = tf.keras.layers.Dense(8)(second_lstm_layer)\n", " output_layer = tf.keras.layers.Dense(1)(dense_layer)\n", " model = tf.keras.Model(inputs=input_layer, outputs=output_layer)\n", " model.compile(optimizer=tf.keras.optimizers.RMSprop(), loss=\"mae\")\n", " return model" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "ExecuteTime": { "end_time": "2020-12-02T09:01:56.457405Z", "start_time": "2020-12-02T09:00:39.144012Z" } }, "outputs": [], "source": [ "model = get_model(x_train)\n", "early_stopping = tf.keras.callbacks.EarlyStopping(patience=100,\n", " restore_best_weights=True)\n", "model_history = model.fit(x_train, y_train, validation_split=0.1,\n", " batch_size=128, epochs=1000,\n", " callbacks=early_stopping, verbose=0)" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "ExecuteTime": { "end_time": "2020-12-02T09:01:56.462709Z", "start_time": "2020-12-02T09:01:56.459038Z" } }, "outputs": [], "source": [ "def visualize_loss(history, title):\n", " loss = history.history[\"loss\"]\n", " val_loss = history.history[\"val_loss\"]\n", " epochs = list(range(len(loss)))\n", " fig = go.Figure(data=[go.Scatter(x=epochs, y=loss, name=\"Training loss\"),\n", " go.Scatter(x=epochs, y=val_loss, name=\"Validation loss\")])\n", " fig.update_layout(title=title,\n", " xaxis_title=\"Epoch\",\n", " yaxis_title=\"Loss\")\n", " fig.show()" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "ExecuteTime": { "end_time": "2020-12-02T09:01:56.652962Z", "start_time": "2020-12-02T09:01:56.464506Z" } }, "outputs": [ { "data": { "text/html": [ " \n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "name": "Training loss", "type": "scatter", "x": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678 ], "y": [ 1648.830078125, 1645.8912353515625, 1643.847900390625, 1642.17529296875, 1640.8486328125, 1639.7860107421875, 1638.939208984375, 1638.171875, 1637.458740234375, 1636.7696533203125, 1636.07763671875, 1635.3804931640625, 1634.6962890625, 1634.0045166015625, 1633.300537109375, 1632.5831298828125, 1631.8533935546875, 1631.1121826171875, 1630.3580322265625, 1629.591552734375, 1628.812255859375, 1628.01953125, 1627.213134765625, 1626.3935546875, 1625.560546875, 1624.7137451171875, 1623.8536376953125, 1622.97998046875, 1622.0928955078125, 1621.19189453125, 1620.2774658203125, 1619.3492431640625, 1618.40771484375, 1617.4525146484375, 1616.4833984375, 1615.5009765625, 1614.5050048828125, 1613.4954833984375, 1612.4720458984375, 1611.4351806640625, 1610.384765625, 1609.3209228515625, 1608.2435302734375, 1607.15234375, 1606.0477294921875, 1604.9295654296875, 1603.7977294921875, 1602.6527099609375, 1601.49365234375, 1600.321533203125, 1599.1356201171875, 1597.9364013671875, 1596.7235107421875, 1595.4970703125, 1594.25732421875, 1593.0040283203125, 1591.7371826171875, 1590.4569091796875, 1589.1629638671875, 1587.855712890625, 1586.534912109375, 1585.200927734375, 1583.85302734375, 1582.49169921875, 1581.1173095703125, 1579.72900390625, 1578.32763671875, 1576.912353515625, 1575.48388671875, 1574.0421142578125, 1572.5867919921875, 1571.1177978515625, 1569.6356201171875, 1568.139892578125, 1566.630859375, 1565.1082763671875, 1563.5723876953125, 1562.0228271484375, 1560.4598388671875, 1558.8837890625, 1557.2940673828125, 1555.69091796875, 1554.074462890625, 1552.4444580078125, 1550.8011474609375, 1549.14453125, 1547.4742431640625, 1545.7906494140625, 1544.09375, 1542.383056640625, 1540.6595458984375, 1538.9222412109375, 1537.171630859375, 1535.40771484375, 1533.634033203125, 1531.8543701171875, 1530.056640625, 1528.2454833984375, 1526.420654296875, 1524.586181640625, 1522.7442626953125, 1520.888427734375, 1519.01904296875, 1517.135009765625, 1515.2381591796875, 1513.3331298828125, 1511.417724609375, 1509.4898681640625, 1507.55126953125, 1505.59326171875, 1503.6201171875, 1501.6363525390625, 1499.6527099609375, 1497.652099609375, 1495.635498046875, 1493.610595703125, 1491.578125, 1489.540771484375, 1487.4959716796875, 1485.431640625, 1483.3448486328125, 1481.24853515625, 1479.1474609375, 1477.046630859375, 1474.9219970703125, 1472.7841796875, 1470.634521484375, 1468.4696044921875, 1466.28857421875, 1464.1060791015625, 1461.9119873046875, 1459.6954345703125, 1457.4730224609375, 1455.237060546875, 1452.9859619140625, 1450.7398681640625, 1448.483154296875, 1446.224365234375, 1443.95458984375, 1441.66455078125, 1439.358642578125, 1437.041015625, 1434.7135009765625, 1432.3753662109375, 1430.0401611328125, 1427.689453125, 1425.3310546875, 1422.9639892578125, 1420.57861328125, 1418.169189453125, 1415.7503662109375, 1413.3236083984375, 1410.8973388671875, 1408.480712890625, 1406.061767578125, 1403.6439208984375, 1401.207275390625, 1398.76611328125, 1396.3197021484375, 1393.845703125, 1391.3516845703125, 1388.8511962890625, 1386.3487548828125, 1383.8424072265625, 1381.3121337890625, 1378.7974853515625, 1376.29150390625, 1373.771484375, 1371.2393798828125, 1368.7056884765625, 1366.163818359375, 1363.6060791015625, 1361.0389404296875, 1358.43701171875, 1355.8162841796875, 1353.1988525390625, 1350.5823974609375, 1347.9630126953125, 1345.343017578125, 1342.717529296875, 1340.056640625, 1337.3905029296875, 1334.7137451171875, 1332.03125, 1329.341552734375, 1326.6492919921875, 1323.942626953125, 1321.2147216796875, 1318.4776611328125, 1315.7420654296875, 1312.9959716796875, 1310.2376708984375, 1307.4927978515625, 1304.7449951171875, 1301.984130859375, 1299.2142333984375, 1296.4267578125, 1293.642822265625, 1290.8477783203125, 1288.0565185546875, 1285.2564697265625, 1282.415283203125, 1279.570068359375, 1276.7052001953125, 1273.8338623046875, 1270.9608154296875, 1268.0750732421875, 1265.1978759765625, 1262.302734375, 1259.424072265625, 1256.54345703125, 1253.648193359375, 1250.7392578125, 1247.85400390625, 1244.9559326171875, 1242.0621337890625, 1239.14599609375, 1236.212890625, 1233.2791748046875, 1230.3221435546875, 1227.35693359375, 1224.3988037109375, 1221.4456787109375, 1218.494140625, 1215.5057373046875, 1212.509765625, 1209.530029296875, 1206.54150390625, 1203.5640869140625, 1200.5830078125, 1197.5706787109375, 1194.557373046875, 1191.5413818359375, 1188.5181884765625, 1185.53466796875, 1182.556396484375, 1179.5889892578125, 1176.59912109375, 1173.60107421875, 1170.60595703125, 1167.6107177734375, 1164.612548828125, 1161.5830078125, 1158.5411376953125, 1155.4888916015625, 1152.443115234375, 1149.391845703125, 1146.382080078125, 1143.3671875, 1140.357177734375, 1137.3319091796875, 1134.3507080078125, 1131.3895263671875, 1128.4107666015625, 1125.428466796875, 1122.4515380859375, 1119.4691162109375, 1116.45068359375, 1113.445556640625, 1110.4188232421875, 1107.3970947265625, 1104.4014892578125, 1101.4742431640625, 1098.5003662109375, 1095.5416259765625, 1092.5877685546875, 1089.6871337890625, 1086.8023681640625, 1083.909423828125, 1081.0025634765625, 1078.0682373046875, 1075.151123046875, 1072.2340087890625, 1069.286865234375, 1066.3470458984375, 1063.4437255859375, 1060.5277099609375, 1057.597900390625, 1054.7000732421875, 1051.8280029296875, 1048.95703125, 1046.130126953125, 1043.2506103515625, 1040.326171875, 1037.3966064453125, 1034.4638671875, 1031.559326171875, 1028.6920166015625, 1025.7569580078125, 1022.869384765625, 1020.0100708007812, 1017.1680297851562, 1014.313720703125, 1011.41552734375, 1008.55029296875, 1005.70751953125, 1002.9012451171875, 1000.0650024414062, 997.302001953125, 994.5440673828125, 991.7841796875, 989.088623046875, 986.398193359375, 983.7731323242188, 981.1068725585938, 978.4337768554688, 975.7896118164062, 973.1490478515625, 970.548095703125, 967.9996948242188, 965.497802734375, 963.0592041015625, 960.5482788085938, 958.0681762695312, 955.6573486328125, 953.269775390625, 950.816650390625, 948.3712768554688, 945.96435546875, 943.572998046875, 941.1910400390625, 938.8230590820312, 936.5032958984375, 934.22509765625, 931.9579467773438, 929.6876831054688, 927.46630859375, 925.2731323242188, 923.098388671875, 920.9649658203125, 918.8244018554688, 916.626953125, 914.4676513671875, 912.344970703125, 910.2354125976562, 908.1377563476562, 906.1246948242188, 904.0914306640625, 902.1450805664062, 900.16357421875, 898.1143188476562, 896.1460571289062, 894.2780151367188, 892.41748046875, 890.51220703125, 888.6063232421875, 886.7880249023438, 884.9671630859375, 883.211669921875, 881.4697265625, 879.759521484375, 878.0236206054688, 876.3259887695312, 874.5786743164062, 872.9247436523438, 871.3588256835938, 869.7965087890625, 868.3406982421875, 866.916748046875, 865.5155029296875, 864.1762084960938, 862.9248046875, 861.6978149414062, 860.418212890625, 859.1958618164062, 857.9618530273438, 856.7887573242188, 855.7172241210938, 854.7109985351562, 853.7260131835938, 852.7573852539062, 851.8906860351562, 851.0009155273438, 850.099365234375, 849.2725219726562, 848.4058227539062, 847.5846557617188, 846.7222290039062, 845.8991088867188, 845.146240234375, 844.4398193359375, 843.7061767578125, 842.970458984375, 842.1912841796875, 841.4857788085938, 840.8566284179688, 840.2586059570312, 839.7024536132812, 839.1321411132812, 838.5479125976562, 838.0750122070312, 837.6397094726562, 837.2547607421875, 836.8286743164062, 836.4146728515625, 835.9803466796875, 835.6128540039062, 835.25048828125, 834.99462890625, 834.7460327148438, 834.5050048828125, 834.2735595703125, 834.1484985351562, 833.9264526367188, 833.7525024414062, 833.5968017578125, 833.427001953125, 833.2980346679688, 833.1817626953125, 833.115966796875, 833.019775390625, 832.9463500976562, 832.8314208984375, 832.711181640625, 832.7017822265625, 832.5798950195312, 832.5702514648438, 832.4684448242188, 832.4631958007812, 832.3738403320312, 832.3876953125, 832.3067626953125, 832.26123046875, 832.2584228515625, 832.2164916992188, 832.1785278320312, 832.1791381835938, 832.1809692382812, 832.1094970703125, 832.1190185546875, 832.08154296875, 832.0925903320312, 832.067138671875, 832.0568237304688, 832.0745239257812, 832.0386352539062, 832.0298461914062, 832.0166625976562, 832.0784912109375, 832.0445556640625, 832.06591796875, 832.0335083007812, 832.0518188476562, 832.0743408203125, 832.03662109375, 832.0272827148438, 832.0475463867188, 832.0114135742188, 832.0458984375, 832.0623168945312, 832.0208129882812, 832.0148315429688, 832.0225219726562, 832.0516967773438, 832.007080078125, 832.0883178710938, 832.0642700195312, 831.9967041015625, 832.0435180664062, 832.0291748046875, 832.0162963867188, 832.0558471679688, 832.0935668945312, 832.0255126953125, 832.0195922851562, 831.9987182617188, 832.0218505859375, 832.0179443359375, 832.057861328125, 832.0350952148438, 832.0057983398438, 832.0341796875, 832.0252685546875, 832.0416870117188, 832.0897827148438, 832.0340576171875, 832.05419921875, 832.0866088867188, 832.0431518554688, 832.0501708984375, 832.0230712890625, 832.0335083007812, 832.0567626953125, 831.98779296875, 832.0159912109375, 832.0066528320312, 832.0739135742188, 832.0186767578125, 832.04931640625, 832.0161743164062, 832.0091552734375, 832.0492553710938, 832.042724609375, 831.9940185546875, 832.0188598632812, 832.0180053710938, 832.0752563476562, 832.0436401367188, 831.992431640625, 832.0143432617188, 831.986083984375, 831.983642578125, 832.0733032226562, 832, 832.0342407226562, 831.9940795898438, 832.021240234375, 832.05322265625, 832.0286865234375, 831.9974365234375, 832.1077880859375, 832.0183715820312, 832.0169067382812, 832.0206298828125, 831.9891967773438, 832.0033569335938, 832.0386352539062, 832.0056762695312, 832.0482788085938, 832.0166015625, 832.0277099609375, 832.0592041015625, 832.0184326171875, 832.0144653320312, 832.0175170898438, 832.0357666015625, 831.9884643554688, 832.0169677734375, 832.007568359375, 832.0416259765625, 832.0084228515625, 832.0613403320312, 831.9934692382812, 831.9971923828125, 832.0143432617188, 831.9970703125, 832.0121459960938, 831.9989624023438, 832.0308837890625, 832.0249633789062, 832.0260620117188, 832.0045776367188, 832.051513671875, 831.9813842773438, 831.9995727539062, 832.0433349609375, 832.011474609375, 832.0038452148438, 832.0195922851562, 832.0385131835938, 832.0032348632812, 832.0263671875, 831.98095703125, 832.0109252929688, 832.041015625, 832.0013427734375, 832.0162963867188, 831.9866943359375, 831.9817504882812, 832.0482788085938, 831.9822387695312, 832.0276489257812, 832.03466796875, 832.0245971679688, 832.011474609375, 832.010498046875, 831.9813842773438, 832.0407104492188, 831.9940795898438, 831.98291015625, 832.0531005859375, 832.0208740234375, 831.9993896484375, 831.9837646484375, 832.0128784179688, 832.045166015625, 832.0120239257812, 832.010986328125, 831.9900512695312, 832.0145874023438, 832.0756225585938, 832.0327758789062, 832.0029907226562, 832.0234985351562, 831.9825439453125, 832.0004272460938, 832.0313110351562, 831.979248046875, 832.011474609375, 832.0554809570312, 831.9854125976562, 831.988037109375, 832.0028686523438, 832.0354614257812, 832.0206909179688, 832.0276489257812, 831.9862060546875, 831.9852905273438, 832.0303955078125, 831.9880981445312, 832.0554809570312, 832.0317993164062, 832.0259399414062, 831.9881591796875, 832.0474853515625, 832.0283203125, 832.0132446289062, 831.9974975585938, 831.9905395507812, 832.0387573242188, 831.9949340820312, 832.01416015625, 832.046875, 832.009765625, 832.040771484375, 832.0188598632812, 832.0286865234375, 832.0032348632812, 832.0425415039062, 832.0048828125, 832.0528564453125, 831.9833374023438, 832.0463256835938, 832.0643920898438, 832.006591796875, 831.9945678710938, 832.0516967773438, 831.9844360351562, 832.0256958007812, 832.0042724609375, 832.0245971679688, 831.9901733398438, 832.001220703125, 831.9927368164062, 832.0379638671875, 832.1478881835938, 831.9937744140625, 832.0150146484375, 831.990478515625, 831.987060546875, 832.008056640625, 831.9912719726562, 832.0244140625, 832.0980224609375, 832.0114135742188, 832.0880737304688, 831.9796142578125, 832.001953125, 832.0038452148438, 832.008056640625, 831.99951171875, 832.0245971679688, 832.0074462890625, 831.98193359375, 832.0210571289062, 832.0553588867188, 832.010986328125, 831.9972534179688, 832.0257568359375, 832.008056640625, 832.0454711914062, 832.0215454101562, 832.0074462890625, 832.0342407226562, 832.0620727539062, 832.0178833007812, 832.0050048828125, 832.0234375, 832.0286254882812, 832.0472412109375, 831.98828125, 832.0661010742188, 832.0274047851562, 832.0111694335938, 831.9808959960938, 832.011474609375, 831.98486328125, 832.0043334960938, 832.0037231445312 ] }, { "name": "Validation loss", "type": "scatter", "x": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678 ], "y": [ 1436.8045654296875, 1434.563232421875, 1432.829833984375, 1431.3056640625, 1430.135986328125, 1429.23046875, 1428.4466552734375, 1427.72509765625, 1427.0277099609375, 1426.342041015625, 1425.6422119140625, 1424.953369140625, 1424.265869140625, 1423.5665283203125, 1422.8544921875, 1422.1292724609375, 1421.3927001953125, 1420.643310546875, 1419.881103515625, 1419.10693359375, 1418.3192138671875, 1417.517822265625, 1416.703369140625, 1415.8753662109375, 1415.033935546875, 1414.1785888671875, 1413.310302734375, 1412.427978515625, 1411.5323486328125, 1410.6229248046875, 1409.6998291015625, 1408.763427734375, 1407.813232421875, 1406.849365234375, 1405.8720703125, 1404.881103515625, 1403.87646484375, 1402.8582763671875, 1401.82666015625, 1400.781494140625, 1399.722412109375, 1398.6500244140625, 1397.5640869140625, 1396.464599609375, 1395.3514404296875, 1394.224853515625, 1393.0845947265625, 1391.930908203125, 1390.763916015625, 1389.5830078125, 1388.388916015625, 1387.1810302734375, 1385.9595947265625, 1384.7249755859375, 1383.476806640625, 1382.21484375, 1380.939697265625, 1379.65087890625, 1378.3486328125, 1377.0328369140625, 1375.703857421875, 1374.3609619140625, 1373.0050048828125, 1371.635498046875, 1370.2523193359375, 1368.8555908203125, 1367.44580078125, 1366.0223388671875, 1364.5855712890625, 1363.13525390625, 1361.6715087890625, 1360.194091796875, 1358.70361328125, 1357.1993408203125, 1355.6820068359375, 1354.151123046875, 1352.606689453125, 1351.0487060546875, 1349.477783203125, 1347.89306640625, 1346.294921875, 1344.683349609375, 1343.05859375, 1341.420166015625, 1339.7685546875, 1338.1031494140625, 1336.4248046875, 1334.73291015625, 1333.0274658203125, 1331.3087158203125, 1329.57666015625, 1327.8310546875, 1326.0718994140625, 1324.2998046875, 1322.521240234375, 1320.72314453125, 1318.91064453125, 1317.0850830078125, 1315.245849609375, 1313.3975830078125, 1311.5341796875, 1309.657470703125, 1307.7664794921875, 1305.86328125, 1303.9423828125, 1302.0133056640625, 1300.069091796875, 1298.1185302734375, 1296.1470947265625, 1294.15869140625, 1292.15771484375, 1290.1529541015625, 1288.1328125, 1286.094970703125, 1284.0400390625, 1281.979248046875, 1279.9024658203125, 1277.821533203125, 1275.72705078125, 1273.6007080078125, 1271.4676513671875, 1269.3203125, 1267.1788330078125, 1265.0107421875, 1262.82568359375, 1260.6314697265625, 1258.421142578125, 1256.189697265625, 1253.956787109375, 1251.71484375, 1249.438232421875, 1247.158935546875, 1244.870849609375, 1242.560302734375, 1240.2491455078125, 1237.925048828125, 1235.588134765625, 1233.2427978515625, 1230.86669921875, 1228.4830322265625, 1226.082275390625, 1223.6697998046875, 1221.24365234375, 1218.822998046875, 1216.3736572265625, 1213.91943359375, 1211.4453125, 1208.9649658203125, 1206.45263671875, 1203.92529296875, 1201.39794921875, 1198.848388671875, 1196.3055419921875, 1193.75146484375, 1191.18701171875, 1188.6015625, 1186.006103515625, 1183.412353515625, 1180.781005859375, 1178.1239013671875, 1175.458740234375, 1172.781494140625, 1170.108154296875, 1167.4000244140625, 1164.6864013671875, 1161.9779052734375, 1159.259521484375, 1156.5001220703125, 1153.742431640625, 1150.9783935546875, 1148.19189453125, 1145.404296875, 1142.5811767578125, 1139.7232666015625, 1136.856689453125, 1134.0028076171875, 1131.12744140625, 1128.252197265625, 1125.3818359375, 1122.466796875, 1119.54296875, 1116.6004638671875, 1113.6514892578125, 1110.682861328125, 1107.7041015625, 1104.7236328125, 1101.70703125, 1098.682861328125, 1095.658447265625, 1092.62890625, 1089.5748291015625, 1086.515380859375, 1083.448974609375, 1080.357177734375, 1077.2476806640625, 1074.1260986328125, 1070.99267578125, 1067.8436279296875, 1064.6959228515625, 1061.5555419921875, 1058.360595703125, 1055.1578369140625, 1051.94287109375, 1048.6964111328125, 1045.4677734375, 1042.1932373046875, 1038.9512939453125, 1035.6640625, 1032.3731689453125, 1029.0750732421875, 1025.7777099609375, 1022.416748046875, 1019.0946655273438, 1015.7284545898438, 1012.3743286132812, 1008.9910278320312, 1005.5800170898438, 1002.18505859375, 998.7565307617188, 995.3193969726562, 991.8642578125, 988.429931640625, 984.982421875, 981.5, 977.9876098632812, 974.475830078125, 970.9411010742188, 967.43505859375, 963.896240234375, 960.3255004882812, 956.730712890625, 953.1307373046875, 949.5228881835938, 945.931640625, 942.3193359375, 938.713623046875, 935.0592651367188, 931.393310546875, 927.7297973632812, 924.1497192382812, 920.586669921875, 916.9597778320312, 913.3410034179688, 909.6670532226562, 906.02099609375, 902.3395385742188, 898.7092895507812, 895.0552368164062, 891.4114379882812, 887.666259765625, 883.9655151367188, 880.2767333984375, 876.552734375, 872.8260498046875, 869.1881713867188, 865.5596923828125, 861.84912109375, 858.18408203125, 854.4406127929688, 850.7001953125, 846.962890625, 843.3184814453125, 839.572509765625, 835.8434448242188, 832.055908203125, 828.3123168945312, 824.5656127929688, 820.7783203125, 816.9906616210938, 813.1414184570312, 809.3156127929688, 805.4833374023438, 801.5960083007812, 797.6842651367188, 793.8344116210938, 789.9049072265625, 785.9763793945312, 782.0355834960938, 778.1691284179688, 774.2072143554688, 770.333984375, 766.4210205078125, 762.4197998046875, 758.3916015625, 754.3585205078125, 750.3516235351562, 746.5233764648438, 742.5545043945312, 738.5881958007812, 734.6636352539062, 730.7728881835938, 726.89599609375, 722.8829956054688, 718.907470703125, 714.9069213867188, 710.9773559570312, 706.9512329101562, 702.9927368164062, 699.037353515625, 695.2013549804688, 691.5460205078125, 687.8872680664062, 684.3223266601562, 680.7343139648438, 677.0084228515625, 673.3690795898438, 669.6256103515625, 665.8916625976562, 662.1491088867188, 658.5269775390625, 654.8968505859375, 651.2008056640625, 647.5708618164062, 644.050537109375, 640.6625366210938, 637.150390625, 633.5597534179688, 630.0529174804688, 626.5254516601562, 622.9810180664062, 619.5693359375, 616.1698608398438, 612.7879028320312, 609.4246826171875, 605.978515625, 602.566162109375, 599.1682739257812, 595.7454223632812, 592.35595703125, 588.991943359375, 585.4234619140625, 581.9613647460938, 578.4794921875, 575.1597290039062, 571.8734741210938, 568.8389282226562, 565.7266235351562, 562.7546997070312, 559.7324829101562, 556.5223388671875, 553.3998413085938, 550.3475952148438, 547.431884765625, 544.474365234375, 541.4801635742188, 538.7140502929688, 535.7982177734375, 533.011474609375, 530.123291015625, 527.353271484375, 524.4022216796875, 521.718994140625, 518.8814697265625, 516.0690307617188, 513.3765869140625, 510.68597412109375, 507.9865417480469, 505.4355163574219, 502.69561767578125, 500.0185852050781, 497.40093994140625, 494.93206787109375, 492.0680236816406, 489.57177734375, 486.9766845703125, 484.6625061035156, 482.3753967285156, 480.1435852050781, 477.8614807128906, 475.5838317871094, 473.535888671875, 471.41143798828125, 469.31671142578125, 467.311279296875, 465.33868408203125, 463.36492919921875, 461.2406311035156, 459.1555480957031, 457.17681884765625, 455.2568359375, 453.2158203125, 451.1854553222656, 448.93707275390625, 446.85321044921875, 444.78765869140625, 442.9986267089844, 441.3125915527344, 439.4715881347656, 437.47613525390625, 435.61199951171875, 434.03546142578125, 432.69073486328125, 431.1420593261719, 429.7345886230469, 428.0370178222656, 426.58349609375, 425.1056823730469, 423.9148254394531, 422.603271484375, 421.1981201171875, 420.16143798828125, 419.0063171386719, 418.0185241699219, 417.08984375, 416.17388916015625, 415.1962585449219, 414.006591796875, 413.00164794921875, 412.41571044921875, 411.7794189453125, 411.0560302734375, 410.11138916015625, 409.3819274902344, 408.4358825683594, 407.8576354980469, 407.3935852050781, 407.01995849609375, 406.6459655761719, 406.0783996582031, 405.6308898925781, 405.0395202636719, 404.6322326660156, 404.21331787109375, 404.04998779296875, 403.6232604980469, 403.2222595214844, 403.071533203125, 402.695556640625, 402.44281005859375, 402.2457580566406, 401.928466796875, 401.6356506347656, 401.2375183105469, 400.912353515625, 400.8343811035156, 400.8522644042969, 400.6451721191406, 400.711669921875, 400.6352844238281, 400.54718017578125, 400.5828857421875, 400.3390808105469, 400.22845458984375, 400.13360595703125, 400.2273864746094, 400.1240539550781, 400.1819152832031, 400.06390380859375, 400.0894470214844, 399.955078125, 399.9051513671875, 400.0111999511719, 400.1105041503906, 399.9862976074219, 399.95452880859375, 399.8091125488281, 399.7512512207031, 399.7057800292969, 399.5787048339844, 399.5765075683594, 399.54473876953125, 399.6027526855469, 399.55792236328125, 399.46124267578125, 399.4734802246094, 399.3368225097656, 399.39837646484375, 399.41015625, 399.23760986328125, 399.191650390625, 399.0815124511719, 399.0077819824219, 398.87786865234375, 398.97760009765625, 398.9997863769531, 398.8648986816406, 398.8035888671875, 398.85809326171875, 398.85198974609375, 398.8182678222656, 398.68548583984375, 398.59881591796875, 398.6612243652344, 398.6573181152344, 398.6917419433594, 398.6221923828125, 398.6451721191406, 398.6049499511719, 398.67254638671875, 398.6118469238281, 398.5579833984375, 398.5414733886719, 398.4448547363281, 398.349853515625, 398.27362060546875, 398.2110290527344, 398.192138671875, 398.17974853515625, 398.2427673339844, 398.1993713378906, 398.1187744140625, 398.10205078125, 398.1449890136719, 398.0750427246094, 398.1142272949219, 397.9967346191406, 398.0628356933594, 397.8909912109375, 397.8421630859375, 397.8862609863281, 397.8804626464844, 397.95257568359375, 397.8733825683594, 397.9087829589844, 397.937255859375, 397.9664306640625, 398.0802001953125, 398.1191101074219, 398.1634521484375, 398.12933349609375, 398.0494384765625, 398.00048828125, 397.9979248046875, 398.03497314453125, 398.0641784667969, 398.1524658203125, 398.1490783691406, 398.15130615234375, 398.193603515625, 398.2239990234375, 398.2186584472656, 398.1871032714844, 398.2137451171875, 398.1581726074219, 398.2169494628906, 398.27899169921875, 398.3432922363281, 398.2124328613281, 398.12689208984375, 398.0458068847656, 397.9154357910156, 397.7956848144531, 397.63311767578125, 397.68768310546875, 397.6787414550781, 397.61767578125, 397.7060546875, 397.70404052734375, 397.7098693847656, 397.6932678222656, 397.76617431640625, 397.8407897949219, 397.86517333984375, 397.77142333984375, 397.73077392578125, 397.8453369140625, 397.6856994628906, 397.57916259765625, 397.6943359375, 397.6393127441406, 397.75555419921875, 397.604248046875, 397.47723388671875, 397.4879455566406, 397.6089782714844, 397.523681640625, 397.4809265136719, 397.5741882324219, 397.61065673828125, 397.6289978027344, 397.47247314453125, 397.4418029785156, 397.38909912109375, 397.33953857421875, 397.3562927246094, 397.3058166503906, 397.27655029296875, 397.3642272949219, 397.22705078125, 397.32598876953125, 397.53973388671875, 397.4678649902344, 397.41064453125, 397.4725036621094, 397.489990234375, 397.5374450683594, 397.54437255859375, 397.6531066894531, 397.5548095703125, 397.7347106933594, 397.6288757324219, 397.5805969238281, 397.64263916015625, 397.6390075683594, 397.6213684082031, 397.75262451171875, 397.72882080078125, 397.753173828125, 397.6817932128906, 397.81219482421875, 397.8367614746094, 397.8811340332031, 397.8779602050781, 397.82940673828125, 397.7573547363281, 397.76763916015625, 397.8306579589844, 397.7704772949219, 397.8131103515625, 397.8250427246094, 397.7850036621094, 397.657958984375, 397.5557861328125, 397.5362854003906, 397.65069580078125, 397.73468017578125, 397.68975830078125, 397.58477783203125, 397.5927734375, 397.67559814453125, 397.6585388183594, 397.5849609375, 397.5707702636719, 397.62628173828125, 397.7349548339844, 397.7522888183594, 397.69720458984375, 397.6742248535156, 397.6400146484375, 397.5906677246094, 397.6784973144531, 397.58428955078125, 397.54296875, 397.6738586425781, 397.6702880859375, 397.8817138671875, 397.9079284667969, 397.8050842285156, 397.88897705078125, 397.7922668457031, 397.6504821777344, 397.60272216796875, 397.73541259765625, 397.6657409667969, 397.7467346191406, 397.6661682128906, 397.6749572753906, 397.6722412109375, 397.5815734863281, 397.47052001953125, 397.37109375, 397.3084411621094, 397.3289489746094, 397.3622131347656, 397.453857421875, 397.5346374511719, 397.6509704589844, 397.5188293457031, 397.63250732421875, 397.7434997558594, 397.8788146972656, 397.9465026855469, 397.8859558105469, 397.9781799316406, 398.02728271484375, 398.0621643066406, 397.9844970703125, 397.89642333984375, 397.8352966308594, 397.7736511230469, 397.6869812011719, 397.68231201171875, 397.7170104980469, 397.734375, 397.7690734863281, 397.72650146484375, 397.6861572265625, 397.66448974609375, 397.629638671875 ] } ], "layout": { "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Training of a LSTM model without scaling" }, "xaxis": { "title": { "text": "Epoch" } }, "yaxis": { "title": { "text": "Loss" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "visualize_loss(model_history, \n", " \"Training of a LSTM model without scaling\");" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The training seems to be quite successful, but we will see at the end of the notebook that it's not really the case..." ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "ExecuteTime": { "end_time": "2020-12-02T09:01:57.377966Z", "start_time": "2020-12-02T09:01:56.654679Z" } }, "outputs": [ { "data": { "text/plain": [ "614.4952618254333" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "preds_test = model.predict(x_test)\n", "mean_absolute_error(preds_test[:, 0], y_test)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## LSTM with scaling" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Scale features" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "ExecuteTime": { "end_time": "2020-12-02T09:01:57.384391Z", "start_time": "2020-12-02T09:01:57.380347Z" } }, "outputs": [ { "data": { "text/plain": [ "(1625.2317697228145, 1184.967031656248)" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "train_mean = np.mean(x_train)\n", "train_std = np.std(x_train)\n", "train_mean, train_std" ] }, { "cell_type": "code", "execution_count": 18, "metadata": { "ExecuteTime": { "end_time": "2020-12-02T09:01:57.389598Z", "start_time": "2020-12-02T09:01:57.386700Z" } }, "outputs": [], "source": [ "x_train_scaled = (x_train - train_mean) / train_std\n", "y_train_scaled = (y_train - train_mean) / train_std\n", "x_test_scaled = (x_test - train_mean) / train_std\n", "y_test_scaled = (y_test - train_mean) / train_std" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Train models" ] }, { "cell_type": "code", "execution_count": 19, "metadata": { "ExecuteTime": { "end_time": "2020-12-02T09:02:44.437606Z", "start_time": "2020-12-02T09:01:57.391521Z" } }, "outputs": [], "source": [ "model_scaled = get_model(x_train)\n", "early_stopping = tf.keras.callbacks.EarlyStopping(patience=100,\n", " restore_best_weights=True)\n", "\n", "scaled_model_history = model_scaled.fit(x_train_scaled, y_train_scaled, \n", " validation_split=0.1,\n", " batch_size=128, epochs=1000,\n", " callbacks=early_stopping, verbose=0)" ] }, { "cell_type": "code", "execution_count": 20, "metadata": { "ExecuteTime": { "end_time": "2020-12-02T09:02:44.464462Z", "start_time": "2020-12-02T09:02:44.439502Z" } }, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "name": "Training loss", "type": "scatter", "x": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385 ], "y": [ 0.5473521947860718, 0.4647213816642761, 0.46682804822921753, 0.4665496051311493, 0.4736170768737793, 0.45963793992996216, 0.46627533435821533, 0.4628405272960663, 0.4590873122215271, 0.4585229754447937, 0.46060630679130554, 0.46067652106285095, 0.4567939043045044, 0.458782434463501, 0.45805639028549194, 0.4544559419155121, 0.4455224275588989, 0.4286387264728546, 0.41320160031318665, 0.38980162143707275, 0.3726208806037903, 0.3444393575191498, 0.3413386344909668, 0.3366575241088867, 0.3344820737838745, 0.3079340159893036, 0.3069028854370117, 0.32059645652770996, 0.30782368779182434, 0.2972709834575653, 0.30327385663986206, 0.29858458042144775, 0.2973059117794037, 0.32206180691719055, 0.28389519453048706, 0.2962380349636078, 0.2849155068397522, 0.2930891513824463, 0.2801680564880371, 0.2874702513217926, 0.2785595655441284, 0.26944515109062195, 0.288487046957016, 0.29756537079811096, 0.26601442694664, 0.2862345576286316, 0.2753521203994751, 0.28659310936927795, 0.26049086451530457, 0.2610521614551544, 0.2726249694824219, 0.26513299345970154, 0.2809578478336334, 0.2545022666454315, 0.26955118775367737, 0.25618892908096313, 0.27250880002975464, 0.2504390776157379, 0.26127347350120544, 0.24871811270713806, 0.26380860805511475, 0.25786706805229187, 0.2593430280685425, 0.2561800181865692, 0.24768885970115662, 0.26051247119903564, 0.24724726378917694, 0.23997175693511963, 0.2598428428173065, 0.23613975942134857, 0.2760326564311981, 0.2387370467185974, 0.2327190786600113, 0.25389453768730164, 0.23282361030578613, 0.25000283122062683, 0.23775364458560944, 0.23475107550621033, 0.2456924170255661, 0.23053039610385895, 0.2457711100578308, 0.23140011727809906, 0.2455199956893921, 0.22856749594211578, 0.21976777911186218, 0.24119839072227478, 0.22089757025241852, 0.22190216183662415, 0.2410184144973755, 0.21227511763572693, 0.23130515217781067, 0.22969411313533783, 0.22332651913166046, 0.2194623053073883, 0.20940738916397095, 0.21977633237838745, 0.22644376754760742, 0.21099622547626495, 0.213974729180336, 0.20818369090557098, 0.2116023302078247, 0.20001477003097534, 0.22135105729103088, 0.2028052806854248, 0.21218813955783844, 0.20726580917835236, 0.2284422665834427, 0.20597335696220398, 0.19945383071899414, 0.22516192495822906, 0.2128945291042328, 0.19652746617794037, 0.20113518834114075, 0.20271606743335724, 0.2010374814271927, 0.20051145553588867, 0.20625147223472595, 0.19311317801475525, 0.20143353939056396, 0.2055729180574417, 0.18962068855762482, 0.19561119377613068, 0.19406746327877045, 0.19699636101722717, 0.1922261267900467, 0.18888330459594727, 0.18173369765281677, 0.20985253155231476, 0.19507843255996704, 0.1812639832496643, 0.1873893290758133, 0.1845293790102005, 0.20058777928352356, 0.18494044244289398, 0.19495517015457153, 0.19790449738502502, 0.18305067718029022, 0.18640072643756866, 0.19360511004924774, 0.17888206243515015, 0.1810910850763321, 0.18855293095111847, 0.17718200385570526, 0.18789814412593842, 0.1835111528635025, 0.1823548525571823, 0.17424161732196808, 0.1742165982723236, 0.18192490935325623, 0.18081898987293243, 0.18069520592689514, 0.17340843379497528, 0.18110166490077972, 0.17887765169143677, 0.18026158213615417, 0.1843274086713791, 0.17339317500591278, 0.1742718517780304, 0.169372096657753, 0.17505596578121185, 0.18361124396324158, 0.1729329228401184, 0.18349920213222504, 0.16692571341991425, 0.17426855862140656, 0.1813805103302002, 0.17190168797969818, 0.16720563173294067, 0.17174725234508514, 0.1822497844696045, 0.16699525713920593, 0.16438952088356018, 0.17662814259529114, 0.16908913850784302, 0.1692231148481369, 0.16716451942920685, 0.1650519222021103, 0.16519831120967865, 0.1791907101869583, 0.16795025765895844, 0.16594280302524567, 0.16389644145965576, 0.16758576035499573, 0.16840380430221558, 0.1711844503879547, 0.16018564999103546, 0.1639946848154068, 0.16792398691177368, 0.17004144191741943, 0.16482344269752502, 0.1649187058210373, 0.1672748476266861, 0.16838371753692627, 0.16706214845180511, 0.162840336561203, 0.17081846296787262, 0.15322624146938324, 0.16145022213459015, 0.15874497592449188, 0.16242021322250366, 0.16178956627845764, 0.15188007056713104, 0.1617605835199356, 0.15495245158672333, 0.15515762567520142, 0.16376642882823944, 0.1564694195985794, 0.1633497029542923, 0.1623564511537552, 0.16025172173976898, 0.1614694595336914, 0.15497177839279175, 0.1518578976392746, 0.16109298169612885, 0.15808764100074768, 0.1526854932308197, 0.15089216828346252, 0.15516796708106995, 0.15525443851947784, 0.15830311179161072, 0.15698334574699402, 0.1558632105588913, 0.15609368681907654, 0.15555022656917572, 0.15620027482509613, 0.14687570929527283, 0.14967434108257294, 0.15066100656986237, 0.15795376896858215, 0.15246376395225525, 0.14985719323158264, 0.14920125901699066, 0.14579106867313385, 0.15426379442214966, 0.15605032444000244, 0.14286836981773376, 0.14979758858680725, 0.1509278267621994, 0.1540321558713913, 0.153702512383461, 0.1456332951784134, 0.15039248764514923, 0.15091030299663544, 0.14379087090492249, 0.1420215666294098, 0.15202288329601288, 0.14560292661190033, 0.14189651608467102, 0.15180891752243042, 0.14131096005439758, 0.1406891644001007, 0.14719705283641815, 0.141163632273674, 0.14859750866889954, 0.14237873256206512, 0.14433680474758148, 0.15151560306549072, 0.14557300508022308, 0.14038316905498505, 0.14673449099063873, 0.14536617696285248, 0.14486421644687653, 0.1393643170595169, 0.14426694810390472, 0.14498943090438843, 0.14030319452285767, 0.14278189837932587, 0.14058628678321838, 0.1408856213092804, 0.1463117152452469, 0.14000460505485535, 0.13869383931159973, 0.14298999309539795, 0.13490909337997437, 0.13879694044589996, 0.1360074281692505, 0.14067690074443817, 0.13600070774555206, 0.13724149763584137, 0.13767097890377045, 0.1398855745792389, 0.13468843698501587, 0.13670670986175537, 0.13729038834571838, 0.1356823742389679, 0.13127951323986053, 0.13104206323623657, 0.1404857039451599, 0.13427422940731049, 0.13390854001045227, 0.13153816759586334, 0.13962969183921814, 0.1361309289932251, 0.1332617998123169, 0.13380998373031616, 0.1363210529088974, 0.13107715547084808, 0.1355751007795334, 0.13766206800937653, 0.13038234412670135, 0.13367798924446106, 0.12996450066566467, 0.13107530772686005, 0.1298055648803711, 0.1378200501203537, 0.13209018111228943, 0.1299457848072052, 0.12982088327407837, 0.13286085426807404, 0.12407734990119934, 0.13380584120750427, 0.13161323964595795, 0.12935331463813782, 0.13033142685890198, 0.12397050112485886, 0.13022106885910034, 0.12633050978183746, 0.12932032346725464, 0.12561044096946716, 0.12574218213558197, 0.12143243104219437, 0.12609541416168213, 0.12831030786037445, 0.12676259875297546, 0.12683071196079254, 0.13471393287181854, 0.12590524554252625, 0.12496786564588547, 0.1235210970044136, 0.12531335651874542, 0.12485606968402863, 0.12925375998020172, 0.12120021879673004, 0.12409846484661102, 0.12352930754423141, 0.12726131081581116, 0.12296980619430542, 0.12089141458272934, 0.12680748105049133, 0.11928600072860718, 0.12430545687675476, 0.1216154620051384, 0.1237359493970871, 0.1223006397485733, 0.11929083615541458, 0.12462915480136871, 0.12099498510360718, 0.12051605433225632, 0.11938703060150146, 0.1179918646812439, 0.11896016448736191, 0.12285248190164566, 0.12003213912248611, 0.11467045545578003, 0.11714334040880203, 0.12744037806987762, 0.11944293230772018, 0.11738796532154083, 0.12708760797977448, 0.11882229149341583, 0.11480027437210083, 0.11929070949554443, 0.1202724352478981, 0.11201406270265579, 0.11778542399406433, 0.12283939123153687, 0.122224822640419, 0.1226714551448822, 0.11681266129016876, 0.1173044741153717, 0.11639951914548874, 0.11824905872344971, 0.11891277879476547, 0.12045447528362274, 0.11082612723112106, 0.1118495911359787, 0.11890576779842377, 0.12046574801206589, 0.11410292237997055, 0.11734216660261154, 0.11407046765089035, 0.11894534528255463, 0.11467192322015762, 0.1141129806637764, 0.11559180170297623, 0.11656288802623749 ] }, { "name": "Validation loss", "type": "scatter", "x": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385 ], "y": [ 0.3379972279071808, 0.3442627489566803, 0.34122446179389954, 0.34768134355545044, 0.33515113592147827, 0.3336624503135681, 0.3350803852081299, 0.33369210362434387, 0.3307628333568573, 0.33710718154907227, 0.32735347747802734, 0.327792763710022, 0.33085039258003235, 0.32517683506011963, 0.3271578848361969, 0.3269863426685333, 0.3354651927947998, 0.3205145299434662, 0.30081844329833984, 0.28811967372894287, 0.26483991742134094, 0.25755056738853455, 0.24299640953540802, 0.2499648928642273, 0.23713114857673645, 0.24017974734306335, 0.2390250563621521, 0.23186138272285461, 0.23815849423408508, 0.23878058791160583, 0.23150058090686798, 0.2351292371749878, 0.248443603515625, 0.22139546275138855, 0.23170118033885956, 0.22435104846954346, 0.22147083282470703, 0.228770449757576, 0.2256760597229004, 0.23146669566631317, 0.2243468463420868, 0.23683597147464752, 0.22042831778526306, 0.21476756036281586, 0.21953913569450378, 0.21912948787212372, 0.21561117470264435, 0.2173817753791809, 0.2120407670736313, 0.2089124470949173, 0.21060222387313843, 0.22987054288387299, 0.20481076836585999, 0.2268281877040863, 0.20867568254470825, 0.23891055583953857, 0.20752732455730438, 0.21374855935573578, 0.21003127098083496, 0.20453909039497375, 0.21498870849609375, 0.23260793089866638, 0.1998203694820404, 0.20105423033237457, 0.20042455196380615, 0.2006978690624237, 0.19454988837242126, 0.2234557569026947, 0.20496447384357452, 0.2004842907190323, 0.19478455185890198, 0.19706331193447113, 0.19239678978919983, 0.2006562352180481, 0.19464293122291565, 0.1967693269252777, 0.19925722479820251, 0.1966133862733841, 0.19051454961299896, 0.1885552555322647, 0.19681993126869202, 0.19270095229148865, 0.19041816890239716, 0.18313582241535187, 0.18875402212142944, 0.18576376140117645, 0.18697421252727509, 0.19244855642318726, 0.180472731590271, 0.18869954347610474, 0.18542495369911194, 0.18129315972328186, 0.19182124733924866, 0.18289566040039062, 0.18565744161605835, 0.18549899756908417, 0.19136933982372284, 0.18389053642749786, 0.18633145093917847, 0.1841430813074112, 0.17461924254894257, 0.17895810306072235, 0.17644138634204865, 0.19578950107097626, 0.17777001857757568, 0.19233620166778564, 0.18085460364818573, 0.17898520827293396, 0.18670961260795593, 0.18148066103458405, 0.17936402559280396, 0.17760419845581055, 0.17973919212818146, 0.17436063289642334, 0.18044109642505646, 0.18366914987564087, 0.18317203223705292, 0.1798822432756424, 0.18975500762462616, 0.1789674162864685, 0.17340688407421112, 0.18350668251514435, 0.18123003840446472, 0.1752251386642456, 0.18197092413902283, 0.18342837691307068, 0.20411059260368347, 0.18227779865264893, 0.18213443458080292, 0.1833306849002838, 0.16959436237812042, 0.1657482087612152, 0.17460551857948303, 0.17399273812770844, 0.17405644059181213, 0.178449347615242, 0.17768141627311707, 0.1843765377998352, 0.19677726924419403, 0.1755337417125702, 0.17351487278938293, 0.1740032136440277, 0.17968663573265076, 0.17443716526031494, 0.18142861127853394, 0.1738109439611435, 0.18290965259075165, 0.17599962651729584, 0.16835032403469086, 0.16740240156650543, 0.168141171336174, 0.17683392763137817, 0.17021967470645905, 0.18487676978111267, 0.19782938063144684, 0.16758833825588226, 0.1773715764284134, 0.17178215086460114, 0.18898692727088928, 0.17621614038944244, 0.1742958277463913, 0.17931883037090302, 0.17007099092006683, 0.17412979900836945, 0.18130457401275635, 0.1712600588798523, 0.17033196985721588, 0.16555649042129517, 0.16464154422283173, 0.17475728690624237, 0.1775946170091629, 0.1880428045988083, 0.1797913759946823, 0.176592156291008, 0.1818876415491104, 0.17013347148895264, 0.16933833062648773, 0.1798514425754547, 0.1744258850812912, 0.1829141229391098, 0.18613770604133606, 0.1889668107032776, 0.17586204409599304, 0.18256372213363647, 0.16473525762557983, 0.1738934963941574, 0.1765882521867752, 0.17948657274246216, 0.20174020528793335, 0.1832030713558197, 0.15208716690540314, 0.1798199713230133, 0.1808803826570511, 0.20825126767158508, 0.1894184798002243, 0.17073145508766174, 0.16709697246551514, 0.16810153424739838, 0.16142742335796356, 0.16361016035079956, 0.17487920820713043, 0.1568017452955246, 0.1997755765914917, 0.16457045078277588, 0.1935400813817978, 0.17449088394641876, 0.1737140715122223, 0.1713414192199707, 0.1819257140159607, 0.18008746206760406, 0.19368483126163483, 0.19273172318935394, 0.18432044982910156, 0.16576236486434937, 0.15831778943538666, 0.18254365026950836, 0.17729738354682922, 0.1633273810148239, 0.18113981187343597, 0.17561833560466766, 0.16724170744419098, 0.16296829283237457, 0.1846669763326645, 0.18049344420433044, 0.1932908296585083, 0.18460938334465027, 0.1923295557498932, 0.18282975256443024, 0.172371968626976, 0.16220103204250336, 0.16858646273612976, 0.16880559921264648, 0.1975795477628708, 0.184403195977211, 0.16909700632095337, 0.18650275468826294, 0.16591310501098633, 0.179096981883049, 0.15923181176185608, 0.16827218234539032, 0.17206436395645142, 0.1911204755306244, 0.16690842807292938, 0.16301366686820984, 0.19884465634822845, 0.2004016488790512, 0.17013952136039734, 0.17632673680782318, 0.16531792283058167, 0.19302672147750854, 0.17742176353931427, 0.1788254678249359, 0.20059894025325775, 0.17837224900722504, 0.17069196701049805, 0.183074489235878, 0.1561480313539505, 0.1680249720811844, 0.1744862198829651, 0.1783398687839508, 0.191543847322464, 0.17767833173274994, 0.15708936750888824, 0.17770494520664215, 0.17015594244003296, 0.1583486795425415, 0.1705208271741867, 0.16047927737236023, 0.1721138209104538, 0.17544080317020416, 0.17108245193958282, 0.17907963693141937, 0.1613246202468872, 0.18087099492549896, 0.2223038673400879, 0.18014271557331085, 0.16698887944221497, 0.16027279198169708, 0.19172725081443787, 0.16464872658252716, 0.17200687527656555, 0.16391637921333313, 0.18618303537368774, 0.19273169338703156, 0.19425229728221893, 0.15100719034671783, 0.1553417295217514, 0.1692827045917511, 0.1636800765991211, 0.15439815819263458, 0.17003269493579865, 0.1577092558145523, 0.16032429039478302, 0.17473943531513214, 0.18890050053596497, 0.17718999087810516, 0.17394278943538666, 0.17013315856456757, 0.1794411838054657, 0.17815496027469635, 0.17022836208343506, 0.1906072497367859, 0.19499747455120087, 0.15690182149410248, 0.15777359902858734, 0.1865783929824829, 0.17992976307868958, 0.16893693804740906, 0.16499821841716766, 0.16428540647029877, 0.18033860623836517, 0.20130056142807007, 0.1865464597940445, 0.1881287842988968, 0.15500880777835846, 0.1708270013332367, 0.1675022393465042, 0.18937475979328156, 0.16813473403453827, 0.16347244381904602, 0.1690548211336136, 0.1611233800649643, 0.1695811152458191, 0.16767524182796478, 0.18660520017147064, 0.1703892946243286, 0.17708776891231537, 0.16459278762340546, 0.16378876566886902, 0.16038314998149872, 0.16861367225646973, 0.1725669652223587, 0.16227228939533234, 0.15673884749412537, 0.16407410800457, 0.17141200602054596, 0.16224011778831482, 0.18809039890766144, 0.16168241202831268, 0.21673427522182465, 0.15724866092205048, 0.16759024560451508, 0.15903837978839874, 0.1833968460559845, 0.17437580227851868, 0.20040591061115265, 0.15704084932804108, 0.17826582491397858, 0.18683326244354248, 0.1663532555103302, 0.18590392172336578, 0.16660195589065552, 0.1723962426185608, 0.16352541744709015, 0.16245846450328827, 0.16599999368190765, 0.1664683073759079, 0.17492005228996277, 0.17525233328342438, 0.1726023107767105, 0.1810966432094574, 0.16871309280395508, 0.16898734867572784, 0.1678953617811203, 0.18428058922290802, 0.16827188432216644, 0.17320464551448822, 0.17739368975162506, 0.17074285447597504, 0.16931182146072388, 0.1779540479183197, 0.1653497815132141, 0.16308726370334625, 0.18553492426872253, 0.17404255270957947, 0.16427546739578247, 0.1931009143590927, 0.19979210197925568, 0.1871960461139679, 0.1697331964969635, 0.17926564812660217, 0.16760718822479248, 0.16582219302654266, 0.1661262810230255, 0.17830617725849152, 0.18006587028503418 ] } ], "layout": { "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Training of a LSTM model with scaling" }, "xaxis": { "title": { "text": "Epoch" } }, "yaxis": { "title": { "text": "Loss" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "visualize_loss(scaled_model_history, \n", " \"Training of a LSTM model with scaling\");" ] }, { "cell_type": "code", "execution_count": 21, "metadata": { "ExecuteTime": { "end_time": "2020-12-02T09:02:45.191735Z", "start_time": "2020-12-02T09:02:44.466279Z" } }, "outputs": [ { "data": { "text/plain": [ "143.87561548056723" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "preds_scaled_test = model_scaled.predict(x_test_scaled)\n", "unscaled_preds_scaled_test = (preds_scaled_test[:, 0] * train_std) + train_mean\n", "mean_absolute_error(unscaled_preds_scaled_test, y_test)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Visualize results" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Visualize global predictions vs reality" ] }, { "cell_type": "code", "execution_count": 22, "metadata": { "ExecuteTime": { "end_time": "2020-12-02T09:02:45.214545Z", "start_time": "2020-12-02T09:02:45.200226Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
predictionsrealitymodel
01307.7530521592.0model_without_scaling
11307.7530521570.0model_without_scaling
21307.7530521732.0model_without_scaling
31307.7530521445.0model_without_scaling
41307.7530521180.0model_without_scaling
\n", "
" ], "text/plain": [ " predictions reality model\n", "0 1307.753052 1592.0 model_without_scaling\n", "1 1307.753052 1570.0 model_without_scaling\n", "2 1307.753052 1732.0 model_without_scaling\n", "3 1307.753052 1445.0 model_without_scaling\n", "4 1307.753052 1180.0 model_without_scaling" ] }, "execution_count": 22, "metadata": {}, "output_type": "execute_result" } ], "source": [ "preds_without_scaling_vs_real = pd.DataFrame({\"predictions\": preds_test[:, 0],\n", " \"reality\": y_test})\n", "preds_with_scaling_vs_real = pd.DataFrame({\"predictions\": unscaled_preds_scaled_test,\n", " \"reality\": y_test})\n", "\n", "preds_vs_real = pd.concat([preds_without_scaling_vs_real.assign(model=\"model_without_scaling\"),\n", " preds_with_scaling_vs_real.assign(model=\"model_with_scaling\")])\n", "preds_vs_real.head()" ] }, { "cell_type": "code", "execution_count": 23, "metadata": { "ExecuteTime": { "end_time": "2020-12-02T09:02:46.309926Z", "start_time": "2020-12-02T09:02:45.219869Z" } }, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "hovertemplate": "model=model_without_scaling
predictions=%{x}
reality=%{y}", "legendgroup": "model_without_scaling", "marker": { "color": "#636efa", "symbol": "circle" }, "mode": "markers", "name": "model_without_scaling", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125 ], "xaxis": "x", "y": [ 1592, 1570, 1732, 1445, 1180, 727, 1045, 1406, 1431, 1444, 1275, 857, 720, 906, 1237, 1402, 1288, 1209, 946, 626, 779, 1156, 1158, 1480, 1209, 835, 559, 731, 975, 1200, 1190, 996, 724, 528, 513, 776, 974, 902, 863, 696, 455, 569, 785, 869, 915, 820, 596, 434, 421, 691, 899, 923, 824, 644, 522, 492, 831, 792, 829, 832, 571, 460, 525, 709, 792, 678, 623, 528, 392, 428, 650, 735, 708, 760, 602, 466, 696, 690, 766, 745, 899, 600, 412, 451, 669, 804, 927, 1041, 710, 753, 859, 1141, 1150, 1323, 1319, 841, 676, 948, 1687, 2844, 3333, 3442, 2133, 1413, 1834, 3182, 4206, 4177, 3702, 2155, 1274, 1715, 2758, 3151, 2991, 2637, 1527, 931, 1146 ], "yaxis": "y" }, { "hovertemplate": "OLS trendline
reality = 0.878471
R2=-0.000000

model=model_without_scaling
predictions=%{x}
reality=%{y} (trend)", "legendgroup": "model_without_scaling", "marker": { "color": "#636efa", "symbol": "circle" }, "mode": "lines", "name": "model_without_scaling", "showlegend": false, "type": "scatter", "x": [ 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125 ], "xaxis": "x", "y": [ 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345, 1148.8234776798345 ], "yaxis": "y" }, { "hovertemplate": "model=model_with_scaling
predictions=%{x}
reality=%{y}", "legendgroup": "model_with_scaling", "marker": { "color": "#EF553B", "symbol": "circle" }, "mode": "markers", "name": "model_with_scaling", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ 1298.6376953125, 1428.196044921875, 1371.885986328125, 1245.27734375, 978.9600830078125, 935.4655151367188, 1189.863525390625, 1497.5538330078125, 1559.4517822265625, 1473.177490234375, 1284.1328125, 930.8521118164062, 655.8539428710938, 868.30908203125, 1190.1456298828125, 1265.923583984375, 1230.648193359375, 1029.105224609375, 828.332275390625, 752.0112915039062, 973.4526977539062, 1175.7510986328125, 1247.0079345703125, 1142.679443359375, 1166.8980712890625, 875.3262329101562, 645.1436767578125, 844.2913818359375, 1122.3646240234375, 1123.39501953125, 1138.61474609375, 1057.384521484375, 767.9412841796875, 548.420166015625, 673.7410278320312, 854.70947265625, 883.5269165039062, 908.1676635742188, 824.7467041015625, 683.5916137695312, 522.7337646484375, 552.11767578125, 849.1585083007812, 968.6854858398438, 886.7357177734375, 815.1243896484375, 627.0986938476562, 434.203857421875, 481.3956298828125, 610.6476440429688, 739.275146484375, 848.458984375, 824.5042114257812, 632.7233276367188, 476.7071533203125, 608.2882080078125, 752.1546020507812, 986.668212890625, 813.692626953125, 790.1591796875, 670.841796875, 408.256591796875, 442.767333984375, 644.5447387695312, 763.4888305664062, 760.1898803710938, 607.75244140625, 491.0633544921875, 401.64794921875, 400.578125, 508.704345703125, 636.7146606445312, 677.39697265625, 607.305908203125, 583.896728515625, 462.8212890625, 520.9505615234375, 860.1019897460938, 752.2635498046875, 763.0933227539062, 668.1936645507812, 728.2044677734375, 422.974609375, 393.279296875, 511.5819091796875, 660.1094970703125, 748.3004150390625, 811.1207275390625, 795.5039672851562, 491.4808349609375, 809.6616821289062, 1122.664306640625, 1459.888427734375, 1241.063720703125, 1272.6363525390625, 1014.7734985351562, 560.4417724609375, 719.0269165039062, 1081.430908203125, 1697.310302734375, 2777.19775390625, 2678.25439453125, 2289.849365234375, 1612.2020263671875, 2467.042236328125, 3254.567138671875, 4725.38671875, 4796.7626953125, 3539.673583984375, 2498.184326171875, 1651.4481201171875, 1705.0609130859375, 2638.606689453125, 3097.59912109375, 3303.59716796875, 2359.6103515625, 1768.4586181640625, 1135.5738525390625, 1515.2939453125 ], "xaxis": "x", "y": [ 1592, 1570, 1732, 1445, 1180, 727, 1045, 1406, 1431, 1444, 1275, 857, 720, 906, 1237, 1402, 1288, 1209, 946, 626, 779, 1156, 1158, 1480, 1209, 835, 559, 731, 975, 1200, 1190, 996, 724, 528, 513, 776, 974, 902, 863, 696, 455, 569, 785, 869, 915, 820, 596, 434, 421, 691, 899, 923, 824, 644, 522, 492, 831, 792, 829, 832, 571, 460, 525, 709, 792, 678, 623, 528, 392, 428, 650, 735, 708, 760, 602, 466, 696, 690, 766, 745, 899, 600, 412, 451, 669, 804, 927, 1041, 710, 753, 859, 1141, 1150, 1323, 1319, 841, 676, 948, 1687, 2844, 3333, 3442, 2133, 1413, 1834, 3182, 4206, 4177, 3702, 2155, 1274, 1715, 2758, 3151, 2991, 2637, 1527, 931, 1146 ], "yaxis": "y" }, { "hovertemplate": "OLS trendline
reality = 0.945515 * predictions + 77.1349
R2=0.924227

model=model_with_scaling
predictions=%{x}
reality=%{y} (trend)", "legendgroup": "model_with_scaling", "marker": { "color": "#EF553B", "symbol": "circle" }, "mode": "lines", "name": "model_with_scaling", "showlegend": false, "type": "scatter", "x": [ 393.279296875, 400.578125, 401.64794921875, 408.256591796875, 422.974609375, 434.203857421875, 442.767333984375, 462.8212890625, 476.7071533203125, 481.3956298828125, 491.0633544921875, 491.4808349609375, 508.704345703125, 511.5819091796875, 520.9505615234375, 522.7337646484375, 548.420166015625, 552.11767578125, 560.4417724609375, 583.896728515625, 607.305908203125, 607.75244140625, 608.2882080078125, 610.6476440429688, 627.0986938476562, 632.7233276367188, 636.7146606445312, 644.5447387695312, 645.1436767578125, 655.8539428710938, 660.1094970703125, 668.1936645507812, 670.841796875, 673.7410278320312, 677.39697265625, 683.5916137695312, 719.0269165039062, 728.2044677734375, 739.275146484375, 748.3004150390625, 752.0112915039062, 752.1546020507812, 752.2635498046875, 760.1898803710938, 763.0933227539062, 763.4888305664062, 767.9412841796875, 790.1591796875, 795.5039672851562, 809.6616821289062, 811.1207275390625, 813.692626953125, 815.1243896484375, 824.5042114257812, 824.7467041015625, 828.332275390625, 844.2913818359375, 848.458984375, 849.1585083007812, 854.70947265625, 860.1019897460938, 868.30908203125, 875.3262329101562, 883.5269165039062, 886.7357177734375, 908.1676635742188, 930.8521118164062, 935.4655151367188, 968.6854858398438, 973.4526977539062, 978.9600830078125, 986.668212890625, 1014.7734985351562, 1029.105224609375, 1057.384521484375, 1081.430908203125, 1122.3646240234375, 1122.664306640625, 1123.39501953125, 1135.5738525390625, 1138.61474609375, 1142.679443359375, 1166.8980712890625, 1175.7510986328125, 1189.863525390625, 1190.1456298828125, 1230.648193359375, 1241.063720703125, 1245.27734375, 1247.0079345703125, 1265.923583984375, 1272.6363525390625, 1284.1328125, 1298.6376953125, 1371.885986328125, 1428.196044921875, 1459.888427734375, 1473.177490234375, 1497.5538330078125, 1515.2939453125, 1559.4517822265625, 1612.2020263671875, 1651.4481201171875, 1697.310302734375, 1705.0609130859375, 1768.4586181640625, 2289.849365234375, 2359.6103515625, 2467.042236328125, 2498.184326171875, 2638.606689453125, 2678.25439453125, 2777.19775390625, 3097.59912109375, 3254.567138671875, 3303.59716796875, 3539.673583984375, 4725.38671875, 4796.7626953125 ], "xaxis": "x", "y": [ 448.9864267709909, 455.88757847857136, 456.8991133589105, 463.1476842571074, 477.0637911172723, 487.68121394273936, 495.778109758069, 514.739425733864, 527.8687191208121, 532.3017441874556, 541.4427231300727, 541.8374571888085, 558.1225454979647, 560.8433250203555, 569.7015266401941, 571.3875719998464, 595.6744506084262, 599.170501672492, 607.0410602102834, 629.2180737329893, 651.3518050124128, 651.7740088682185, 652.280584243596, 654.5114664816874, 670.0661813628672, 675.3843571594653, 679.1582225157463, 686.5616790840338, 687.127983955141, 697.2547015611008, 701.2783920256081, 708.9220938989417, 711.4259428180012, 714.1672092688791, 717.6239600560443, 723.481086345995, 756.9856977419461, 765.663210423495, 776.1307035582317, 784.6642306437943, 788.1729201228984, 788.3084223992014, 788.4114341382135, 795.9058988367094, 798.6511472539694, 799.0251058359295, 803.2349676562087, 824.2423218364506, 829.2958988524485, 842.6822310548366, 844.0617804223918, 846.4935499789715, 847.8473031295302, 856.7160656167298, 856.9453460868112, 860.3355576386368, 875.4251326786748, 879.3656635264222, 880.0270739134353, 885.2755941531773, 890.3743001215046, 898.134229245466, 904.7690508827154, 912.5229204926172, 915.5568903273997, 935.8211172453111, 957.2696040490875, 961.6316462367479, 993.0416278964603, 997.5490984215498, 1002.756413965687, 1010.04456663787, 1036.618536691151, 1050.16939912767, 1076.9078994150816, 1099.6441195209966, 1138.3475631414017, 1138.630917560757, 1139.3218175828601, 1150.8370872629778, 1153.7122978294003, 1157.5555301942488, 1180.454606954221, 1188.8252773857264, 1202.1687890220935, 1202.4355230600288, 1240.731305658371, 1250.5793433272497, 1254.5633872569103, 1256.1996868916167, 1274.084717751122, 1280.4317413253723, 1291.3018170322932, 1305.016401767735, 1374.2737619853842, 1427.515768834013, 1457.4813931805622, 1470.046401534423, 1493.0946000499175, 1509.8681429019305, 1551.620041481203, 1601.4961902535597, 1638.603961838286, 1681.96734489945, 1689.2956634933992, 1749.2391466339323, 2242.2219354923764, 2308.181996707113, 2409.7604586603984, 2439.2057727330352, 2571.977228033044, 2609.4647291655015, 2703.0171627631253, 3005.961471686297, 3154.377091836936, 3200.735721552559, 3423.9495215768898, 4545.059114041556, 4612.546172799296 ], "yaxis": "y" } ], "layout": { "legend": { "title": { "text": "model" }, "tracegroupgap": 0 }, "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Comparaison des prédictions des deux modèles" }, "xaxis": { "anchor": "y", "domain": [ 0, 1 ], "title": { "text": "predictions" } }, "yaxis": { "anchor": "x", "domain": [ 0, 1 ], "title": { "text": "reality" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "px.scatter(preds_vs_real, x=\"predictions\", y=\"reality\", color=\"model\",\n", " trendline=\"ols\", title=\"Comparaison des prédictions des deux modèles\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The model without scaling fell into a local minima, corresponding with constant predictions" ] }, { "cell_type": "markdown", "metadata": { "ExecuteTime": { "end_time": "2020-12-01T12:11:08.418759Z", "start_time": "2020-12-01T12:11:08.413662Z" } }, "source": [ "## Visualize predictions vs reality as time series" ] }, { "cell_type": "code", "execution_count": 24, "metadata": { "ExecuteTime": { "end_time": "2020-12-02T09:02:46.328375Z", "start_time": "2020-12-02T09:02:46.312055Z" } }, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "name": "Number of clicks", "type": "scatter", "x": [ "2017-05-15", "2017-05-16", "2017-05-17", "2017-05-18", "2017-05-19", "2017-05-20", "2017-05-21", "2017-05-22", "2017-05-23", "2017-05-24", "2017-05-25", "2017-05-26", "2017-05-27", "2017-05-28", "2017-05-29", "2017-05-30", "2017-05-31", "2017-06-01", "2017-06-02", "2017-06-03", "2017-06-04", "2017-06-05", "2017-06-06", "2017-06-07", "2017-06-08", "2017-06-09", "2017-06-10", "2017-06-11", "2017-06-12", "2017-06-13", "2017-06-14", "2017-06-15", "2017-06-16", "2017-06-17", "2017-06-18", "2017-06-19", "2017-06-20", "2017-06-21", "2017-06-22", "2017-06-23", "2017-06-24", "2017-06-25", "2017-06-26", "2017-06-27", "2017-06-28", "2017-06-29", "2017-06-30", "2017-07-01", "2017-07-02", "2017-07-03", "2017-07-04", "2017-07-05", "2017-07-06", "2017-07-07", "2017-07-08", "2017-07-09", "2017-07-10", "2017-07-11", "2017-07-12", "2017-07-13", "2017-07-14", "2017-07-15", "2017-07-16", "2017-07-17", "2017-07-18", "2017-07-19", "2017-07-20", "2017-07-21", "2017-07-22", "2017-07-23", "2017-07-24", "2017-07-25", "2017-07-26", "2017-07-27", "2017-07-28", "2017-07-29", "2017-07-30", "2017-07-31", "2017-08-01", "2017-08-02", "2017-08-03", "2017-08-04", "2017-08-05", "2017-08-06", "2017-08-07", "2017-08-08", "2017-08-09", "2017-08-10", "2017-08-11", "2017-08-12", "2017-08-13", "2017-08-14", "2017-08-15", "2017-08-16", "2017-08-17", "2017-08-18", "2017-08-19", "2017-08-20", "2017-08-21", "2017-08-22", "2017-08-23", "2017-08-24", "2017-08-25", "2017-08-26", "2017-08-27", "2017-08-28", "2017-08-29", "2017-08-30", "2017-08-31", "2017-09-01", "2017-09-02", "2017-09-03", "2017-09-04", "2017-09-05", "2017-09-06", "2017-09-07", "2017-09-08", "2017-09-09", "2017-09-10" ], "y": [ 1592, 1570, 1732, 1445, 1180, 727, 1045, 1406, 1431, 1444, 1275, 857, 720, 906, 1237, 1402, 1288, 1209, 946, 626, 779, 1156, 1158, 1480, 1209, 835, 559, 731, 975, 1200, 1190, 996, 724, 528, 513, 776, 974, 902, 863, 696, 455, 569, 785, 869, 915, 820, 596, 434, 421, 691, 899, 923, 824, 644, 522, 492, 831, 792, 829, 832, 571, 460, 525, 709, 792, 678, 623, 528, 392, 428, 650, 735, 708, 760, 602, 466, 696, 690, 766, 745, 899, 600, 412, 451, 669, 804, 927, 1041, 710, 753, 859, 1141, 1150, 1323, 1319, 841, 676, 948, 1687, 2844, 3333, 3442, 2133, 1413, 1834, 3182, 4206, 4177, 3702, 2155, 1274, 1715, 2758, 3151, 2991, 2637, 1527, 931, 1146 ] }, { "name": "Predictions with model not using scaling", "type": "scatter", "x": [ "2017-05-15", "2017-05-16", "2017-05-17", "2017-05-18", "2017-05-19", "2017-05-20", "2017-05-21", "2017-05-22", "2017-05-23", "2017-05-24", "2017-05-25", "2017-05-26", "2017-05-27", "2017-05-28", "2017-05-29", "2017-05-30", "2017-05-31", "2017-06-01", "2017-06-02", "2017-06-03", "2017-06-04", "2017-06-05", "2017-06-06", "2017-06-07", "2017-06-08", "2017-06-09", "2017-06-10", "2017-06-11", "2017-06-12", "2017-06-13", "2017-06-14", "2017-06-15", "2017-06-16", "2017-06-17", "2017-06-18", "2017-06-19", "2017-06-20", "2017-06-21", "2017-06-22", "2017-06-23", "2017-06-24", "2017-06-25", "2017-06-26", "2017-06-27", "2017-06-28", "2017-06-29", "2017-06-30", "2017-07-01", "2017-07-02", "2017-07-03", "2017-07-04", "2017-07-05", "2017-07-06", "2017-07-07", "2017-07-08", "2017-07-09", "2017-07-10", "2017-07-11", "2017-07-12", "2017-07-13", "2017-07-14", "2017-07-15", "2017-07-16", "2017-07-17", "2017-07-18", "2017-07-19", "2017-07-20", "2017-07-21", "2017-07-22", "2017-07-23", "2017-07-24", "2017-07-25", "2017-07-26", "2017-07-27", "2017-07-28", "2017-07-29", "2017-07-30", "2017-07-31", "2017-08-01", "2017-08-02", "2017-08-03", "2017-08-04", "2017-08-05", "2017-08-06", "2017-08-07", "2017-08-08", "2017-08-09", "2017-08-10", "2017-08-11", "2017-08-12", "2017-08-13", "2017-08-14", "2017-08-15", "2017-08-16", "2017-08-17", "2017-08-18", "2017-08-19", "2017-08-20", "2017-08-21", "2017-08-22", "2017-08-23", "2017-08-24", "2017-08-25", "2017-08-26", "2017-08-27", "2017-08-28", "2017-08-29", "2017-08-30", "2017-08-31", "2017-09-01", "2017-09-02", "2017-09-03", "2017-09-04", "2017-09-05", "2017-09-06", "2017-09-07", "2017-09-08", "2017-09-09", "2017-09-10" ], "y": [ 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125, 1307.7530517578125 ] }, { "name": "Predictions with model using global scaling", "type": "scatter", "x": [ "2017-05-15", "2017-05-16", "2017-05-17", "2017-05-18", "2017-05-19", "2017-05-20", "2017-05-21", "2017-05-22", "2017-05-23", "2017-05-24", "2017-05-25", "2017-05-26", "2017-05-27", "2017-05-28", "2017-05-29", "2017-05-30", "2017-05-31", "2017-06-01", "2017-06-02", "2017-06-03", "2017-06-04", "2017-06-05", "2017-06-06", "2017-06-07", "2017-06-08", "2017-06-09", "2017-06-10", "2017-06-11", "2017-06-12", "2017-06-13", "2017-06-14", "2017-06-15", "2017-06-16", "2017-06-17", "2017-06-18", "2017-06-19", "2017-06-20", "2017-06-21", "2017-06-22", "2017-06-23", "2017-06-24", "2017-06-25", "2017-06-26", "2017-06-27", "2017-06-28", "2017-06-29", "2017-06-30", "2017-07-01", "2017-07-02", "2017-07-03", "2017-07-04", "2017-07-05", "2017-07-06", "2017-07-07", "2017-07-08", "2017-07-09", "2017-07-10", "2017-07-11", "2017-07-12", "2017-07-13", "2017-07-14", "2017-07-15", "2017-07-16", "2017-07-17", "2017-07-18", "2017-07-19", "2017-07-20", "2017-07-21", "2017-07-22", "2017-07-23", "2017-07-24", "2017-07-25", "2017-07-26", "2017-07-27", "2017-07-28", "2017-07-29", "2017-07-30", "2017-07-31", "2017-08-01", "2017-08-02", "2017-08-03", "2017-08-04", "2017-08-05", "2017-08-06", "2017-08-07", "2017-08-08", "2017-08-09", "2017-08-10", "2017-08-11", "2017-08-12", "2017-08-13", "2017-08-14", "2017-08-15", "2017-08-16", "2017-08-17", "2017-08-18", "2017-08-19", "2017-08-20", "2017-08-21", "2017-08-22", "2017-08-23", "2017-08-24", "2017-08-25", "2017-08-26", "2017-08-27", "2017-08-28", "2017-08-29", "2017-08-30", "2017-08-31", "2017-09-01", "2017-09-02", "2017-09-03", "2017-09-04", "2017-09-05", "2017-09-06", "2017-09-07", "2017-09-08", "2017-09-09", "2017-09-10" ], "y": [ 1298.6376953125, 1428.196044921875, 1371.885986328125, 1245.27734375, 978.9600830078125, 935.4655151367188, 1189.863525390625, 1497.5538330078125, 1559.4517822265625, 1473.177490234375, 1284.1328125, 930.8521118164062, 655.8539428710938, 868.30908203125, 1190.1456298828125, 1265.923583984375, 1230.648193359375, 1029.105224609375, 828.332275390625, 752.0112915039062, 973.4526977539062, 1175.7510986328125, 1247.0079345703125, 1142.679443359375, 1166.8980712890625, 875.3262329101562, 645.1436767578125, 844.2913818359375, 1122.3646240234375, 1123.39501953125, 1138.61474609375, 1057.384521484375, 767.9412841796875, 548.420166015625, 673.7410278320312, 854.70947265625, 883.5269165039062, 908.1676635742188, 824.7467041015625, 683.5916137695312, 522.7337646484375, 552.11767578125, 849.1585083007812, 968.6854858398438, 886.7357177734375, 815.1243896484375, 627.0986938476562, 434.203857421875, 481.3956298828125, 610.6476440429688, 739.275146484375, 848.458984375, 824.5042114257812, 632.7233276367188, 476.7071533203125, 608.2882080078125, 752.1546020507812, 986.668212890625, 813.692626953125, 790.1591796875, 670.841796875, 408.256591796875, 442.767333984375, 644.5447387695312, 763.4888305664062, 760.1898803710938, 607.75244140625, 491.0633544921875, 401.64794921875, 400.578125, 508.704345703125, 636.7146606445312, 677.39697265625, 607.305908203125, 583.896728515625, 462.8212890625, 520.9505615234375, 860.1019897460938, 752.2635498046875, 763.0933227539062, 668.1936645507812, 728.2044677734375, 422.974609375, 393.279296875, 511.5819091796875, 660.1094970703125, 748.3004150390625, 811.1207275390625, 795.5039672851562, 491.4808349609375, 809.6616821289062, 1122.664306640625, 1459.888427734375, 1241.063720703125, 1272.6363525390625, 1014.7734985351562, 560.4417724609375, 719.0269165039062, 1081.430908203125, 1697.310302734375, 2777.19775390625, 2678.25439453125, 2289.849365234375, 1612.2020263671875, 2467.042236328125, 3254.567138671875, 4725.38671875, 4796.7626953125, 3539.673583984375, 2498.184326171875, 1651.4481201171875, 1705.0609130859375, 2638.606689453125, 3097.59912109375, 3303.59716796875, 2359.6103515625, 1768.4586181640625, 1135.5738525390625, 1515.2939453125 ] } ], "layout": { "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Predictions vs reality on test set" }, "xaxis": { "title": { "text": "Day" } }, "yaxis": { "title": { "text": "Clicks" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "days = df_one_page.columns[-len(preds_test):]\n", "\n", "fig = go.Figure(data=[go.Scatter(x=days, \n", " y=y_test, \n", " name=\"Number of clicks\"),\n", " go.Scatter(x=days, \n", " y=preds_test[:, 0], \n", " name=\"Predictions with model not using scaling\"),\n", " go.Scatter(x=days, \n", " y=unscaled_preds_scaled_test, \n", " name=\"Predictions with model using global scaling\")])\n", "fig.update_layout(title=\"Predictions vs reality on test set\",\n", " xaxis_title=\"Day\",\n", " yaxis_title=\"Clicks\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "hide_input": false, "jupytext": { "formats": "ipynb,py:percent" }, "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.8.6" }, "toc": { "base_numbering": 1, "nav_menu": {}, "number_sections": true, "sideBar": true, "skip_h1_title": false, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": false, "toc_position": {}, "toc_section_display": true, "toc_window_display": false }, "varInspector": { "cols": { "lenName": 16, "lenType": 16, "lenVar": 40 }, "kernels_config": { "python": { "delete_cmd_postfix": "", "delete_cmd_prefix": "del ", "library": "var_list.py", "varRefreshCmd": "print(var_dic_list())" }, "r": { "delete_cmd_postfix": ") ", "delete_cmd_prefix": "rm(", "library": "var_list.r", "varRefreshCmd": "cat(var_dic_list()) " } }, "types_to_exclude": [ "module", "function", "builtin_function_or_method", "instance", "_Feature" ], "window_display": false } }, "nbformat": 4, "nbformat_minor": 4 }