{ "cells": [ { "cell_type": "code", "execution_count": 50, "id": "172bbe8a", "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "from sklearn.model_selection import train_test_split\n", "from sklearn.preprocessing import StandardScaler, MinMaxScaler, OneHotEncoder,OrdinalEncoder\n", "from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score\n", "from sklearn.model_selection import train_test_split\n", "from sklearn.linear_model import LinearRegression, Ridge, Lasso, ElasticNet\n", "from sklearn.ensemble import RandomForestRegressor, GradientBoostingRegressor, ExtraTreesRegressor ,AdaBoostRegressor\n", "from sklearn.tree import DecisionTreeRegressor\n", "from sklearn.svm import SVR\n", "from sklearn.neighbors import KNeighborsRegressor\n", "from xgboost import XGBRegressor" ] }, { "cell_type": "code", "execution_count": 51, "id": "28366097", "metadata": {}, "outputs": [], "source": [ "from joblib import dump\n", "from tensorflow.keras.models import Sequential\n", "from tensorflow.keras.layers import Input,Dense,BatchNormalization,Dropout" ] }, { "cell_type": "code", "execution_count": 52, "id": "ce283af0", "metadata": {}, "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", "
citylatitudelongitudeinit_timetimepoint_hrtemperature_ccloud_coverlifted_indexprecipitation_typeprecipitation_amountrelative_humiditywind_directionwind_speedweatherforecast_datetimeforecast_date
0Agartala23.83191.2872026-03-29 12:00:001222.012.0rain098S2.0ishowerday2026-03-30 00:00:002026-03-30
1Agartala23.83191.2872026-03-29 12:00:001528.01-1.0rain065S3.0ishowerday2026-03-30 03:00:002026-03-30
2Agartala23.83191.2872026-03-29 12:00:001833.02-1.0rain054SW3.0ishowerday2026-03-30 06:00:002026-03-30
3Agartala23.83191.2872026-03-29 12:00:002130.08-1.0none051S3.0cloudyday2026-03-30 09:00:002026-03-30
4Agartala23.83191.2872026-03-29 12:00:002426.06-1.0rain082SW3.0oshowerday2026-03-30 12:00:002026-03-30
\n", "
" ], "text/plain": [ " city latitude longitude init_time timepoint_hr \\\n", "0 Agartala 23.831 91.287 2026-03-29 12:00:00 12 \n", "1 Agartala 23.831 91.287 2026-03-29 12:00:00 15 \n", "2 Agartala 23.831 91.287 2026-03-29 12:00:00 18 \n", "3 Agartala 23.831 91.287 2026-03-29 12:00:00 21 \n", "4 Agartala 23.831 91.287 2026-03-29 12:00:00 24 \n", "\n", " temperature_c cloud_cover lifted_index precipitation_type \\\n", "0 22.0 1 2.0 rain \n", "1 28.0 1 -1.0 rain \n", "2 33.0 2 -1.0 rain \n", "3 30.0 8 -1.0 none \n", "4 26.0 6 -1.0 rain \n", "\n", " precipitation_amount relative_humidity wind_direction wind_speed \\\n", "0 0 98 S 2.0 \n", "1 0 65 S 3.0 \n", "2 0 54 SW 3.0 \n", "3 0 51 S 3.0 \n", "4 0 82 SW 3.0 \n", "\n", " weather forecast_datetime forecast_date \n", "0 ishowerday 2026-03-30 00:00:00 2026-03-30 \n", "1 ishowerday 2026-03-30 03:00:00 2026-03-30 \n", "2 ishowerday 2026-03-30 06:00:00 2026-03-30 \n", "3 cloudyday 2026-03-30 09:00:00 2026-03-30 \n", "4 oshowerday 2026-03-30 12:00:00 2026-03-30 " ] }, "execution_count": 52, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df = pd.read_csv(\"india_weather_103cities_30mar_13apr.csv\")\n", "df.head()" ] }, { "cell_type": "code", "execution_count": 53, "id": "f4e732ed", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array(['Agartala', 'Agra', 'Ahmedabad', 'Aizawl', 'Ajmer', 'Akola',\n", " 'Aligarh', 'Allahabad', 'Ambattur', 'Amravati', 'Amritsar',\n", " 'Asansol', 'Aurangabad', 'Bangalore', 'Bareilly', 'Belgaum',\n", " 'Bhavnagar', 'Bhilai', 'Bhiwandi', 'Bhopal', 'Bhubaneswar',\n", " 'Bikaner', 'Chandigarh', 'Chennai', 'Coimbatore', 'Cuttack',\n", " 'Dehradun', 'Delhi', 'Dhanbad', 'Durgapur', 'Erode', 'Faridabad',\n", " 'Firozabad', 'Gangtok', 'Gaya', 'Ghaziabad', 'Gorakhpur',\n", " 'Gulbarga', 'Guntur', 'Guwahati', 'Gwalior', 'Howrah', 'Hubli',\n", " 'Hyderabad', 'Imphal', 'Indore', 'Itanagar', 'Jabalpur', 'Jaipur',\n", " 'Jalandhar', 'Jammu', 'Jamnagar', 'Jamshedpur', 'Jhansi',\n", " 'Jodhpur', 'Kanpur', 'Kochi', 'Kolhapur', 'Kolkata', 'Kota',\n", " 'Loni', 'Lucknow', 'Ludhiana', 'Madurai', 'Malegaon', 'Mangalore',\n", " 'Meerut', 'Moradabad', 'Mumbai', 'Mysore', 'Nagpur', 'Nanded',\n", " 'Nashik', 'Navi Mumbai', 'Nellore', 'Noida', 'Panaji', 'Patna',\n", " 'Pune', 'Raipur', 'Rajkot', 'Ranchi', 'Rourkela', 'Saharanpur',\n", " 'Salem', 'Sangli', 'Shillong', 'Shimla', 'Siliguri', 'Solapur',\n", " 'Srinagar', 'Thane', 'Tiruchirappalli', 'Tirunelveli', 'Tiruppur',\n", " 'Udaipur', 'Ujjain', 'Ulhasnagar', 'Vadodara', 'Varanasi',\n", " 'Vijayawada', 'Visakhapatnam', 'Warangal'], dtype=object)" ] }, "execution_count": 53, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df[\"city\"].unique()" ] }, { "cell_type": "code", "execution_count": 54, "id": "45999d84", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Index(['city', 'latitude', 'longitude', 'init_time', 'timepoint_hr',\n", " 'temperature_c', 'cloud_cover', 'lifted_index', 'precipitation_type',\n", " 'precipitation_amount', 'relative_humidity', 'wind_direction',\n", " 'wind_speed', 'weather', 'forecast_datetime', 'forecast_date'],\n", " dtype='object')" ] }, "execution_count": 54, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.columns" ] }, { "cell_type": "code", "execution_count": 55, "id": "ef16dbf0", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(12360, 16)" ] }, "execution_count": 55, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.shape" ] }, { "cell_type": "code", "execution_count": 56, "id": "2ce2aa84", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 12360 entries, 0 to 12359\n", "Data columns (total 16 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 city 12360 non-null object \n", " 1 latitude 12360 non-null float64\n", " 2 longitude 12360 non-null float64\n", " 3 init_time 12360 non-null object \n", " 4 timepoint_hr 12360 non-null int64 \n", " 5 temperature_c 12360 non-null float64\n", " 6 cloud_cover 12360 non-null int64 \n", " 7 lifted_index 12360 non-null float64\n", " 8 precipitation_type 12360 non-null object \n", " 9 precipitation_amount 12360 non-null int64 \n", " 10 relative_humidity 12360 non-null int64 \n", " 11 wind_direction 12360 non-null object \n", " 12 wind_speed 12360 non-null float64\n", " 13 weather 12360 non-null object \n", " 14 forecast_datetime 12360 non-null object \n", " 15 forecast_date 12360 non-null object \n", "dtypes: float64(5), int64(4), object(7)\n", "memory usage: 1.5+ MB\n" ] } ], "source": [ "df.info()" ] }, { "cell_type": "code", "execution_count": 57, "id": "51a4d361", "metadata": {}, "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", "
latitudelongitudetimepoint_hrtemperature_ccloud_coverlifted_indexprecipitation_amountrelative_humiditywind_speed
count12360.00000012360.00000012360.00000012360.00000012360.00000012360.00000012360.00000012360.00000012360.000000
mean22.16306879.080563190.50000027.8882694.7431230.8512940.11739525.0384302.321926
std5.9039395.392870103.9236446.1614913.0997842.7357780.92377424.2948330.515482
min8.71300070.06700012.000000-1.0000001.000000-10.000000-6.000000-2.0000001.000000
25%17.97800075.124000101.25000024.0000001.000000-1.0000000.0000006.0000002.000000
50%22.80200077.706000190.50000028.0000005.0000002.0000000.00000014.0000002.000000
75%26.76000081.378000279.75000032.0000008.0000002.0000000.00000039.0000003.000000
max34.08400093.950000369.00000044.0000009.00000015.0000006.00000099.0000005.000000
\n", "
" ], "text/plain": [ " latitude longitude timepoint_hr temperature_c cloud_cover \\\n", "count 12360.000000 12360.000000 12360.000000 12360.000000 12360.000000 \n", "mean 22.163068 79.080563 190.500000 27.888269 4.743123 \n", "std 5.903939 5.392870 103.923644 6.161491 3.099784 \n", "min 8.713000 70.067000 12.000000 -1.000000 1.000000 \n", "25% 17.978000 75.124000 101.250000 24.000000 1.000000 \n", "50% 22.802000 77.706000 190.500000 28.000000 5.000000 \n", "75% 26.760000 81.378000 279.750000 32.000000 8.000000 \n", "max 34.084000 93.950000 369.000000 44.000000 9.000000 \n", "\n", " lifted_index precipitation_amount relative_humidity wind_speed \n", "count 12360.000000 12360.000000 12360.000000 12360.000000 \n", "mean 0.851294 0.117395 25.038430 2.321926 \n", "std 2.735778 0.923774 24.294833 0.515482 \n", "min -10.000000 -6.000000 -2.000000 1.000000 \n", "25% -1.000000 0.000000 6.000000 2.000000 \n", "50% 2.000000 0.000000 14.000000 2.000000 \n", "75% 2.000000 0.000000 39.000000 3.000000 \n", "max 15.000000 6.000000 99.000000 5.000000 " ] }, "execution_count": 57, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.describe()" ] }, { "cell_type": "code", "execution_count": 58, "id": "bdf69082", "metadata": {}, "outputs": [], "source": [ "df.dropna(inplace=True)" ] }, { "cell_type": "code", "execution_count": 59, "id": "fc429b37", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "np.int64(0)" ] }, "execution_count": 59, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.duplicated().sum()\n" ] }, { "cell_type": "code", "execution_count": 60, "id": "1f35de3a", "metadata": {}, "outputs": [], "source": [ "df.drop_duplicates(inplace=True)" ] }, { "cell_type": "code", "execution_count": 61, "id": "5fe9c3cf", "metadata": {}, "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", "
citylatitudelongitudeinit_timetimepoint_hrtemperature_ccloud_coverlifted_indexprecipitation_typeprecipitation_amountrelative_humiditywind_directionwind_speedweatherforecast_datetimeforecast_date
0Agartala23.83191.2872026-03-29 12:00:001222.012.0rain098S2.0ishowerday2026-03-30 00:00:002026-03-30
1Agartala23.83191.2872026-03-29 12:00:001528.01-1.0rain065S3.0ishowerday2026-03-30 03:00:002026-03-30
2Agartala23.83191.2872026-03-29 12:00:001833.02-1.0rain054SW3.0ishowerday2026-03-30 06:00:002026-03-30
3Agartala23.83191.2872026-03-29 12:00:002130.08-1.0none051S3.0cloudyday2026-03-30 09:00:002026-03-30
4Agartala23.83191.2872026-03-29 12:00:002426.06-1.0rain082SW3.0oshowerday2026-03-30 12:00:002026-03-30
\n", "
" ], "text/plain": [ " city latitude longitude init_time timepoint_hr \\\n", "0 Agartala 23.831 91.287 2026-03-29 12:00:00 12 \n", "1 Agartala 23.831 91.287 2026-03-29 12:00:00 15 \n", "2 Agartala 23.831 91.287 2026-03-29 12:00:00 18 \n", "3 Agartala 23.831 91.287 2026-03-29 12:00:00 21 \n", "4 Agartala 23.831 91.287 2026-03-29 12:00:00 24 \n", "\n", " temperature_c cloud_cover lifted_index precipitation_type \\\n", "0 22.0 1 2.0 rain \n", "1 28.0 1 -1.0 rain \n", "2 33.0 2 -1.0 rain \n", "3 30.0 8 -1.0 none \n", "4 26.0 6 -1.0 rain \n", "\n", " precipitation_amount relative_humidity wind_direction wind_speed \\\n", "0 0 98 S 2.0 \n", "1 0 65 S 3.0 \n", "2 0 54 SW 3.0 \n", "3 0 51 S 3.0 \n", "4 0 82 SW 3.0 \n", "\n", " weather forecast_datetime forecast_date \n", "0 ishowerday 2026-03-30 00:00:00 2026-03-30 \n", "1 ishowerday 2026-03-30 03:00:00 2026-03-30 \n", "2 ishowerday 2026-03-30 06:00:00 2026-03-30 \n", "3 cloudyday 2026-03-30 09:00:00 2026-03-30 \n", "4 oshowerday 2026-03-30 12:00:00 2026-03-30 " ] }, "execution_count": 61, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.head()" ] }, { "cell_type": "code", "execution_count": 62, "id": "30d7e6c2", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "city 0\n", "latitude 0\n", "longitude 0\n", "init_time 0\n", "timepoint_hr 0\n", "temperature_c 0\n", "cloud_cover 0\n", "lifted_index 0\n", "precipitation_type 0\n", "precipitation_amount 0\n", "relative_humidity 0\n", "wind_direction 0\n", "wind_speed 0\n", "weather 0\n", "forecast_datetime 0\n", "forecast_date 0\n", "dtype: int64" ] }, "execution_count": 62, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.isnull().sum()" ] }, { "cell_type": "code", "execution_count": 63, "id": "20020776", "metadata": {}, "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", "
latitudelongitudetimepoint_hrtemperature_ccloud_coverlifted_indexprecipitation_typeprecipitation_amountrelative_humiditywind_directionwind_speedweather
023.83191.2871222.012.0rain098S2.0ishowerday
123.83191.2871528.01-1.0rain065S3.0ishowerday
223.83191.2871833.02-1.0rain054SW3.0ishowerday
323.83191.2872130.08-1.0none051S3.0cloudyday
423.83191.2872426.06-1.0rain082SW3.0oshowerday
\n", "
" ], "text/plain": [ " latitude longitude timepoint_hr temperature_c cloud_cover \\\n", "0 23.831 91.287 12 22.0 1 \n", "1 23.831 91.287 15 28.0 1 \n", "2 23.831 91.287 18 33.0 2 \n", "3 23.831 91.287 21 30.0 8 \n", "4 23.831 91.287 24 26.0 6 \n", "\n", " lifted_index precipitation_type precipitation_amount relative_humidity \\\n", "0 2.0 rain 0 98 \n", "1 -1.0 rain 0 65 \n", "2 -1.0 rain 0 54 \n", "3 -1.0 none 0 51 \n", "4 -1.0 rain 0 82 \n", "\n", " wind_direction wind_speed weather \n", "0 S 2.0 ishowerday \n", "1 S 3.0 ishowerday \n", "2 SW 3.0 ishowerday \n", "3 S 3.0 cloudyday \n", "4 SW 3.0 oshowerday " ] }, "execution_count": 63, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.drop(columns=[\"city\",\"init_time\",\"forecast_datetime\",\"forecast_date\"],axis=1,inplace=True)\n", "df.head()" ] }, { "cell_type": "code", "execution_count": 64, "id": "9c25d64f", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array(['S', 'SW', 'SE', 'NE', 'NW', 'W', 'E', 'N'], dtype=object)" ] }, "execution_count": 64, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df[\"wind_direction\"].unique()" ] }, { "cell_type": "code", "execution_count": 65, "id": "9b483e95", "metadata": {}, "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", "
latitudelongitudetimepoint_hrtemperature_ccloud_coverlifted_indexprecipitation_typeprecipitation_amountrelative_humiditywind_directionwind_speedweather
023.83191.2871222.012.0rain0980.02.0ishowerday
123.83191.2871528.01-1.0rain0650.03.0ishowerday
223.83191.2871833.02-1.0rain0541.03.0ishowerday
323.83191.2872130.08-1.0none0510.03.0cloudyday
423.83191.2872426.06-1.0rain0821.03.0oshowerday
\n", "
" ], "text/plain": [ " latitude longitude timepoint_hr temperature_c cloud_cover \\\n", "0 23.831 91.287 12 22.0 1 \n", "1 23.831 91.287 15 28.0 1 \n", "2 23.831 91.287 18 33.0 2 \n", "3 23.831 91.287 21 30.0 8 \n", "4 23.831 91.287 24 26.0 6 \n", "\n", " lifted_index precipitation_type precipitation_amount relative_humidity \\\n", "0 2.0 rain 0 98 \n", "1 -1.0 rain 0 65 \n", "2 -1.0 rain 0 54 \n", "3 -1.0 none 0 51 \n", "4 -1.0 rain 0 82 \n", "\n", " wind_direction wind_speed weather \n", "0 0.0 2.0 ishowerday \n", "1 0.0 3.0 ishowerday \n", "2 1.0 3.0 ishowerday \n", "3 0.0 3.0 cloudyday \n", "4 1.0 3.0 oshowerday " ] }, "execution_count": 65, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ordinal = df[\"wind_direction\"].unique()\n", "\n", "encoder = OrdinalEncoder(categories=[ordinal])\n", "\n", "df[[\"wind_direction\"]] = encoder.fit_transform(df[[\"wind_direction\"]].astype(str))\n", "\n", "df.head()" ] }, { "cell_type": "code", "execution_count": 66, "id": "3e46941d", "metadata": {}, "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", "
latitudelongitudetimepoint_hrtemperature_ccloud_coverlifted_indexprecipitation_amountrelative_humiditywind_directionwind_speed...weather_oshowerdayweather_oshowernightweather_pcloudydayweather_pcloudynightweather_raindayweather_rainnightweather_tsdayweather_tsnightweather_tsraindayweather_tsrainnight
023.83191.2871222.012.00980.02.0...0000000000
123.83191.2871528.01-1.00650.03.0...0000000000
223.83191.2871833.02-1.00541.03.0...0000000000
323.83191.2872130.08-1.00510.03.0...0000000000
423.83191.2872426.06-1.00821.03.0...1000000000
\n", "

5 rows × 35 columns

\n", "
" ], "text/plain": [ " latitude longitude timepoint_hr temperature_c cloud_cover \\\n", "0 23.831 91.287 12 22.0 1 \n", "1 23.831 91.287 15 28.0 1 \n", "2 23.831 91.287 18 33.0 2 \n", "3 23.831 91.287 21 30.0 8 \n", "4 23.831 91.287 24 26.0 6 \n", "\n", " lifted_index precipitation_amount relative_humidity wind_direction \\\n", "0 2.0 0 98 0.0 \n", "1 -1.0 0 65 0.0 \n", "2 -1.0 0 54 1.0 \n", "3 -1.0 0 51 0.0 \n", "4 -1.0 0 82 1.0 \n", "\n", " wind_speed ... weather_oshowerday weather_oshowernight \\\n", "0 2.0 ... 0 0 \n", "1 3.0 ... 0 0 \n", "2 3.0 ... 0 0 \n", "3 3.0 ... 0 0 \n", "4 3.0 ... 1 0 \n", "\n", " weather_pcloudyday weather_pcloudynight weather_rainday \\\n", "0 0 0 0 \n", "1 0 0 0 \n", "2 0 0 0 \n", "3 0 0 0 \n", "4 0 0 0 \n", "\n", " weather_rainnight weather_tsday weather_tsnight weather_tsrainday \\\n", "0 0 0 0 0 \n", "1 0 0 0 0 \n", "2 0 0 0 0 \n", "3 0 0 0 0 \n", "4 0 0 0 0 \n", "\n", " weather_tsrainnight \n", "0 0 \n", "1 0 \n", "2 0 \n", "3 0 \n", "4 0 \n", "\n", "[5 rows x 35 columns]" ] }, "execution_count": 66, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df = pd.get_dummies(df,columns=[\"precipitation_type\",\"weather\"],drop_first=True,dtype=int)\n", "df.head()" ] }, { "cell_type": "code", "execution_count": 67, "id": "a4cb443a", "metadata": {}, "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", "
latitudelongitudetimepoint_hrtemperature_ccloud_coverlifted_indexprecipitation_amountrelative_humiditywind_directionwind_speed...weather_oshowerdayweather_oshowernightweather_pcloudydayweather_pcloudynightweather_raindayweather_rainnightweather_tsdayweather_tsnightweather_tsraindayweather_tsrainnight
00.2825232.263531-1.71767722.0-1.2075920.41990003.0032940.0-0.624539...0000000000
10.2825232.263531-1.68880828.0-1.207592-0.67672501.6449250.01.315471...0000000000
20.2825232.263531-1.65994033.0-0.884976-0.67672501.1921361.01.315471...0000000000
30.2825232.263531-1.63107130.01.050721-0.67672501.0686480.01.315471...0000000000
40.2825232.263531-1.60220326.00.405489-0.67672502.3446911.01.315471...1000000000
\n", "

5 rows × 35 columns

\n", "
" ], "text/plain": [ " latitude longitude timepoint_hr temperature_c cloud_cover \\\n", "0 0.282523 2.263531 -1.717677 22.0 -1.207592 \n", "1 0.282523 2.263531 -1.688808 28.0 -1.207592 \n", "2 0.282523 2.263531 -1.659940 33.0 -0.884976 \n", "3 0.282523 2.263531 -1.631071 30.0 1.050721 \n", "4 0.282523 2.263531 -1.602203 26.0 0.405489 \n", "\n", " lifted_index precipitation_amount relative_humidity wind_direction \\\n", "0 0.419900 0 3.003294 0.0 \n", "1 -0.676725 0 1.644925 0.0 \n", "2 -0.676725 0 1.192136 1.0 \n", "3 -0.676725 0 1.068648 0.0 \n", "4 -0.676725 0 2.344691 1.0 \n", "\n", " wind_speed ... weather_oshowerday weather_oshowernight \\\n", "0 -0.624539 ... 0 0 \n", "1 1.315471 ... 0 0 \n", "2 1.315471 ... 0 0 \n", "3 1.315471 ... 0 0 \n", "4 1.315471 ... 1 0 \n", "\n", " weather_pcloudyday weather_pcloudynight weather_rainday \\\n", "0 0 0 0 \n", "1 0 0 0 \n", "2 0 0 0 \n", "3 0 0 0 \n", "4 0 0 0 \n", "\n", " weather_rainnight weather_tsday weather_tsnight weather_tsrainday \\\n", "0 0 0 0 0 \n", "1 0 0 0 0 \n", "2 0 0 0 0 \n", "3 0 0 0 0 \n", "4 0 0 0 0 \n", "\n", " weather_tsrainnight \n", "0 0 \n", "1 0 \n", "2 0 \n", "3 0 \n", "4 0 \n", "\n", "[5 rows x 35 columns]" ] }, "execution_count": 67, "metadata": {}, "output_type": "execute_result" } ], "source": [ "num_cols = [\"latitude\",\"longitude\",\"timepoint_hr\",\"cloud_cover\",\"lifted_index\",\"relative_humidity\",\"wind_speed\"]\n", "\n", "scaler = StandardScaler()\n", "\n", "df[num_cols] = scaler.fit_transform(df[num_cols])\n", "df.head()" ] }, { "cell_type": "code", "execution_count": 68, "id": "fe57be04", "metadata": {}, "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", "
latitudelongitudetimepoint_hrcloud_coverlifted_indexprecipitation_amountrelative_humiditywind_directionwind_speedprecipitation_type_rain...weather_oshowerdayweather_oshowernightweather_pcloudydayweather_pcloudynightweather_raindayweather_rainnightweather_tsdayweather_tsnightweather_tsraindayweather_tsrainnight
00.2825232.263531-1.717677-1.2075920.41990003.0032940.0-0.6245391...0000000000
10.2825232.263531-1.688808-1.207592-0.67672501.6449250.01.3154711...0000000000
20.2825232.263531-1.659940-0.884976-0.67672501.1921361.01.3154711...0000000000
30.2825232.263531-1.6310711.050721-0.67672501.0686480.01.3154710...0000000000
40.2825232.263531-1.6022030.405489-0.67672502.3446911.01.3154711...1000000000
\n", "

5 rows × 34 columns

\n", "
" ], "text/plain": [ " latitude longitude timepoint_hr cloud_cover lifted_index \\\n", "0 0.282523 2.263531 -1.717677 -1.207592 0.419900 \n", "1 0.282523 2.263531 -1.688808 -1.207592 -0.676725 \n", "2 0.282523 2.263531 -1.659940 -0.884976 -0.676725 \n", "3 0.282523 2.263531 -1.631071 1.050721 -0.676725 \n", "4 0.282523 2.263531 -1.602203 0.405489 -0.676725 \n", "\n", " precipitation_amount relative_humidity wind_direction wind_speed \\\n", "0 0 3.003294 0.0 -0.624539 \n", "1 0 1.644925 0.0 1.315471 \n", "2 0 1.192136 1.0 1.315471 \n", "3 0 1.068648 0.0 1.315471 \n", "4 0 2.344691 1.0 1.315471 \n", "\n", " precipitation_type_rain ... weather_oshowerday weather_oshowernight \\\n", "0 1 ... 0 0 \n", "1 1 ... 0 0 \n", "2 1 ... 0 0 \n", "3 0 ... 0 0 \n", "4 1 ... 1 0 \n", "\n", " weather_pcloudyday weather_pcloudynight weather_rainday \\\n", "0 0 0 0 \n", "1 0 0 0 \n", "2 0 0 0 \n", "3 0 0 0 \n", "4 0 0 0 \n", "\n", " weather_rainnight weather_tsday weather_tsnight weather_tsrainday \\\n", "0 0 0 0 0 \n", "1 0 0 0 0 \n", "2 0 0 0 0 \n", "3 0 0 0 0 \n", "4 0 0 0 0 \n", "\n", " weather_tsrainnight \n", "0 0 \n", "1 0 \n", "2 0 \n", "3 0 \n", "4 0 \n", "\n", "[5 rows x 34 columns]" ] }, "execution_count": 68, "metadata": {}, "output_type": "execute_result" } ], "source": [ "X = df.drop(\"temperature_c\",axis=1)\n", "y = df[\"temperature_c\"]\n", "\n", "X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)\n", "X.head()" ] }, { "cell_type": "code", "execution_count": 69, "id": "80bb047d", "metadata": {}, "outputs": [], "source": [ "results = []\n", "models = {\n", " 'Linear Regression': LinearRegression(),\n", " 'Ridge Regression': Ridge(alpha=1.0),\n", " 'Lasso Regression': Lasso(alpha=0.1, max_iter=10000),\n", " 'ElasticNet': ElasticNet(alpha=0.1, l1_ratio=0.5),\n", " 'Decision Tree': DecisionTreeRegressor(random_state=42),\n", " 'Random Forest': RandomForestRegressor(random_state=42, n_jobs=-1),\n", " 'Extra Trees': ExtraTreesRegressor(random_state=42, n_jobs=-1),\n", " 'Gradient Boosting': GradientBoostingRegressor(random_state=42),\n", " 'K-Neighbors': KNeighborsRegressor(),\n", " 'Support Vector Regressor': SVR(kernel='rbf'),\n", " \"XGBoost\": XGBRegressor(random_state=42),\n", " \"AdaBoost\": AdaBoostRegressor(random_state=42),\n", "}" ] }, { "cell_type": "code", "execution_count": 70, "id": "c46ff2f1", "metadata": {}, "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", "
NameR2_scoreMSEMAERMSE
0Linear Regression0.51823518.9652193.4552234.354908
1Ridge Regression0.51853318.9535123.4525444.353563
2Lasso Regression0.49265119.9723753.5287724.469046
3ElasticNet0.49151020.0172963.5328234.474069
4Decision Tree0.8650345.3131071.5614892.305018
5Random Forest0.9280792.8312471.2202181.682631
6Extra Trees0.9327162.6486971.1923541.627482
7Gradient Boosting0.8698435.1237631.7513022.263573
8K-Neighbors0.74384210.0839482.3310683.175523
9Support Vector Regressor0.67747312.6966422.7105823.563235
10XGBoost0.9509041.9327261.0268921.390225
11AdaBoost0.66332713.2535262.9815813.640539
\n", "
" ], "text/plain": [ " Name R2_score MSE MAE RMSE\n", "0 Linear Regression 0.518235 18.965219 3.455223 4.354908\n", "1 Ridge Regression 0.518533 18.953512 3.452544 4.353563\n", "2 Lasso Regression 0.492651 19.972375 3.528772 4.469046\n", "3 ElasticNet 0.491510 20.017296 3.532823 4.474069\n", "4 Decision Tree 0.865034 5.313107 1.561489 2.305018\n", "5 Random Forest 0.928079 2.831247 1.220218 1.682631\n", "6 Extra Trees 0.932716 2.648697 1.192354 1.627482\n", "7 Gradient Boosting 0.869843 5.123763 1.751302 2.263573\n", "8 K-Neighbors 0.743842 10.083948 2.331068 3.175523\n", "9 Support Vector Regressor 0.677473 12.696642 2.710582 3.563235\n", "10 XGBoost 0.950904 1.932726 1.026892 1.390225\n", "11 AdaBoost 0.663327 13.253526 2.981581 3.640539" ] }, "execution_count": 70, "metadata": {}, "output_type": "execute_result" } ], "source": [ "for name,model in models.items():\n", " model.fit(X_train,y_train)\n", " y_pred = model.predict(X_test)\n", " R2_score = r2_score(y_test,y_pred)\n", " MSE = mean_squared_error(y_test, y_pred)\n", " MAE = mean_absolute_error(y_test, y_pred)\n", " RMSE = np.sqrt(MSE)\n", " results.append({\n", " \"Name\":name,\n", " \"R2_score\":R2_score,\n", " \"MSE\":MSE,\n", " \"MAE\":MAE,\n", " \"RMSE\":RMSE\n", " })\n", "\n", "results_df = pd.DataFrame(results)\n", "results_df" ] }, { "cell_type": "code", "execution_count": 71, "id": "e1f6bbbc", "metadata": {}, "outputs": [], "source": [ "model_ann = Sequential([\n", " Input(shape=(X.shape[1],)),\n", " Dense(64,activation=\"relu\"),\n", " BatchNormalization(),\n", " Dropout(0.3),\n", " Dense(32,activation=\"relu\"),\n", " BatchNormalization(),\n", " Dropout(0.2),\n", " Dense(16,activation=\"relu\"),\n", " BatchNormalization(),\n", " Dropout(0.1),\n", " Dense(8,activation=\"relu\"),\n", " # BatchNormalization(),\n", " Dense(1),\n", "])" ] }, { "cell_type": "code", "execution_count": 72, "id": "dd5bc179", "metadata": {}, "outputs": [], "source": [ "model_ann.compile(optimizer=\"adam\",loss=\"mse\",metrics=[\"r2_score\"])" ] }, { "cell_type": "code", "execution_count": 74, "id": "c23c155b", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Epoch 1/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m5s\u001b[0m 5ms/step - loss: 580.6132 - r2_score: -14.4387 - val_loss: 208.8467 - val_r2_score: -4.3052\n", "Epoch 2/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 130.3659 - r2_score: -2.4665 - val_loss: 50.1632 - val_r2_score: -0.2743\n", "Epoch 3/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 57.5414 - r2_score: -0.5300 - val_loss: 29.1439 - val_r2_score: 0.2597\n", "Epoch 4/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 41.0194 - r2_score: -0.0907 - val_loss: 18.8778 - val_r2_score: 0.5205\n", "Epoch 5/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 32.6543 - r2_score: 0.1317 - val_loss: 15.6990 - val_r2_score: 0.6012\n", "Epoch 6/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 29.9056 - r2_score: 0.2048 - val_loss: 15.3638 - val_r2_score: 0.6097\n", "Epoch 7/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 28.0113 - r2_score: 0.2552 - val_loss: 14.3138 - val_r2_score: 0.6364\n", "Epoch 8/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 26.4855 - r2_score: 0.2957 - val_loss: 13.7028 - val_r2_score: 0.6519\n", "Epoch 9/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 24.8946 - r2_score: 0.3380 - val_loss: 13.5672 - val_r2_score: 0.6554\n", "Epoch 10/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 23.9593 - r2_score: 0.3629 - val_loss: 13.1969 - val_r2_score: 0.6648\n", "Epoch 11/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 22.8057 - r2_score: 0.3936 - val_loss: 11.7723 - val_r2_score: 0.7010\n", "Epoch 12/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 22.0479 - r2_score: 0.4137 - val_loss: 11.4768 - val_r2_score: 0.7085\n", "Epoch 13/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 21.0862 - r2_score: 0.4393 - val_loss: 10.2632 - val_r2_score: 0.7393\n", "Epoch 14/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 20.0188 - r2_score: 0.4677 - val_loss: 11.1398 - val_r2_score: 0.7170\n", "Epoch 15/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 19.7131 - r2_score: 0.4758 - val_loss: 9.7825 - val_r2_score: 0.7515\n", "Epoch 16/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 19.3892 - r2_score: 0.4844 - val_loss: 9.8962 - val_r2_score: 0.7486\n", "Epoch 17/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 18.6518 - r2_score: 0.5040 - val_loss: 9.8722 - val_r2_score: 0.7492\n", "Epoch 18/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 18.3510 - r2_score: 0.5120 - val_loss: 10.1010 - val_r2_score: 0.7434\n", "Epoch 19/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 17.9102 - r2_score: 0.5238 - val_loss: 9.5211 - val_r2_score: 0.7581\n", "Epoch 20/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 17.3685 - r2_score: 0.5382 - val_loss: 9.4287 - val_r2_score: 0.7605\n", "Epoch 21/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 16.5780 - r2_score: 0.5592 - val_loss: 9.6545 - val_r2_score: 0.7548\n", "Epoch 22/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 16.5212 - r2_score: 0.5607 - val_loss: 8.7659 - val_r2_score: 0.7773\n", "Epoch 23/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 15.9550 - r2_score: 0.5758 - val_loss: 8.7544 - val_r2_score: 0.7776\n", "Epoch 24/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 15.6680 - r2_score: 0.5834 - val_loss: 8.4551 - val_r2_score: 0.7852\n", "Epoch 25/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 15.5105 - r2_score: 0.5876 - val_loss: 8.4546 - val_r2_score: 0.7852\n", "Epoch 26/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 14.7679 - r2_score: 0.6073 - val_loss: 8.5082 - val_r2_score: 0.7839\n", "Epoch 27/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 14.3671 - r2_score: 0.6180 - val_loss: 8.1789 - val_r2_score: 0.7922\n", "Epoch 28/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 14.3313 - r2_score: 0.6189 - val_loss: 8.8041 - val_r2_score: 0.7764\n", "Epoch 29/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 13.9226 - r2_score: 0.6298 - val_loss: 7.8309 - val_r2_score: 0.8011\n", "Epoch 30/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 13.8522 - r2_score: 0.6317 - val_loss: 8.2266 - val_r2_score: 0.7910\n", "Epoch 31/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 13.3393 - r2_score: 0.6453 - val_loss: 8.0482 - val_r2_score: 0.7956\n", "Epoch 32/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 13.3797 - r2_score: 0.6442 - val_loss: 8.4456 - val_r2_score: 0.7855\n", "Epoch 33/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 12.7713 - r2_score: 0.6604 - val_loss: 7.7501 - val_r2_score: 0.8031\n", "Epoch 34/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 12.6745 - r2_score: 0.6630 - val_loss: 8.1170 - val_r2_score: 0.7938\n", "Epoch 35/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 12.5719 - r2_score: 0.6657 - val_loss: 7.7303 - val_r2_score: 0.8036\n", "Epoch 36/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 12.1313 - r2_score: 0.6774 - val_loss: 7.3188 - val_r2_score: 0.8141\n", "Epoch 37/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 12.0364 - r2_score: 0.6799 - val_loss: 7.6268 - val_r2_score: 0.8063\n", "Epoch 38/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 12.1454 - r2_score: 0.6770 - val_loss: 7.6607 - val_r2_score: 0.8054\n", "Epoch 39/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 11.6412 - r2_score: 0.6905 - val_loss: 7.4127 - val_r2_score: 0.8117\n", "Epoch 40/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 11.4337 - r2_score: 0.6960 - val_loss: 7.6688 - val_r2_score: 0.8052\n", "Epoch 41/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 5ms/step - loss: 11.1415 - r2_score: 0.7037 - val_loss: 7.8427 - val_r2_score: 0.8008\n", "Epoch 42/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 11.2852 - r2_score: 0.6999 - val_loss: 7.5574 - val_r2_score: 0.8080\n", "Epoch 43/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 10.9454 - r2_score: 0.7090 - val_loss: 8.1556 - val_r2_score: 0.7928\n", "Epoch 44/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 10.8689 - r2_score: 0.7110 - val_loss: 7.7724 - val_r2_score: 0.8026\n", "Epoch 45/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 10.8163 - r2_score: 0.7124 - val_loss: 8.3711 - val_r2_score: 0.7874\n", "Epoch 46/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 10.9127 - r2_score: 0.7098 - val_loss: 8.1376 - val_r2_score: 0.7933\n", "Epoch 47/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 10.7279 - r2_score: 0.7147 - val_loss: 7.9481 - val_r2_score: 0.7981\n", "Epoch 48/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 10.4434 - r2_score: 0.7223 - val_loss: 6.8528 - val_r2_score: 0.8259\n", "Epoch 49/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 10.4319 - r2_score: 0.7226 - val_loss: 7.3611 - val_r2_score: 0.8130\n", "Epoch 50/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 10.8271 - r2_score: 0.7121 - val_loss: 6.8259 - val_r2_score: 0.8266\n", "Epoch 51/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 10.3952 - r2_score: 0.7236 - val_loss: 7.5746 - val_r2_score: 0.8076\n", "Epoch 52/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 10.2387 - r2_score: 0.7277 - val_loss: 6.9126 - val_r2_score: 0.8244\n", "Epoch 53/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 10.3273 - r2_score: 0.7254 - val_loss: 7.3214 - val_r2_score: 0.8140\n", "Epoch 54/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 10.1636 - r2_score: 0.7297 - val_loss: 6.6250 - val_r2_score: 0.8317\n", "Epoch 55/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 9.8007 - r2_score: 0.7394 - val_loss: 6.9272 - val_r2_score: 0.8240\n", "Epoch 56/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 10.0643 - r2_score: 0.7324 - val_loss: 7.1088 - val_r2_score: 0.8194\n", "Epoch 57/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 9.7644 - r2_score: 0.7404 - val_loss: 7.4269 - val_r2_score: 0.8113\n", "Epoch 58/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 9.8988 - r2_score: 0.7368 - val_loss: 6.9475 - val_r2_score: 0.8235\n", "Epoch 59/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 10.1038 - r2_score: 0.7313 - val_loss: 6.2913 - val_r2_score: 0.8402\n", "Epoch 60/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m2s\u001b[0m 3ms/step - loss: 9.7871 - r2_score: 0.7398 - val_loss: 6.7291 - val_r2_score: 0.8291\n", "Epoch 61/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 9.7775 - r2_score: 0.7400 - val_loss: 7.7365 - val_r2_score: 0.8035\n", "Epoch 62/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 9.5638 - r2_score: 0.7457 - val_loss: 6.0558 - val_r2_score: 0.8462\n", "Epoch 63/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 9.3138 - r2_score: 0.7523 - val_loss: 7.0009 - val_r2_score: 0.8222\n", "Epoch 64/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 9.5238 - r2_score: 0.7468 - val_loss: 6.1478 - val_r2_score: 0.8438\n", "Epoch 65/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 9.1751 - r2_score: 0.7560 - val_loss: 6.7159 - val_r2_score: 0.8294\n", "Epoch 66/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 9.3547 - r2_score: 0.7513 - val_loss: 6.0796 - val_r2_score: 0.8456\n", "Epoch 67/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 9.2270 - r2_score: 0.7547 - val_loss: 6.1111 - val_r2_score: 0.8448\n", "Epoch 68/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 8.7594 - r2_score: 0.7671 - val_loss: 6.4911 - val_r2_score: 0.8351\n", "Epoch 69/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 8.9803 - r2_score: 0.7612 - val_loss: 6.3231 - val_r2_score: 0.8394\n", "Epoch 70/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 8.7332 - r2_score: 0.7678 - val_loss: 7.1530 - val_r2_score: 0.8183\n", "Epoch 71/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 8.7155 - r2_score: 0.7683 - val_loss: 6.1875 - val_r2_score: 0.8428\n", "Epoch 72/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 8.8001 - r2_score: 0.7660 - val_loss: 5.9001 - val_r2_score: 0.8501\n", "Epoch 73/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 8.6745 - r2_score: 0.7693 - val_loss: 6.4361 - val_r2_score: 0.8365\n", "Epoch 74/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 8.9352 - r2_score: 0.7624 - val_loss: 6.9902 - val_r2_score: 0.8224\n", "Epoch 75/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 9.0135 - r2_score: 0.7603 - val_loss: 6.3591 - val_r2_score: 0.8385\n", "Epoch 76/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 8.7399 - r2_score: 0.7676 - val_loss: 6.3589 - val_r2_score: 0.8385\n", "Epoch 77/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 8.8214 - r2_score: 0.7654 - val_loss: 6.6841 - val_r2_score: 0.8302\n", "Epoch 78/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 8.8998 - r2_score: 0.7634 - val_loss: 6.0492 - val_r2_score: 0.8463\n", "Epoch 79/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 8.6245 - r2_score: 0.7707 - val_loss: 5.9534 - val_r2_score: 0.8488\n", "Epoch 80/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 8.7304 - r2_score: 0.7679 - val_loss: 7.8373 - val_r2_score: 0.8009\n", "Epoch 81/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 8.4606 - r2_score: 0.7750 - val_loss: 5.8646 - val_r2_score: 0.8510\n", "Epoch 82/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 8.7136 - r2_score: 0.7683 - val_loss: 6.0989 - val_r2_score: 0.8451\n", "Epoch 83/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 8.7259 - r2_score: 0.7680 - val_loss: 6.1660 - val_r2_score: 0.8434\n", "Epoch 84/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 8.4922 - r2_score: 0.7742 - val_loss: 5.6999 - val_r2_score: 0.8552\n", "Epoch 85/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 8.7692 - r2_score: 0.7668 - val_loss: 6.8935 - val_r2_score: 0.8249\n", "Epoch 86/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 8.6339 - r2_score: 0.7704 - val_loss: 6.2466 - val_r2_score: 0.8413\n", "Epoch 87/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 8.3324 - r2_score: 0.7784 - val_loss: 5.8125 - val_r2_score: 0.8523\n", "Epoch 88/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 8.4679 - r2_score: 0.7748 - val_loss: 5.8479 - val_r2_score: 0.8514\n", "Epoch 89/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 8.4035 - r2_score: 0.7765 - val_loss: 6.0813 - val_r2_score: 0.8455\n", "Epoch 90/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 8.1012 - r2_score: 0.7846 - val_loss: 5.9981 - val_r2_score: 0.8476\n", "Epoch 91/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 8.3807 - r2_score: 0.7772 - val_loss: 6.5763 - val_r2_score: 0.8329\n", "Epoch 92/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 8.5219 - r2_score: 0.7734 - val_loss: 6.3763 - val_r2_score: 0.8380\n", "Epoch 93/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 8.1162 - r2_score: 0.7842 - val_loss: 6.2550 - val_r2_score: 0.8411\n", "Epoch 94/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 8.3280 - r2_score: 0.7786 - val_loss: 6.7860 - val_r2_score: 0.8276\n", "Epoch 95/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 8.0388 - r2_score: 0.7862 - val_loss: 5.6346 - val_r2_score: 0.8569\n", "Epoch 96/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 8.4518 - r2_score: 0.7753 - val_loss: 6.1296 - val_r2_score: 0.8443\n", "Epoch 97/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - loss: 8.2364 - r2_score: 0.7810 - val_loss: 6.5218 - val_r2_score: 0.8343\n", "Epoch 98/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 8.4602 - r2_score: 0.7750 - val_loss: 6.0230 - val_r2_score: 0.8470\n", "Epoch 99/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m2s\u001b[0m 4ms/step - loss: 8.2814 - r2_score: 0.7798 - val_loss: 5.4802 - val_r2_score: 0.8608\n", "Epoch 100/100\n", "\u001b[1m309/309\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - loss: 8.0616 - r2_score: 0.7856 - val_loss: 6.0465 - val_r2_score: 0.8464\n" ] } ], "source": [ "history = model_ann.fit(\n", " X_train,y_train,\n", " validation_data=(X_test, y_test),\n", " epochs=100,\n", " batch_size=32,\n", " verbose=1\n", ")" ] }, { "cell_type": "code", "execution_count": 75, "id": "c7704137", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1m78/78\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 4ms/step - loss: 6.0465 - r2_score: 0.8464\n" ] }, { "data": { "text/plain": [ "[6.0464701652526855, 0.8464043140411377]" ] }, "execution_count": 75, "metadata": {}, "output_type": "execute_result" } ], "source": [ "model_ann.evaluate(X_test,y_test,batch_size=32,verbose=1)" ] }, { "cell_type": "code", "execution_count": 76, "id": "fe9f3a82", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "WARNING:absl:You are saving your model as an HDF5 file via `model.save()` or `keras.saving.save_model(model)`. This file format is considered legacy. We recommend using instead the native Keras format, e.g. `model.save('my_model.keras')` or `keras.saving.save_model(model, 'my_model.keras')`. \n" ] }, { "data": { "text/plain": [ "['columns.pkl']" ] }, "execution_count": 76, "metadata": {}, "output_type": "execute_result" } ], "source": [ "model_ann.save(\"model.h5\")\n", "dump(scaler,\"scaler.pkl\")\n", "dump(X.columns.tolist,\"columns.pkl\")" ] } ], "metadata": { "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.12.10" } }, "nbformat": 4, "nbformat_minor": 5 }