{ "cells": [ { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import pandas as pd \n", "from datetime import datetime \n", "from datetime import date\n", "import matplotlib.pyplot as plt\n", "import seaborn as sns\n", "import numpy as np\n", "import pandas as pd\n", "from keras.models import Sequential\n", "from keras.layers import LSTM, Dense\n", "from sklearn.model_selection import train_test_split\n", "from sklearn.preprocessing import MinMaxScaler\n" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | date | \n", "zone_047_hw_valve | \n", "rtu_004_sat_sp_tn | \n", "zone_047_temp | \n", "zone_047_fan_spd | \n", "rtu_004_fltrd_sa_flow_tn | \n", "rtu_004_sa_temp | \n", "rtu_004_pa_static_stpt_tn | \n", "rtu_004_oa_flow_tn | \n", "rtu_004_oadmpr_pct | \n", "... | \n", "zone_047_heating_sp | \n", "Unnamed: 47_y | \n", "hvac_S | \n", "hp_hws_temp | \n", "aru_001_cwr_temp | \n", "aru_001_cws_fr_gpm | \n", "aru_001_cws_temp | \n", "aru_001_hwr_temp | \n", "aru_001_hws_fr_gpm | \n", "aru_001_hws_temp | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "2018-01-01 00:00:00 | \n", "100.0 | \n", "69.0 | \n", "67.5 | \n", "20.0 | \n", "9265.604 | \n", "66.1 | \n", "0.06 | \n", "0.000000 | \n", "28.0 | \n", "... | \n", "NaN | \n", "NaN | \n", "NaN | \n", "75.3 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
1 | \n", "2018-01-01 00:01:00 | \n", "100.0 | \n", "69.0 | \n", "67.5 | \n", "20.0 | \n", "9265.604 | \n", "66.0 | \n", "0.06 | \n", "6572.099162 | \n", "28.0 | \n", "... | \n", "NaN | \n", "NaN | \n", "NaN | \n", "75.3 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
2 | \n", "2018-01-01 00:02:00 | \n", "100.0 | \n", "69.0 | \n", "67.5 | \n", "20.0 | \n", "9708.240 | \n", "66.1 | \n", "0.06 | \n", "7628.832542 | \n", "28.0 | \n", "... | \n", "NaN | \n", "NaN | \n", "NaN | \n", "75.3 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
3 | \n", "2018-01-01 00:03:00 | \n", "100.0 | \n", "69.0 | \n", "67.5 | \n", "20.0 | \n", "9611.638 | \n", "66.1 | \n", "0.06 | \n", "7710.294617 | \n", "28.0 | \n", "... | \n", "NaN | \n", "NaN | \n", "NaN | \n", "75.3 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
4 | \n", "2018-01-01 00:04:00 | \n", "100.0 | \n", "69.0 | \n", "67.5 | \n", "20.0 | \n", "9215.110 | \n", "66.0 | \n", "0.06 | \n", "7139.184090 | \n", "28.0 | \n", "... | \n", "NaN | \n", "NaN | \n", "NaN | \n", "75.3 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
2072149 | \n", "2020-12-31 23:58:00 | \n", "100.0 | \n", "68.0 | \n", "63.2 | \n", "20.0 | \n", "18884.834 | \n", "64.4 | \n", "0.06 | \n", "2938.320000 | \n", "23.4 | \n", "... | \n", "71.0 | \n", "69.0 | \n", "23.145000 | \n", "123.8 | \n", "56.25 | \n", "54.71 | \n", "56.4 | \n", "123.42 | \n", "61.6 | \n", "122.36 | \n", "
2072150 | \n", "2020-12-31 23:58:00 | \n", "100.0 | \n", "68.0 | \n", "63.2 | \n", "20.0 | \n", "18884.834 | \n", "64.4 | \n", "0.06 | \n", "2938.320000 | \n", "23.4 | \n", "... | \n", "71.0 | \n", "69.0 | \n", "23.145000 | \n", "123.8 | \n", "56.25 | \n", "54.71 | \n", "56.4 | \n", "123.42 | \n", "61.6 | \n", "122.36 | \n", "
2072151 | \n", "2020-12-31 23:59:00 | \n", "100.0 | \n", "68.0 | \n", "63.2 | \n", "20.0 | \n", "19345.508 | \n", "64.3 | \n", "0.06 | \n", "3154.390000 | \n", "23.4 | \n", "... | \n", "71.0 | \n", "69.0 | \n", "23.145000 | \n", "123.8 | \n", "56.25 | \n", "54.71 | \n", "56.4 | \n", "123.42 | \n", "61.6 | \n", "122.36 | \n", "
2072152 | \n", "2020-12-31 23:59:00 | \n", "100.0 | \n", "68.0 | \n", "63.2 | \n", "20.0 | \n", "19345.508 | \n", "64.3 | \n", "0.06 | \n", "3154.390000 | \n", "23.4 | \n", "... | \n", "71.0 | \n", "69.0 | \n", "23.145000 | \n", "123.8 | \n", "56.25 | \n", "54.71 | \n", "56.4 | \n", "123.42 | \n", "61.6 | \n", "122.36 | \n", "
2072153 | \n", "2021-01-01 00:00:00 | \n", "100.0 | \n", "68.0 | \n", "63.2 | \n", "20.0 | \n", "18650.232 | \n", "64.1 | \n", "0.06 | \n", "3076.270000 | \n", "22.9 | \n", "... | \n", "71.0 | \n", "69.0 | \n", "23.788947 | \n", "123.8 | \n", "56.25 | \n", "54.71 | \n", "56.4 | \n", "123.42 | \n", "61.6 | \n", "122.36 | \n", "
2072154 rows × 30 columns
\n", "Model: \"sequential_19\"\n",
"
\n"
],
"text/plain": [
"\u001b[1mModel: \"sequential_19\"\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓\n", "┃ Layer (type) ┃ Output Shape ┃ Param # ┃\n", "┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩\n", "│ lstm_39 (LSTM) │ (None, 60, 50) │ 12,000 │\n", "├─────────────────────────────────┼────────────────────────┼───────────────┤\n", "│ lstm_40 (LSTM) │ (None, 30) │ 9,720 │\n", "├─────────────────────────────────┼────────────────────────┼───────────────┤\n", "│ dense_26 (Dense) │ (None, 60) │ 1,860 │\n", "└─────────────────────────────────┴────────────────────────┴───────────────┘\n", "\n" ], "text/plain": [ "┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓\n", "┃\u001b[1m \u001b[0m\u001b[1mLayer (type) \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mOutput Shape \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1m Param #\u001b[0m\u001b[1m \u001b[0m┃\n", "┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩\n", "│ lstm_39 (\u001b[38;5;33mLSTM\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m60\u001b[0m, \u001b[38;5;34m50\u001b[0m) │ \u001b[38;5;34m12,000\u001b[0m │\n", "├─────────────────────────────────┼────────────────────────┼───────────────┤\n", "│ lstm_40 (\u001b[38;5;33mLSTM\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m30\u001b[0m) │ \u001b[38;5;34m9,720\u001b[0m │\n", "├─────────────────────────────────┼────────────────────────┼───────────────┤\n", "│ dense_26 (\u001b[38;5;33mDense\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m60\u001b[0m) │ \u001b[38;5;34m1,860\u001b[0m │\n", "└─────────────────────────────────┴────────────────────────┴───────────────┘\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
Total params: 70,742 (276.34 KB)\n", "\n" ], "text/plain": [ "\u001b[1m Total params: \u001b[0m\u001b[38;5;34m70,742\u001b[0m (276.34 KB)\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
Trainable params: 23,580 (92.11 KB)\n", "\n" ], "text/plain": [ "\u001b[1m Trainable params: \u001b[0m\u001b[38;5;34m23,580\u001b[0m (92.11 KB)\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
Non-trainable params: 0 (0.00 B)\n", "\n" ], "text/plain": [ "\u001b[1m Non-trainable params: \u001b[0m\u001b[38;5;34m0\u001b[0m (0.00 B)\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
Optimizer params: 47,162 (184.23 KB)\n", "\n" ], "text/plain": [ "\u001b[1m Optimizer params: \u001b[0m\u001b[38;5;34m47,162\u001b[0m (184.23 KB)\n" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "model.summary()" ] }, { "cell_type": "code", "execution_count": 238, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([-0.00162351, -0.00127119, -0.00132501, -0.00043088, -0.00357354,\n", " -0.00349951, -0.00703096, -0.00679523, 0.00243503, 0.00075096,\n", " 0.015773 , 0.01411158, 0.01689583, 0.01593572, 0.00665802,\n", " 0.0068891 , -0.001706 , -0.00310844, -0.00871575, -0.00967073,\n", " -0.00820547, -0.00687617, 0.00930512, 0.00670969, 0.00769156,\n", " 0.01000088, -0.00052458, 0.00010484, -0.00573552, -0.00811213,\n", " -0.01016176, -0.01063424, -0.01580012, -0.01502603, -0.01243931,\n", " -0.01488668, 0.00733459, 0.00564003, 0.01374102, 0.01534522,\n", " 0.00324941, 0.00375515, -0.0078848 , -0.00780392, -0.01223874,\n", " -0.01329106, -0.00772917, -0.00823385, 0.01035273, 0.01039612,\n", " 0.01731664, 0.01493615, 0.00356281, 0.00522107, -0.00680918,\n", " -0.00461727, -0.00997645, -0.01072395, -0.00542653, -0.00710839],\n", " dtype=float32)" ] }, "execution_count": 238, "metadata": {}, "output_type": "execute_result" } ], "source": [ "test_predict[0]-y_test[0]" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "base", "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.11.8" } }, "nbformat": 4, "nbformat_minor": 2 }