diff --git a/Predicting Energy Efficiency of Buildings/Predicting Energy Efficiency of Buildings.ipynb b/Predicting Energy Efficiency of Buildings/Predicting Energy Efficiency of Buildings.ipynb
new file mode 100644
index 0000000..e2fb302
--- /dev/null
+++ b/Predicting Energy Efficiency of Buildings/Predicting Energy Efficiency of Buildings.ipynb
@@ -0,0 +1,1683 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "id": "504041c1",
+ "metadata": {},
+ "source": [
+ "# #Stage B Data Science Internship"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "73974946",
+ "metadata": {},
+ "source": [
+ "### Graded Quiz Sol'n "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "b6489cf1",
+ "metadata": {},
+ "source": [
+ "### Yamini Vijaywargiya \n",
+ "\n",
+ "#### Machine Learninig: Regression"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "id": "f7b64448",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "
\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " date | \n",
+ " Appliances | \n",
+ " lights | \n",
+ " T1 | \n",
+ " RH_1 | \n",
+ " T2 | \n",
+ " RH_2 | \n",
+ " T3 | \n",
+ " RH_3 | \n",
+ " T4 | \n",
+ " ... | \n",
+ " T9 | \n",
+ " RH_9 | \n",
+ " T_out | \n",
+ " Press_mm_hg | \n",
+ " RH_out | \n",
+ " Windspeed | \n",
+ " Visibility | \n",
+ " Tdewpoint | \n",
+ " rv1 | \n",
+ " rv2 | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " 2016-01-11 17:00:00 | \n",
+ " 60 | \n",
+ " 30 | \n",
+ " 19.89 | \n",
+ " 47.596667 | \n",
+ " 19.2 | \n",
+ " 44.790000 | \n",
+ " 19.79 | \n",
+ " 44.730000 | \n",
+ " 19.000000 | \n",
+ " ... | \n",
+ " 17.033333 | \n",
+ " 45.53 | \n",
+ " 6.600000 | \n",
+ " 733.5 | \n",
+ " 92.0 | \n",
+ " 7.000000 | \n",
+ " 63.000000 | \n",
+ " 5.3 | \n",
+ " 13.275433 | \n",
+ " 13.275433 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " 2016-01-11 17:10:00 | \n",
+ " 60 | \n",
+ " 30 | \n",
+ " 19.89 | \n",
+ " 46.693333 | \n",
+ " 19.2 | \n",
+ " 44.722500 | \n",
+ " 19.79 | \n",
+ " 44.790000 | \n",
+ " 19.000000 | \n",
+ " ... | \n",
+ " 17.066667 | \n",
+ " 45.56 | \n",
+ " 6.483333 | \n",
+ " 733.6 | \n",
+ " 92.0 | \n",
+ " 6.666667 | \n",
+ " 59.166667 | \n",
+ " 5.2 | \n",
+ " 18.606195 | \n",
+ " 18.606195 | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " 2016-01-11 17:20:00 | \n",
+ " 50 | \n",
+ " 30 | \n",
+ " 19.89 | \n",
+ " 46.300000 | \n",
+ " 19.2 | \n",
+ " 44.626667 | \n",
+ " 19.79 | \n",
+ " 44.933333 | \n",
+ " 18.926667 | \n",
+ " ... | \n",
+ " 17.000000 | \n",
+ " 45.50 | \n",
+ " 6.366667 | \n",
+ " 733.7 | \n",
+ " 92.0 | \n",
+ " 6.333333 | \n",
+ " 55.333333 | \n",
+ " 5.1 | \n",
+ " 28.642668 | \n",
+ " 28.642668 | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " 2016-01-11 17:30:00 | \n",
+ " 50 | \n",
+ " 40 | \n",
+ " 19.89 | \n",
+ " 46.066667 | \n",
+ " 19.2 | \n",
+ " 44.590000 | \n",
+ " 19.79 | \n",
+ " 45.000000 | \n",
+ " 18.890000 | \n",
+ " ... | \n",
+ " 17.000000 | \n",
+ " 45.40 | \n",
+ " 6.250000 | \n",
+ " 733.8 | \n",
+ " 92.0 | \n",
+ " 6.000000 | \n",
+ " 51.500000 | \n",
+ " 5.0 | \n",
+ " 45.410389 | \n",
+ " 45.410389 | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " 2016-01-11 17:40:00 | \n",
+ " 60 | \n",
+ " 40 | \n",
+ " 19.89 | \n",
+ " 46.333333 | \n",
+ " 19.2 | \n",
+ " 44.530000 | \n",
+ " 19.79 | \n",
+ " 45.000000 | \n",
+ " 18.890000 | \n",
+ " ... | \n",
+ " 17.000000 | \n",
+ " 45.40 | \n",
+ " 6.133333 | \n",
+ " 733.9 | \n",
+ " 92.0 | \n",
+ " 5.666667 | \n",
+ " 47.666667 | \n",
+ " 4.9 | \n",
+ " 10.084097 | \n",
+ " 10.084097 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
5 rows × 29 columns
\n",
+ "
"
+ ],
+ "text/plain": [
+ " date Appliances lights T1 RH_1 T2 RH_2 \\\n",
+ "0 2016-01-11 17:00:00 60 30 19.89 47.596667 19.2 44.790000 \n",
+ "1 2016-01-11 17:10:00 60 30 19.89 46.693333 19.2 44.722500 \n",
+ "2 2016-01-11 17:20:00 50 30 19.89 46.300000 19.2 44.626667 \n",
+ "3 2016-01-11 17:30:00 50 40 19.89 46.066667 19.2 44.590000 \n",
+ "4 2016-01-11 17:40:00 60 40 19.89 46.333333 19.2 44.530000 \n",
+ "\n",
+ " T3 RH_3 T4 ... T9 RH_9 T_out Press_mm_hg \\\n",
+ "0 19.79 44.730000 19.000000 ... 17.033333 45.53 6.600000 733.5 \n",
+ "1 19.79 44.790000 19.000000 ... 17.066667 45.56 6.483333 733.6 \n",
+ "2 19.79 44.933333 18.926667 ... 17.000000 45.50 6.366667 733.7 \n",
+ "3 19.79 45.000000 18.890000 ... 17.000000 45.40 6.250000 733.8 \n",
+ "4 19.79 45.000000 18.890000 ... 17.000000 45.40 6.133333 733.9 \n",
+ "\n",
+ " RH_out Windspeed Visibility Tdewpoint rv1 rv2 \n",
+ "0 92.0 7.000000 63.000000 5.3 13.275433 13.275433 \n",
+ "1 92.0 6.666667 59.166667 5.2 18.606195 18.606195 \n",
+ "2 92.0 6.333333 55.333333 5.1 28.642668 28.642668 \n",
+ "3 92.0 6.000000 51.500000 5.0 45.410389 45.410389 \n",
+ "4 92.0 5.666667 47.666667 4.9 10.084097 10.084097 \n",
+ "\n",
+ "[5 rows x 29 columns]"
+ ]
+ },
+ "execution_count": 7,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "import numpy as np\n",
+ "import pandas as pd\n",
+ "url = 'https://archive.ics.uci.edu/ml/machine-learning-databases/00374/energydata_complete.csv'\n",
+ "df = pd.read_csv(url, error_bad_lines= False)\n",
+ "\n",
+ "df.head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "id": "7a4f79af",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " date | \n",
+ " Appliances | \n",
+ " lights | \n",
+ " T1 | \n",
+ " RH_1 | \n",
+ " T2 | \n",
+ " RH_2 | \n",
+ " T3 | \n",
+ " RH_3 | \n",
+ " T4 | \n",
+ " ... | \n",
+ " T9 | \n",
+ " RH_9 | \n",
+ " T_out | \n",
+ " Press_mm_hg | \n",
+ " RH_out | \n",
+ " Windspeed | \n",
+ " Visibility | \n",
+ " Tdewpoint | \n",
+ " rv1 | \n",
+ " rv2 | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | count | \n",
+ " 19735 | \n",
+ " 19735.000000 | \n",
+ " 19735.000000 | \n",
+ " 19735.000000 | \n",
+ " 19735.000000 | \n",
+ " 19735.000000 | \n",
+ " 19735.000000 | \n",
+ " 19735.000000 | \n",
+ " 19735.000000 | \n",
+ " 19735.000000 | \n",
+ " ... | \n",
+ " 19735.000000 | \n",
+ " 19735.000000 | \n",
+ " 19735.000000 | \n",
+ " 19735.000000 | \n",
+ " 19735.000000 | \n",
+ " 19735.000000 | \n",
+ " 19735.000000 | \n",
+ " 19735.000000 | \n",
+ " 19735.000000 | \n",
+ " 19735.000000 | \n",
+ "
\n",
+ " \n",
+ " | unique | \n",
+ " 19735 | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " ... | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | top | \n",
+ " 2016-03-03 11:20:00 | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " ... | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | freq | \n",
+ " 1 | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " ... | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | mean | \n",
+ " NaN | \n",
+ " 97.694958 | \n",
+ " 3.801875 | \n",
+ " 21.686571 | \n",
+ " 40.259739 | \n",
+ " 20.341219 | \n",
+ " 40.420420 | \n",
+ " 22.267611 | \n",
+ " 39.242500 | \n",
+ " 20.855335 | \n",
+ " ... | \n",
+ " 19.485828 | \n",
+ " 41.552401 | \n",
+ " 7.411665 | \n",
+ " 755.522602 | \n",
+ " 79.750418 | \n",
+ " 4.039752 | \n",
+ " 38.330834 | \n",
+ " 3.760707 | \n",
+ " 24.988033 | \n",
+ " 24.988033 | \n",
+ "
\n",
+ " \n",
+ " | std | \n",
+ " NaN | \n",
+ " 102.524891 | \n",
+ " 7.935988 | \n",
+ " 1.606066 | \n",
+ " 3.979299 | \n",
+ " 2.192974 | \n",
+ " 4.069813 | \n",
+ " 2.006111 | \n",
+ " 3.254576 | \n",
+ " 2.042884 | \n",
+ " ... | \n",
+ " 2.014712 | \n",
+ " 4.151497 | \n",
+ " 5.317409 | \n",
+ " 7.399441 | \n",
+ " 14.901088 | \n",
+ " 2.451221 | \n",
+ " 11.794719 | \n",
+ " 4.194648 | \n",
+ " 14.496634 | \n",
+ " 14.496634 | \n",
+ "
\n",
+ " \n",
+ " | min | \n",
+ " NaN | \n",
+ " 10.000000 | \n",
+ " 0.000000 | \n",
+ " 16.790000 | \n",
+ " 27.023333 | \n",
+ " 16.100000 | \n",
+ " 20.463333 | \n",
+ " 17.200000 | \n",
+ " 28.766667 | \n",
+ " 15.100000 | \n",
+ " ... | \n",
+ " 14.890000 | \n",
+ " 29.166667 | \n",
+ " -5.000000 | \n",
+ " 729.300000 | \n",
+ " 24.000000 | \n",
+ " 0.000000 | \n",
+ " 1.000000 | \n",
+ " -6.600000 | \n",
+ " 0.005322 | \n",
+ " 0.005322 | \n",
+ "
\n",
+ " \n",
+ " | 25% | \n",
+ " NaN | \n",
+ " 50.000000 | \n",
+ " 0.000000 | \n",
+ " 20.760000 | \n",
+ " 37.333333 | \n",
+ " 18.790000 | \n",
+ " 37.900000 | \n",
+ " 20.790000 | \n",
+ " 36.900000 | \n",
+ " 19.530000 | \n",
+ " ... | \n",
+ " 18.000000 | \n",
+ " 38.500000 | \n",
+ " 3.666667 | \n",
+ " 750.933333 | \n",
+ " 70.333333 | \n",
+ " 2.000000 | \n",
+ " 29.000000 | \n",
+ " 0.900000 | \n",
+ " 12.497889 | \n",
+ " 12.497889 | \n",
+ "
\n",
+ " \n",
+ " | 50% | \n",
+ " NaN | \n",
+ " 60.000000 | \n",
+ " 0.000000 | \n",
+ " 21.600000 | \n",
+ " 39.656667 | \n",
+ " 20.000000 | \n",
+ " 40.500000 | \n",
+ " 22.100000 | \n",
+ " 38.530000 | \n",
+ " 20.666667 | \n",
+ " ... | \n",
+ " 19.390000 | \n",
+ " 40.900000 | \n",
+ " 6.916667 | \n",
+ " 756.100000 | \n",
+ " 83.666667 | \n",
+ " 3.666667 | \n",
+ " 40.000000 | \n",
+ " 3.433333 | \n",
+ " 24.897653 | \n",
+ " 24.897653 | \n",
+ "
\n",
+ " \n",
+ " | 75% | \n",
+ " NaN | \n",
+ " 100.000000 | \n",
+ " 0.000000 | \n",
+ " 22.600000 | \n",
+ " 43.066667 | \n",
+ " 21.500000 | \n",
+ " 43.260000 | \n",
+ " 23.290000 | \n",
+ " 41.760000 | \n",
+ " 22.100000 | \n",
+ " ... | \n",
+ " 20.600000 | \n",
+ " 44.338095 | \n",
+ " 10.408333 | \n",
+ " 760.933333 | \n",
+ " 91.666667 | \n",
+ " 5.500000 | \n",
+ " 40.000000 | \n",
+ " 6.566667 | \n",
+ " 37.583769 | \n",
+ " 37.583769 | \n",
+ "
\n",
+ " \n",
+ " | max | \n",
+ " NaN | \n",
+ " 1080.000000 | \n",
+ " 70.000000 | \n",
+ " 26.260000 | \n",
+ " 63.360000 | \n",
+ " 29.856667 | \n",
+ " 56.026667 | \n",
+ " 29.236000 | \n",
+ " 50.163333 | \n",
+ " 26.200000 | \n",
+ " ... | \n",
+ " 24.500000 | \n",
+ " 53.326667 | \n",
+ " 26.100000 | \n",
+ " 772.300000 | \n",
+ " 100.000000 | \n",
+ " 14.000000 | \n",
+ " 66.000000 | \n",
+ " 15.500000 | \n",
+ " 49.996530 | \n",
+ " 49.996530 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
11 rows × 29 columns
\n",
+ "
"
+ ],
+ "text/plain": [
+ " date Appliances lights T1 \\\n",
+ "count 19735 19735.000000 19735.000000 19735.000000 \n",
+ "unique 19735 NaN NaN NaN \n",
+ "top 2016-03-03 11:20:00 NaN NaN NaN \n",
+ "freq 1 NaN NaN NaN \n",
+ "mean NaN 97.694958 3.801875 21.686571 \n",
+ "std NaN 102.524891 7.935988 1.606066 \n",
+ "min NaN 10.000000 0.000000 16.790000 \n",
+ "25% NaN 50.000000 0.000000 20.760000 \n",
+ "50% NaN 60.000000 0.000000 21.600000 \n",
+ "75% NaN 100.000000 0.000000 22.600000 \n",
+ "max NaN 1080.000000 70.000000 26.260000 \n",
+ "\n",
+ " RH_1 T2 RH_2 T3 RH_3 \\\n",
+ "count 19735.000000 19735.000000 19735.000000 19735.000000 19735.000000 \n",
+ "unique NaN NaN NaN NaN NaN \n",
+ "top NaN NaN NaN NaN NaN \n",
+ "freq NaN NaN NaN NaN NaN \n",
+ "mean 40.259739 20.341219 40.420420 22.267611 39.242500 \n",
+ "std 3.979299 2.192974 4.069813 2.006111 3.254576 \n",
+ "min 27.023333 16.100000 20.463333 17.200000 28.766667 \n",
+ "25% 37.333333 18.790000 37.900000 20.790000 36.900000 \n",
+ "50% 39.656667 20.000000 40.500000 22.100000 38.530000 \n",
+ "75% 43.066667 21.500000 43.260000 23.290000 41.760000 \n",
+ "max 63.360000 29.856667 56.026667 29.236000 50.163333 \n",
+ "\n",
+ " T4 ... T9 RH_9 T_out \\\n",
+ "count 19735.000000 ... 19735.000000 19735.000000 19735.000000 \n",
+ "unique NaN ... NaN NaN NaN \n",
+ "top NaN ... NaN NaN NaN \n",
+ "freq NaN ... NaN NaN NaN \n",
+ "mean 20.855335 ... 19.485828 41.552401 7.411665 \n",
+ "std 2.042884 ... 2.014712 4.151497 5.317409 \n",
+ "min 15.100000 ... 14.890000 29.166667 -5.000000 \n",
+ "25% 19.530000 ... 18.000000 38.500000 3.666667 \n",
+ "50% 20.666667 ... 19.390000 40.900000 6.916667 \n",
+ "75% 22.100000 ... 20.600000 44.338095 10.408333 \n",
+ "max 26.200000 ... 24.500000 53.326667 26.100000 \n",
+ "\n",
+ " Press_mm_hg RH_out Windspeed Visibility Tdewpoint \\\n",
+ "count 19735.000000 19735.000000 19735.000000 19735.000000 19735.000000 \n",
+ "unique NaN NaN NaN NaN NaN \n",
+ "top NaN NaN NaN NaN NaN \n",
+ "freq NaN NaN NaN NaN NaN \n",
+ "mean 755.522602 79.750418 4.039752 38.330834 3.760707 \n",
+ "std 7.399441 14.901088 2.451221 11.794719 4.194648 \n",
+ "min 729.300000 24.000000 0.000000 1.000000 -6.600000 \n",
+ "25% 750.933333 70.333333 2.000000 29.000000 0.900000 \n",
+ "50% 756.100000 83.666667 3.666667 40.000000 3.433333 \n",
+ "75% 760.933333 91.666667 5.500000 40.000000 6.566667 \n",
+ "max 772.300000 100.000000 14.000000 66.000000 15.500000 \n",
+ "\n",
+ " rv1 rv2 \n",
+ "count 19735.000000 19735.000000 \n",
+ "unique NaN NaN \n",
+ "top NaN NaN \n",
+ "freq NaN NaN \n",
+ "mean 24.988033 24.988033 \n",
+ "std 14.496634 14.496634 \n",
+ "min 0.005322 0.005322 \n",
+ "25% 12.497889 12.497889 \n",
+ "50% 24.897653 24.897653 \n",
+ "75% 37.583769 37.583769 \n",
+ "max 49.996530 49.996530 \n",
+ "\n",
+ "[11 rows x 29 columns]"
+ ]
+ },
+ "execution_count": 2,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df.describe(include ='all')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "id": "b8b2a8e8",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "date 0\n",
+ "Appliances 0\n",
+ "lights 0\n",
+ "T1 0\n",
+ "RH_1 0\n",
+ "T2 0\n",
+ "RH_2 0\n",
+ "T3 0\n",
+ "RH_3 0\n",
+ "T4 0\n",
+ "RH_4 0\n",
+ "T5 0\n",
+ "RH_5 0\n",
+ "T6 0\n",
+ "RH_6 0\n",
+ "T7 0\n",
+ "RH_7 0\n",
+ "T8 0\n",
+ "RH_8 0\n",
+ "T9 0\n",
+ "RH_9 0\n",
+ "T_out 0\n",
+ "Press_mm_hg 0\n",
+ "RH_out 0\n",
+ "Windspeed 0\n",
+ "Visibility 0\n",
+ "Tdewpoint 0\n",
+ "rv1 0\n",
+ "rv2 0\n",
+ "dtype: int64"
+ ]
+ },
+ "execution_count": 3,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df.isnull().sum()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "id": "24f62118",
+ "metadata": {
+ "scrolled": false
+ },
+ "outputs": [],
+ "source": [
+ "column_names = {'date': 'Date', 'Appliances': 'Appliances', 'lights':'Lights', 'T1':'Temp_Kitchen',\n",
+ " 'RH_1':'Humidity_Kitchen', 'T2':'Temp_LivingRoom', 'RH_2':'Humidity_LivingRoom', \n",
+ " 'T3':'Temp_LaundryRoom', 'RH_3':'Humidity_LaundryRoom', 'T4':'Temp_Office', \n",
+ " 'RH_4':'Humidity_Office', 'T5':'Temp_Bathroom', 'RH_5':'Humidity_Bathroom', \n",
+ " 'T6': 'Temp_Outside_Building', 'RH_6': 'Humidity_Outside_Building', \n",
+ " 'T7': 'Temp_IroningRoom', 'RH_7': 'Humidity_IroningRoom',\n",
+ " 'T8': 'Temp_TeenagerRoom', 'RH_8': 'Humidity_TeenagerRoom', \n",
+ " 'T9': 'Temp_ParentsRoom', 'RH_9': 'Humidity_ParentsRoom', 'T_out': 'Temp_Outside', \n",
+ " 'Press_mm_hg': 'Press_mm_hg', 'RH_out': 'Humidity_Outside', 'Windspeed': 'Windspeed', \n",
+ " 'Visibility': 'Visibility', 'Tdewpoint': 'T_Dewpoint', 'rv1': 'Random_Var1', 'rv2': 'Random_Var2'}\n",
+ "\n",
+ "df = df.rename(columns = column_names)\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "id": "c994f4e7",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " Date | \n",
+ " Appliances | \n",
+ " Lights | \n",
+ " Temp_Kitchen | \n",
+ " Humidity_Kitchen | \n",
+ " Temp_LivingRoom | \n",
+ " Humidity_LivingRoom | \n",
+ " Temp_LaundryRoom | \n",
+ " Humidity_LaundryRoom | \n",
+ " Temp_Office | \n",
+ " ... | \n",
+ " Temp_ParentsRoom | \n",
+ " Humidity_ParentsRoom | \n",
+ " Temp_Outside | \n",
+ " Press_mm_hg | \n",
+ " Humidity_Outside | \n",
+ " Windspeed | \n",
+ " Visibility | \n",
+ " T_Dewpoint | \n",
+ " Random_Var1 | \n",
+ " Random_Var2 | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " 2016-01-11 17:00:00 | \n",
+ " 60 | \n",
+ " 30 | \n",
+ " 19.89 | \n",
+ " 47.596667 | \n",
+ " 19.2 | \n",
+ " 44.790000 | \n",
+ " 19.79 | \n",
+ " 44.730000 | \n",
+ " 19.000000 | \n",
+ " ... | \n",
+ " 17.033333 | \n",
+ " 45.53 | \n",
+ " 6.600000 | \n",
+ " 733.5 | \n",
+ " 92.0 | \n",
+ " 7.000000 | \n",
+ " 63.000000 | \n",
+ " 5.3 | \n",
+ " 13.275433 | \n",
+ " 13.275433 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " 2016-01-11 17:10:00 | \n",
+ " 60 | \n",
+ " 30 | \n",
+ " 19.89 | \n",
+ " 46.693333 | \n",
+ " 19.2 | \n",
+ " 44.722500 | \n",
+ " 19.79 | \n",
+ " 44.790000 | \n",
+ " 19.000000 | \n",
+ " ... | \n",
+ " 17.066667 | \n",
+ " 45.56 | \n",
+ " 6.483333 | \n",
+ " 733.6 | \n",
+ " 92.0 | \n",
+ " 6.666667 | \n",
+ " 59.166667 | \n",
+ " 5.2 | \n",
+ " 18.606195 | \n",
+ " 18.606195 | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " 2016-01-11 17:20:00 | \n",
+ " 50 | \n",
+ " 30 | \n",
+ " 19.89 | \n",
+ " 46.300000 | \n",
+ " 19.2 | \n",
+ " 44.626667 | \n",
+ " 19.79 | \n",
+ " 44.933333 | \n",
+ " 18.926667 | \n",
+ " ... | \n",
+ " 17.000000 | \n",
+ " 45.50 | \n",
+ " 6.366667 | \n",
+ " 733.7 | \n",
+ " 92.0 | \n",
+ " 6.333333 | \n",
+ " 55.333333 | \n",
+ " 5.1 | \n",
+ " 28.642668 | \n",
+ " 28.642668 | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " 2016-01-11 17:30:00 | \n",
+ " 50 | \n",
+ " 40 | \n",
+ " 19.89 | \n",
+ " 46.066667 | \n",
+ " 19.2 | \n",
+ " 44.590000 | \n",
+ " 19.79 | \n",
+ " 45.000000 | \n",
+ " 18.890000 | \n",
+ " ... | \n",
+ " 17.000000 | \n",
+ " 45.40 | \n",
+ " 6.250000 | \n",
+ " 733.8 | \n",
+ " 92.0 | \n",
+ " 6.000000 | \n",
+ " 51.500000 | \n",
+ " 5.0 | \n",
+ " 45.410389 | \n",
+ " 45.410389 | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " 2016-01-11 17:40:00 | \n",
+ " 60 | \n",
+ " 40 | \n",
+ " 19.89 | \n",
+ " 46.333333 | \n",
+ " 19.2 | \n",
+ " 44.530000 | \n",
+ " 19.79 | \n",
+ " 45.000000 | \n",
+ " 18.890000 | \n",
+ " ... | \n",
+ " 17.000000 | \n",
+ " 45.40 | \n",
+ " 6.133333 | \n",
+ " 733.9 | \n",
+ " 92.0 | \n",
+ " 5.666667 | \n",
+ " 47.666667 | \n",
+ " 4.9 | \n",
+ " 10.084097 | \n",
+ " 10.084097 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
5 rows × 29 columns
\n",
+ "
"
+ ],
+ "text/plain": [
+ " Date Appliances Lights Temp_Kitchen Humidity_Kitchen \\\n",
+ "0 2016-01-11 17:00:00 60 30 19.89 47.596667 \n",
+ "1 2016-01-11 17:10:00 60 30 19.89 46.693333 \n",
+ "2 2016-01-11 17:20:00 50 30 19.89 46.300000 \n",
+ "3 2016-01-11 17:30:00 50 40 19.89 46.066667 \n",
+ "4 2016-01-11 17:40:00 60 40 19.89 46.333333 \n",
+ "\n",
+ " Temp_LivingRoom Humidity_LivingRoom Temp_LaundryRoom \\\n",
+ "0 19.2 44.790000 19.79 \n",
+ "1 19.2 44.722500 19.79 \n",
+ "2 19.2 44.626667 19.79 \n",
+ "3 19.2 44.590000 19.79 \n",
+ "4 19.2 44.530000 19.79 \n",
+ "\n",
+ " Humidity_LaundryRoom Temp_Office ... Temp_ParentsRoom \\\n",
+ "0 44.730000 19.000000 ... 17.033333 \n",
+ "1 44.790000 19.000000 ... 17.066667 \n",
+ "2 44.933333 18.926667 ... 17.000000 \n",
+ "3 45.000000 18.890000 ... 17.000000 \n",
+ "4 45.000000 18.890000 ... 17.000000 \n",
+ "\n",
+ " Humidity_ParentsRoom Temp_Outside Press_mm_hg Humidity_Outside \\\n",
+ "0 45.53 6.600000 733.5 92.0 \n",
+ "1 45.56 6.483333 733.6 92.0 \n",
+ "2 45.50 6.366667 733.7 92.0 \n",
+ "3 45.40 6.250000 733.8 92.0 \n",
+ "4 45.40 6.133333 733.9 92.0 \n",
+ "\n",
+ " Windspeed Visibility T_Dewpoint Random_Var1 Random_Var2 \n",
+ "0 7.000000 63.000000 5.3 13.275433 13.275433 \n",
+ "1 6.666667 59.166667 5.2 18.606195 18.606195 \n",
+ "2 6.333333 55.333333 5.1 28.642668 28.642668 \n",
+ "3 6.000000 51.500000 5.0 45.410389 45.410389 \n",
+ "4 5.666667 47.666667 4.9 10.084097 10.084097 \n",
+ "\n",
+ "[5 rows x 29 columns]"
+ ]
+ },
+ "execution_count": 9,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df.head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "id": "bd0de804",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Dropping Columns\n",
+ "df.drop(['Date', 'Lights'], inplace=True, axis=1)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "id": "f34809bc",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " Appliances | \n",
+ " Temp_Kitchen | \n",
+ " Humidity_Kitchen | \n",
+ " Temp_LivingRoom | \n",
+ " Humidity_LivingRoom | \n",
+ " Temp_LaundryRoom | \n",
+ " Humidity_LaundryRoom | \n",
+ " Temp_Office | \n",
+ " Humidity_Office | \n",
+ " Temp_Bathroom | \n",
+ " ... | \n",
+ " Temp_ParentsRoom | \n",
+ " Humidity_ParentsRoom | \n",
+ " Temp_Outside | \n",
+ " Press_mm_hg | \n",
+ " Humidity_Outside | \n",
+ " Windspeed | \n",
+ " Visibility | \n",
+ " T_Dewpoint | \n",
+ " Random_Var1 | \n",
+ " Random_Var2 | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " 60 | \n",
+ " 19.89 | \n",
+ " 47.596667 | \n",
+ " 19.2 | \n",
+ " 44.790000 | \n",
+ " 19.79 | \n",
+ " 44.730000 | \n",
+ " 19.000000 | \n",
+ " 45.566667 | \n",
+ " 17.166667 | \n",
+ " ... | \n",
+ " 17.033333 | \n",
+ " 45.53 | \n",
+ " 6.600000 | \n",
+ " 733.5 | \n",
+ " 92.0 | \n",
+ " 7.000000 | \n",
+ " 63.000000 | \n",
+ " 5.3 | \n",
+ " 13.275433 | \n",
+ " 13.275433 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " 60 | \n",
+ " 19.89 | \n",
+ " 46.693333 | \n",
+ " 19.2 | \n",
+ " 44.722500 | \n",
+ " 19.79 | \n",
+ " 44.790000 | \n",
+ " 19.000000 | \n",
+ " 45.992500 | \n",
+ " 17.166667 | \n",
+ " ... | \n",
+ " 17.066667 | \n",
+ " 45.56 | \n",
+ " 6.483333 | \n",
+ " 733.6 | \n",
+ " 92.0 | \n",
+ " 6.666667 | \n",
+ " 59.166667 | \n",
+ " 5.2 | \n",
+ " 18.606195 | \n",
+ " 18.606195 | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " 50 | \n",
+ " 19.89 | \n",
+ " 46.300000 | \n",
+ " 19.2 | \n",
+ " 44.626667 | \n",
+ " 19.79 | \n",
+ " 44.933333 | \n",
+ " 18.926667 | \n",
+ " 45.890000 | \n",
+ " 17.166667 | \n",
+ " ... | \n",
+ " 17.000000 | \n",
+ " 45.50 | \n",
+ " 6.366667 | \n",
+ " 733.7 | \n",
+ " 92.0 | \n",
+ " 6.333333 | \n",
+ " 55.333333 | \n",
+ " 5.1 | \n",
+ " 28.642668 | \n",
+ " 28.642668 | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " 50 | \n",
+ " 19.89 | \n",
+ " 46.066667 | \n",
+ " 19.2 | \n",
+ " 44.590000 | \n",
+ " 19.79 | \n",
+ " 45.000000 | \n",
+ " 18.890000 | \n",
+ " 45.723333 | \n",
+ " 17.166667 | \n",
+ " ... | \n",
+ " 17.000000 | \n",
+ " 45.40 | \n",
+ " 6.250000 | \n",
+ " 733.8 | \n",
+ " 92.0 | \n",
+ " 6.000000 | \n",
+ " 51.500000 | \n",
+ " 5.0 | \n",
+ " 45.410389 | \n",
+ " 45.410389 | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " 60 | \n",
+ " 19.89 | \n",
+ " 46.333333 | \n",
+ " 19.2 | \n",
+ " 44.530000 | \n",
+ " 19.79 | \n",
+ " 45.000000 | \n",
+ " 18.890000 | \n",
+ " 45.530000 | \n",
+ " 17.200000 | \n",
+ " ... | \n",
+ " 17.000000 | \n",
+ " 45.40 | \n",
+ " 6.133333 | \n",
+ " 733.9 | \n",
+ " 92.0 | \n",
+ " 5.666667 | \n",
+ " 47.666667 | \n",
+ " 4.9 | \n",
+ " 10.084097 | \n",
+ " 10.084097 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
5 rows × 27 columns
\n",
+ "
"
+ ],
+ "text/plain": [
+ " Appliances Temp_Kitchen Humidity_Kitchen Temp_LivingRoom \\\n",
+ "0 60 19.89 47.596667 19.2 \n",
+ "1 60 19.89 46.693333 19.2 \n",
+ "2 50 19.89 46.300000 19.2 \n",
+ "3 50 19.89 46.066667 19.2 \n",
+ "4 60 19.89 46.333333 19.2 \n",
+ "\n",
+ " Humidity_LivingRoom Temp_LaundryRoom Humidity_LaundryRoom Temp_Office \\\n",
+ "0 44.790000 19.79 44.730000 19.000000 \n",
+ "1 44.722500 19.79 44.790000 19.000000 \n",
+ "2 44.626667 19.79 44.933333 18.926667 \n",
+ "3 44.590000 19.79 45.000000 18.890000 \n",
+ "4 44.530000 19.79 45.000000 18.890000 \n",
+ "\n",
+ " Humidity_Office Temp_Bathroom ... Temp_ParentsRoom \\\n",
+ "0 45.566667 17.166667 ... 17.033333 \n",
+ "1 45.992500 17.166667 ... 17.066667 \n",
+ "2 45.890000 17.166667 ... 17.000000 \n",
+ "3 45.723333 17.166667 ... 17.000000 \n",
+ "4 45.530000 17.200000 ... 17.000000 \n",
+ "\n",
+ " Humidity_ParentsRoom Temp_Outside Press_mm_hg Humidity_Outside \\\n",
+ "0 45.53 6.600000 733.5 92.0 \n",
+ "1 45.56 6.483333 733.6 92.0 \n",
+ "2 45.50 6.366667 733.7 92.0 \n",
+ "3 45.40 6.250000 733.8 92.0 \n",
+ "4 45.40 6.133333 733.9 92.0 \n",
+ "\n",
+ " Windspeed Visibility T_Dewpoint Random_Var1 Random_Var2 \n",
+ "0 7.000000 63.000000 5.3 13.275433 13.275433 \n",
+ "1 6.666667 59.166667 5.2 18.606195 18.606195 \n",
+ "2 6.333333 55.333333 5.1 28.642668 28.642668 \n",
+ "3 6.000000 51.500000 5.0 45.410389 45.410389 \n",
+ "4 5.666667 47.666667 4.9 10.084097 10.084097 \n",
+ "\n",
+ "[5 rows x 27 columns]"
+ ]
+ },
+ "execution_count": 11,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df.head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "id": "5249c0c4",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Data Normalization\n",
+ "from sklearn.preprocessing import MinMaxScaler\n",
+ "scaler = MinMaxScaler()\n",
+ "normalised_df = pd.DataFrame(scaler.fit_transform(df), columns = df.columns)\n",
+ "features_df = normalised_df.drop(columns = ['Appliances'])\n",
+ "appliances_target = normalised_df['Appliances']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 14,
+ "id": "4bb31164",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " Temp_Kitchen | \n",
+ " Humidity_Kitchen | \n",
+ " Temp_LivingRoom | \n",
+ " Humidity_LivingRoom | \n",
+ " Temp_LaundryRoom | \n",
+ " Humidity_LaundryRoom | \n",
+ " Temp_Office | \n",
+ " Humidity_Office | \n",
+ " Temp_Bathroom | \n",
+ " Humidity_Bathroom | \n",
+ " ... | \n",
+ " Temp_ParentsRoom | \n",
+ " Humidity_ParentsRoom | \n",
+ " Temp_Outside | \n",
+ " Press_mm_hg | \n",
+ " Humidity_Outside | \n",
+ " Windspeed | \n",
+ " Visibility | \n",
+ " T_Dewpoint | \n",
+ " Random_Var1 | \n",
+ " Random_Var2 | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " 0.32735 | \n",
+ " 0.566187 | \n",
+ " 0.225345 | \n",
+ " 0.684038 | \n",
+ " 0.215188 | \n",
+ " 0.746066 | \n",
+ " 0.351351 | \n",
+ " 0.764262 | \n",
+ " 0.175506 | \n",
+ " 0.381691 | \n",
+ " ... | \n",
+ " 0.223032 | \n",
+ " 0.677290 | \n",
+ " 0.372990 | \n",
+ " 0.097674 | \n",
+ " 0.894737 | \n",
+ " 0.500000 | \n",
+ " 0.953846 | \n",
+ " 0.538462 | \n",
+ " 0.265449 | \n",
+ " 0.265449 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " 0.32735 | \n",
+ " 0.541326 | \n",
+ " 0.225345 | \n",
+ " 0.682140 | \n",
+ " 0.215188 | \n",
+ " 0.748871 | \n",
+ " 0.351351 | \n",
+ " 0.782437 | \n",
+ " 0.175506 | \n",
+ " 0.381691 | \n",
+ " ... | \n",
+ " 0.226500 | \n",
+ " 0.678532 | \n",
+ " 0.369239 | \n",
+ " 0.100000 | \n",
+ " 0.894737 | \n",
+ " 0.476190 | \n",
+ " 0.894872 | \n",
+ " 0.533937 | \n",
+ " 0.372083 | \n",
+ " 0.372083 | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " 0.32735 | \n",
+ " 0.530502 | \n",
+ " 0.225345 | \n",
+ " 0.679445 | \n",
+ " 0.215188 | \n",
+ " 0.755569 | \n",
+ " 0.344745 | \n",
+ " 0.778062 | \n",
+ " 0.175506 | \n",
+ " 0.380037 | \n",
+ " ... | \n",
+ " 0.219563 | \n",
+ " 0.676049 | \n",
+ " 0.365488 | \n",
+ " 0.102326 | \n",
+ " 0.894737 | \n",
+ " 0.452381 | \n",
+ " 0.835897 | \n",
+ " 0.529412 | \n",
+ " 0.572848 | \n",
+ " 0.572848 | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " 0.32735 | \n",
+ " 0.524080 | \n",
+ " 0.225345 | \n",
+ " 0.678414 | \n",
+ " 0.215188 | \n",
+ " 0.758685 | \n",
+ " 0.341441 | \n",
+ " 0.770949 | \n",
+ " 0.175506 | \n",
+ " 0.380037 | \n",
+ " ... | \n",
+ " 0.219563 | \n",
+ " 0.671909 | \n",
+ " 0.361736 | \n",
+ " 0.104651 | \n",
+ " 0.894737 | \n",
+ " 0.428571 | \n",
+ " 0.776923 | \n",
+ " 0.524887 | \n",
+ " 0.908261 | \n",
+ " 0.908261 | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " 0.32735 | \n",
+ " 0.531419 | \n",
+ " 0.225345 | \n",
+ " 0.676727 | \n",
+ " 0.215188 | \n",
+ " 0.758685 | \n",
+ " 0.341441 | \n",
+ " 0.762697 | \n",
+ " 0.178691 | \n",
+ " 0.380037 | \n",
+ " ... | \n",
+ " 0.219563 | \n",
+ " 0.671909 | \n",
+ " 0.357985 | \n",
+ " 0.106977 | \n",
+ " 0.894737 | \n",
+ " 0.404762 | \n",
+ " 0.717949 | \n",
+ " 0.520362 | \n",
+ " 0.201611 | \n",
+ " 0.201611 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
5 rows × 26 columns
\n",
+ "
"
+ ],
+ "text/plain": [
+ " Temp_Kitchen Humidity_Kitchen Temp_LivingRoom Humidity_LivingRoom \\\n",
+ "0 0.32735 0.566187 0.225345 0.684038 \n",
+ "1 0.32735 0.541326 0.225345 0.682140 \n",
+ "2 0.32735 0.530502 0.225345 0.679445 \n",
+ "3 0.32735 0.524080 0.225345 0.678414 \n",
+ "4 0.32735 0.531419 0.225345 0.676727 \n",
+ "\n",
+ " Temp_LaundryRoom Humidity_LaundryRoom Temp_Office Humidity_Office \\\n",
+ "0 0.215188 0.746066 0.351351 0.764262 \n",
+ "1 0.215188 0.748871 0.351351 0.782437 \n",
+ "2 0.215188 0.755569 0.344745 0.778062 \n",
+ "3 0.215188 0.758685 0.341441 0.770949 \n",
+ "4 0.215188 0.758685 0.341441 0.762697 \n",
+ "\n",
+ " Temp_Bathroom Humidity_Bathroom ... Temp_ParentsRoom \\\n",
+ "0 0.175506 0.381691 ... 0.223032 \n",
+ "1 0.175506 0.381691 ... 0.226500 \n",
+ "2 0.175506 0.380037 ... 0.219563 \n",
+ "3 0.175506 0.380037 ... 0.219563 \n",
+ "4 0.178691 0.380037 ... 0.219563 \n",
+ "\n",
+ " Humidity_ParentsRoom Temp_Outside Press_mm_hg Humidity_Outside \\\n",
+ "0 0.677290 0.372990 0.097674 0.894737 \n",
+ "1 0.678532 0.369239 0.100000 0.894737 \n",
+ "2 0.676049 0.365488 0.102326 0.894737 \n",
+ "3 0.671909 0.361736 0.104651 0.894737 \n",
+ "4 0.671909 0.357985 0.106977 0.894737 \n",
+ "\n",
+ " Windspeed Visibility T_Dewpoint Random_Var1 Random_Var2 \n",
+ "0 0.500000 0.953846 0.538462 0.265449 0.265449 \n",
+ "1 0.476190 0.894872 0.533937 0.372083 0.372083 \n",
+ "2 0.452381 0.835897 0.529412 0.572848 0.572848 \n",
+ "3 0.428571 0.776923 0.524887 0.908261 0.908261 \n",
+ "4 0.404762 0.717949 0.520362 0.201611 0.201611 \n",
+ "\n",
+ "[5 rows x 26 columns]"
+ ]
+ },
+ "execution_count": 14,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "features_df.head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 15,
+ "id": "d4ac60a9",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# spliting data into training and test set i 70-30 with 42 random_state.\n",
+ "from sklearn.model_selection import train_test_split\n",
+ "x_train, x_test, y_train, y_test = train_test_split(features_df, \n",
+ " appliances_target, test_size=0.3, \n",
+ " random_state=42)\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 17,
+ "id": "9c38ba2a",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "from sklearn.linear_model import LinearRegression\n",
+ "linear_model = LinearRegression()\n",
+ "linear_model.fit(x_train, y_train)\n",
+ "predicted_values = linear_model.predict(x_test)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 20,
+ "id": "e83416a6",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "45.35"
+ ]
+ },
+ "execution_count": 20,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# Q.14\n",
+ "import numpy as np\n",
+ "rss = np.sum(np.square(y_test - predicted_values))\n",
+ "round(rss, 2)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 23,
+ "id": "2ab99def",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "0.088"
+ ]
+ },
+ "execution_count": 23,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# Q.15\n",
+ "from sklearn.metrics import mean_squared_error\n",
+ "rms = np.sqrt(mean_squared_error(y_test, predicted_values))\n",
+ "round(rms, 3)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 22,
+ "id": "599d3b2c",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "0.05"
+ ]
+ },
+ "execution_count": 22,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# Q.13\n",
+ "from sklearn.metrics import mean_absolute_error\n",
+ "mean = mean_absolute_error(y_test, predicted_values)\n",
+ "round(mean,2)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 41,
+ "id": "fa27a198",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Features Humidity_Kitchen\n",
+ "Linear_Model_Weight 0.553547\n",
+ "Name: 25, dtype: object\n",
+ "Features Humidity_LivingRoom\n",
+ "Linear_Model_Weight -0.456698\n",
+ "Name: 0, dtype: object\n"
+ ]
+ }
+ ],
+ "source": [
+ "# Q.17\n",
+ "def get_weights_df(model, feat, column_name):\n",
+ " weights = pd.Series(model.coef_, feat.columns).sort_values()\n",
+ " weights_df = pd.DataFrame(weights).reset_index()\n",
+ " weights_df.columns = ['Features', column_name]\n",
+ " weights_df[column_name].round(3)\n",
+ " return weights_df\n",
+ "\n",
+ "linear_model_weights = get_weights_df(linear_model, x_train, 'Linear_Model_Weight')\n",
+ "\n",
+ "print(linear_model_weights.iloc[linear_model_weights['Linear_Model_Weight'].idxmax()])\n",
+ "\n",
+ "print(linear_model_weights.iloc[linear_model_weights['Linear_Model_Weight'].idxmin()])"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 35,
+ "id": "4ba26e82",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Lasso Regression\n",
+ "from sklearn.linear_model import Lasso\n",
+ "\n",
+ "lasso_R = Lasso(alpha=0.001)\n",
+ "lasso_R.fit(x_train, y_train)\n",
+ "lasso_pred = lasso_R.predict(x_test)\n",
+ "\n",
+ "lasso_weight = get_weights_df(lasso_R, x_train, 'Lasso_weight')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 37,
+ "id": "68417d8f",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "0.025\n",
+ " Features Lasso_weight\n",
+ "0 Humidity_Outside -0.049557\n",
+ "1 Humidity_TeenagerRoom -0.000110\n",
+ "2 Temp_Kitchen 0.000000\n",
+ "3 T_Dewpoint 0.000000\n",
+ "4 Visibility 0.000000\n",
+ "5 Press_mm_hg -0.000000\n",
+ "6 Temp_Outside 0.000000\n",
+ "7 Humidity_ParentsRoom -0.000000\n",
+ "8 Temp_ParentsRoom -0.000000\n",
+ "9 Temp_TeenagerRoom 0.000000\n",
+ "10 Humidity_IroningRoom -0.000000\n",
+ "11 Random_Var1 -0.000000\n",
+ "12 Temp_IroningRoom -0.000000\n",
+ "13 Temp_Outside_Building 0.000000\n",
+ "14 Humidity_Bathroom 0.000000\n",
+ "15 Temp_Bathroom -0.000000\n",
+ "16 Humidity_Office 0.000000\n",
+ "17 Temp_Office -0.000000\n",
+ "18 Humidity_LaundryRoom 0.000000\n",
+ "19 Temp_LaundryRoom 0.000000\n",
+ "20 Humidity_LivingRoom -0.000000\n",
+ "21 Temp_LivingRoom 0.000000\n",
+ "22 Humidity_Outside_Building -0.000000\n",
+ "23 Random_Var2 -0.000000\n",
+ "24 Windspeed 0.002912\n",
+ "25 Humidity_Kitchen 0.017880\n"
+ ]
+ }
+ ],
+ "source": [
+ "print(lasso_R.score(x_train, y_train).round(3))\n",
+ "print(lasso_weight)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 38,
+ "id": "bcfad006",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "4\n"
+ ]
+ }
+ ],
+ "source": [
+ "# Q.19\n",
+ "print((lasso_weights_df['Lasso_weight'] != 0).sum())"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 40,
+ "id": "884998b5",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "0.094"
+ ]
+ },
+ "execution_count": 40,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# Q20\n",
+ "lasso_rmse = np.sqrt(mean_squared_error(y_test, lasso_pred))\n",
+ "round(lasso_rmse, 3)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "be32cb67",
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "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.11"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}
diff --git a/Predicting Energy Efficiency of Buildings/README.md b/Predicting Energy Efficiency of Buildings/README.md
new file mode 100644
index 0000000..60c4eb4
--- /dev/null
+++ b/Predicting Energy Efficiency of Buildings/README.md
@@ -0,0 +1,5 @@
+we will develop a multivariate multiple regression model to study the effect of eight input variables on two output variables, which are the heating load and the cooling load, of residential buildings.
+you will learn about simple linear regression and the different assumptions made by simple linear regression models.
+you will learn about multiple linear regression and assumptions made by multiple linear regression models.
+you will learn about different evaluation metrics for measuring regression performance.
+ou will learn about regularization as a method to make complex models simpler by penalising coefficients to reduce their magnitude, variance in the training set and in turn, reduce overfitting in the model.