17 changed files with 17664 additions and 17873 deletions

No files matched your search

-43
View File
@@ -1,43 +0,0 @@
import pandas as pd
import io
from typing import Union
def cut_headers(stream: Union[io.StringIO, io.FileIO, io.TextIOWrapper]):
"""Remove custom header metadata from the CSV file."""
headers = []
exist_startheader = False
while line := stream.readline():
if "-BEGIN HEADER-" in line and not exist_startheader:
exist_startheader = True
headers.append(str(line.strip()))
elif "-END HEADER-" in line and exist_startheader:
headers.append(str(line.strip()))
break
elif exist_startheader:
headers.append(str(line.strip()))
elif not exist_startheader:
continue
if not exist_startheader:
stream.seek(0)
return "", stream
return "\n".join(headers), stream
def load_weather_data(file_path: str) -> pd.DataFrame:
"""Load weather data and preprocess the datetime index."""
with open(file_path, "r", encoding="utf-8") as file:
_, csv_file = cut_headers(file)
data = pd.read_csv(csv_file, na_values=-999)
# Convert YEAR, MO, DY to datetime index
if all(col in data.columns for col in ("YEAR", "MO", "DY")):
data["date"] = pd.to_datetime(
{k: data[v] for v, k in zip(["YEAR", "MO", "DY"], ["year", "month", "day"])}
)
data.drop(columns=["YEAR", "MO", "DY"], inplace=True)
data.set_index("date", inplace=True)
data.dropna(inplace=True)
data = data.asfreq("D") # Assumes regular daily data
return data
+68 -12
View File
@@ -1,14 +1,45 @@
import sys
import urllib.parse import urllib.parse
import urllib.request import urllib.request
from datetime import datetime from datetime import datetime
import logging
from global_config import DATA_FILE_NAME
data_file = "hanoi_weather_data.csv" # Configure logging
logging.basicConfig(
level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s"
)
# Define parameters # Define parameters
latitude, longitude = 21.04815477090267, 105.80123159165096 # lmao latitude, longitude = 21.04815477090267, 105.80123159165096 # Default: Hanoi
start_date = "1985-01-01" # start_date = "1981-01-01"
start_date = "2001-01-01"
end_date = datetime.now().strftime("%Y-%m-%d") # Today's date end_date = datetime.now().strftime("%Y-%m-%d") # Today's date
# most used parameters from NASA POWER API:
# T2M MERRA-2 Temperature at 2 Meters (C)
# T2M_MAX MERRA-2 Maximum Temperature at 2 Meters (C)
# T2M_MIN MERRA-2 Minimum Temperature at 2 Meters (C)
# T2MDEW MERRA-2 Dew/Frost Point at 2 Meters (C)
# T2MWET MERRA-2 Wet Bulb Temperature at 2 Meters (C)
# PRECTOTCORR MERRA-2 Precipitation Corrected (mm/day)
# ALLSKY_SFC_SW_DWN All Sky Surface Shortwave Downward Irradiance (kW-hr/m^2/day)
# CLRSKY_SFC_SW_DWN Clear Sky Surface Shortwave Downward Irradiance (kW-hr/m^2/day)
# RH2M MERRA-2 Relative Humidity at 2 Meters (%)
# QV2M MERRA-2 Specific Humidity at 2 Meters (g/kg)
# PS MERRA-2 Surface Pressure (kPa)
# WS10M MERRA-2 Wind Speed at 10 Meters (m/s)
# WS50M MERRA-2 Wind Speed at 50 Meters (m/s)
# WD10M MERRA-2 Wind Direction at 10 Meters (Degrees)
# WD50M MERRA-2 Wind Direction at 50 Meters (Degrees)
# TS MERRA-2 Earth Skin Temperature (C)
# PRECTOT MERRA-2 Precipitation (mm/day)
# ALLSKY_KT All Sky Insolation Clearness Index (dimensionless)
# CLRSKY_KT Clear Sky Insolation Clearness Index (dimensionless)
# ALLSKY_SFC_LW_DWN All Sky Surface Longwave Downward Irradiance (W/m^2)
# CLOUD_AMT Cloud amount (%)
# Define desired parameters # Define desired parameters
# T2M MERRA-2 Temperature at 2 Meters (C) # T2M MERRA-2 Temperature at 2 Meters (C)
# PRECTOTCORR MERRA-2 Precipitation Corrected (mm/day) # PRECTOTCORR MERRA-2 Precipitation Corrected (mm/day)
@@ -19,9 +50,26 @@ end_date = datetime.now().strftime("%Y-%m-%d") # Today's date
# WD10M MERRA-2 Wind Direction at 10 Meters (Degrees) # WD10M MERRA-2 Wind Direction at 10 Meters (Degrees)
# more at https://power.larc.nasa.gov/data-access-viewer/ # more at https://power.larc.nasa.gov/data-access-viewer/
weather_params = [ weather_params = [
"T2M",
"T2M_MAX",
"T2M_MIN",
"T2MDEW",
"PRECTOTCORR",
"QV2M", "QV2M",
"RH2M",
"PS",
"CLOUD_AMT",
"WS10M",
"WD10M",
"ALLSKY_KT",
"ALLSKY_SFC_SW_DWN",
] ]
if len(weather_params) > 20:
logging.error("too much! %d params bigger than 20", len(weather_params))
sys.exit(1)
params = { params = {
"parameters": ",".join(weather_params), "parameters": ",".join(weather_params),
"community": "RE", "community": "RE",
@@ -41,15 +89,23 @@ base_url = "https://power.larc.nasa.gov/api/temporal/daily/point"
url = f"{base_url}?{query_string}" url = f"{base_url}?{query_string}"
# Make the API request using urllib # Make the API request using urllib
if __name__ == "__main__": try:
try: logging.info("Requesting data from NASA POWER API...")
with urllib.request.urlopen(url) as response: with urllib.request.urlopen(url) as response:
if response.status == 200: if response.status == 200:
csv_data = response.read() # Save data to file
with open(data_file, "wb") as file: with open(DATA_FILE_NAME, "wb") as file:
file.write(csv_data) while chunk := response.read(1024): # Read 1 KB at a time
print(f"Data successfully downloaded and saved to {data_file}.") file.write(chunk)
logging.info(
"Data successfully downloaded and saved to '%s'.", DATA_FILE_NAME
)
else: else:
print(f"Failed to retrieve data: HTTP Status Code {response.status}") print("re", response.read().decode())
except urllib.error.URLError as e: logging.error(
print(f"Failed to retrieve data: {e.reason}") "Failed to retrieve data: HTTP Status Code %s", response.status
)
except urllib.error.URLError as e:
logging.error("Failed to retrieve data: %s", e)
except Exception as e:
logging.error("An unexpected error occurred: %s", e)
-2100
View File
File diff suppressed because it is too large. Load diff
-163
View File
@@ -1,163 +0,0 @@
from sklearn.model_selection import train_test_split
import torch
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
from sklearn.preprocessing import MinMaxScaler
import numpy as np
from load_data import load_this_data
a = load_this_data()
# time series forecasting
scaler = MinMaxScaler()
print(a.columns)
scaled_data = scaler.fit_transform(a)
def create_sequences(data, seq_length):
"see this? return[0] is the big x and return[1] is the big y. and h(x) = y. and h(x) is the model."
xs = []
ys = []
for i in range(len(data) - seq_length):
x = data[i : (i + seq_length)]
y = data[i + seq_length]
xs.append(x)
ys.append(y)
return np.array(xs), np.array(ys)
seq_length = 20
X, y = create_sequences(scaled_data, seq_length)
X_train, X_test, y_train, y_test = train_test_split(
X, y, test_size=0.2, random_state=42
)
from torch.utils.data import TensorDataset, DataLoader
X_train_tensor = torch.tensor(X_train, dtype=torch.float32)
y_train_tensor = torch.tensor(y_train, dtype=torch.float32)
train_dataset = TensorDataset(X_train_tensor, y_train_tensor)
train_loader = DataLoader(train_dataset, batch_size=32, shuffle=True)
import torch.nn as nn
class LSTMModel(nn.Module):
def __init__(self, input_size, hidden_size, num_layers, output_size):
super(LSTMModel, self).__init__()
self.hidden_size = hidden_size
self.num_layers = num_layers
self.lstm = nn.LSTM(input_size, hidden_size, num_layers, batch_first=True)
self.fc = nn.Linear(hidden_size, output_size)
def forward(self, x):
h0 = torch.zeros(self.num_layers, x.size(0), self.hidden_size).to(device)
c0 = torch.zeros(self.num_layers, x.size(0), self.hidden_size).to(device)
out, _ = self.lstm(x, (h0, c0))
out = self.fc(out[:, -1, :]) # Take the output from the last time step
return out
model = LSTMModel(
input_size=X_train.shape[2],
hidden_size=64,
num_layers=2,
output_size=y_train.shape[1],
)
model.to(device)
criterion = nn.MSELoss()
optimizer = torch.optim.Adam(model.parameters(), lr=0.001)
train_losses = []
val_losses = []
for epoch in range(100):
model.train()
running_train_loss = 0.0
# inputs, targets
for batch_X, batch_y in train_loader:
batch_X = batch_X.to(device)
batch_y = batch_y.to(device)
outputs = model(batch_X)
loss = criterion(outputs, batch_y)
optimizer.zero_grad()
loss.backward()
optimizer.step()
running_train_loss += loss.item() * batch_X.size(0)
if (epoch + 1) % 10 == 0:
print(f"Epoch [{epoch+1}/100], Loss: {loss.item():.4f}")
epoch_train_loss = running_train_loss / len(train_loader.dataset)
train_losses.append(epoch_train_loss)
model.eval()
X_test_tensor = torch.tensor(X_test, dtype=torch.float32).to(device)
y_test_tensor = torch.tensor(y_test, dtype=torch.float32).to(device)
val_dataset = TensorDataset(X_test_tensor, y_test_tensor)
val_loader = DataLoader(val_dataset, batch_size=64, shuffle=False)
# with torch.no_grad():
# running_val_loss = 0.0
# predictions = model(X_test_tensor)
# test_loss = criterion(predictions, y_test_tensor)
# print(f"Test Loss: {test_loss.item():.4f}")
running_val_loss = 0.0
predictions = []
with torch.no_grad():
for inputs, targets in val_loader:
inputs, targets = inputs.to(device), targets.to(device)
outputs = model(inputs)
loss = criterion(outputs, targets)
running_val_loss += loss.item() * inputs.size(0)
predictions.append(outputs.cpu().numpy()) # Collect all batches
epoch_val_loss = running_val_loss / len(val_loader.dataset) # len(val_dataset)
val_losses.append(epoch_val_loss)
predictions = np.concatenate(predictions, axis=0)
import matplotlib.pyplot as plt
y_test_cpu = y_test_tensor.cpu().numpy()
predictions_rescaled = scaler.inverse_transform(predictions)
y_test_rescaled = scaler.inverse_transform(y_test_cpu)
fig, (ax1, ax2) = plt.subplots(
1, 2, figsize=(14, 5), gridspec_kw={"width_ratios": [1, 3]}
)
# Loss curve on the left
ax1.plot(train_losses, label="Train Loss")
ax1.plot(val_losses, label="Val Loss")
ax1.set_title("Loss Curve")
ax1.set_xlabel("Epoch")
ax1.set_ylabel("Loss")
ax1.legend()
ax1.grid(True)
# Prediction vs Actual on the right
ax2.plot(y_test_rescaled, label="Actual")
ax2.plot(predictions_rescaled, label="Predicted")
ax2.set_title("Actual vs. Predicted")
ax2.set_xlabel("Sample")
ax2.set_ylabel("Value")
ax2.legend()
plt.tight_layout()
plt.show()
-28
View File
@@ -1,28 +0,0 @@
"extracting the load data step from the notebook"
import io
# from itertools import islice
from typing import Union
def cut_headers(stream: Union[io.StringIO, io.FileIO, io.TextIOWrapper]):
headers = []
exist_startheader = False
while line := stream.readline():
if "-BEGIN HEADER-" in line and not exist_startheader:
exist_startheader = True
headers.append(str(line.strip()))
elif "-END HEADER-" in line and exist_startheader:
headers.append(str(line.strip()))
break
elif exist_startheader:
# print(f"{line = }")
headers.append(str(line.strip()))
elif not exist_startheader:
continue
if not exist_startheader:
# If no headers are found, reset the stream and return
stream.seek(0)
return "", stream
return "\n".join(headers), stream
-185
View File
@@ -1,185 +0,0 @@
import sys
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import io
from typing import Union
from sklearn.metrics import mean_squared_error, r2_score
from sklearn.preprocessing import MinMaxScaler
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from statsmodels.tsa.ar_model import AutoReg
# ==== LOAD & CLEAN DATA ====
DATA_FILE_NAME = "hanoi_weather_data.csv"
def cut_headers(stream: Union[io.StringIO, io.FileIO, io.TextIOWrapper]):
headers = []
exist_startheader = False
while line := stream.readline():
if "-BEGIN HEADER-" in line and not exist_startheader:
exist_startheader = True
headers.append(str(line.strip()))
elif "-END HEADER-" in line and exist_startheader:
headers.append(str(line.strip()))
break
elif exist_startheader:
headers.append(str(line.strip()))
elif not exist_startheader:
continue
if not exist_startheader:
stream.seek(0)
return "", stream
return "\n".join(headers), stream
with open(DATA_FILE_NAME, "r", encoding="utf-8") as file:
data_header, csv_file = cut_headers(file)
data = pd.read_csv(csv_file, na_values=-999)
if all(z in data.columns for z in ("YEAR", "MO", "DY")):
data["date"] = pd.to_datetime(
{k: data[v] for v, k in zip(["YEAR", "MO", "DY"], ["year", "month", "day"])}
)
data.drop(columns=["YEAR", "MO", "DY"], inplace=True)
data.set_index("date", inplace=True)
data.dropna(inplace=True)
# ==== VISUALIZE CORRELATION ====
plt.figure(figsize=(12, 8))
sns.heatmap(data.corr(), annot=True, cmap="coolwarm")
plt.title("Feature Correlation Heatmap")
plt.show()
# ==== SCALE DATA ====
scaler = MinMaxScaler()
scaled_data = scaler.fit_transform(data)
# ==== CREATE SEQUENCES ====
def create_sequences(data, seq_length):
xs, ys = [], []
for i in range(len(data) - seq_length):
x = data[i:i + seq_length].flatten()
y = data[i + seq_length]
xs.append(x)
ys.append(y)
return np.array(xs), np.array(ys)
seq_length = 50
X, y = create_sequences(scaled_data, seq_length)
# ==== SPLIT ====
date_index = data.index[seq_length:]
X_train, X_test, y_train, y_test, date_train, date_test = train_test_split(
X, y, date_index, test_size=0.02, shuffle=False
)
# ==== TRAIN LINEAR REGRESSION ====
model = LinearRegression()
model.fit(X_train, y_train)
predictions = model.predict(X_test)
# ==== EVALUATION ====
mse = mean_squared_error(y_test, predictions)
r2 = r2_score(y_test, predictions)
print(f"Test MSE: {mse:.4f}")
print(f"Test R2: {r2:.4f}")
print(f"Model Score: {model.score(X_test, y_test):.4f}")
# ==== INVERSE TRANSFORM ====
predictions_rescaled = scaler.inverse_transform(
predictions.reshape(-1, data.shape[1])
)
y_test_rescaled = scaler.inverse_transform(
y_test.reshape(-1, data.shape[1])
)
# ==== PLOTS ====
# Actual vs Predicted with Real Dates
plt.figure(figsize=(12, 6))
plt.plot(date_test, y_test_rescaled[:, 0], label="Actual")
plt.plot(date_test, predictions_rescaled[:, 0], label="Predicted")
plt.title("Actual vs Predicted (First Feature)")
plt.xlabel("Date")
plt.ylabel("Original Scale")
plt.xticks(rotation=45)
plt.legend()
plt.grid(True)
plt.tight_layout()
plt.show()
# Residual Plot
residuals = y_test[:, 0] - predictions[:, 0]
plt.figure(figsize=(10, 4))
plt.plot(date_test, residuals, label="Residuals")
plt.hlines(0, 0, len(residuals), colors="red")
plt.title("Residuals Over Time (First Feature)")
plt.xlabel("Date")
plt.ylabel("Error")
plt.xticks(rotation=45)
plt.legend()
plt.tight_layout()
plt.grid(True)
plt.show()
# Error Distribution
errors = np.abs(y_test[:, 0] - predictions[:, 0])
plt.hist(errors, bins=50)
plt.title("Error Distribution (First Feature)")
plt.xlabel("Absolute Error")
plt.ylabel("Frequency")
plt.grid(True)
plt.show()
# Scatter Plot
plt.scatter(y_test[:, 0], predictions[:, 0], alpha=0.5)
plt.plot([0, 1], [0, 1], "r--")
plt.title("Predicted vs Actual (Normalized)")
plt.xlabel("Actual")
plt.ylabel("Predicted")
plt.grid(True)
plt.show()
# ==== AUTOREGRESSION FORECAST ====
target_column = data.columns[0]
series = data[target_column]
train_size = int(len(series) * 0.98)
train_series = series[:train_size]
test_series = series[train_size:]
ar_model = AutoReg(train_series, lags=30).fit()
ar_preds = ar_model.predict(start=len(train_series), end=len(series)-1)
# Plot AR Forecast
plt.figure(figsize=(12, 5))
plt.plot(test_series.index, test_series, label="Actual")
plt.plot(test_series.index, ar_preds, label="AR Forecast", linestyle="--")
plt.title(f"AutoRegression Forecast - {target_column}")
plt.xlabel("Date")
plt.ylabel(target_column)
plt.xticks(rotation=45)
plt.legend()
plt.grid(True)
plt.tight_layout()
plt.show()
# ==== FUTURE FORECAST ====
future_steps = 30
future_index = pd.date_range(start=series.index[-1], periods=future_steps+1, freq="D")[1:]
future_forecast = ar_model.predict(start=len(series), end=len(series) + future_steps - 1)
plt.figure(figsize=(12, 5))
plt.plot(series[-100:], label="Recent Data")
plt.plot(future_index, future_forecast, label="Future Forecast", color="red")
plt.title(f"{target_column} - 30 Day Forecast (AutoRegression)")
plt.xlabel("Date")
plt.ylabel(target_column)
plt.xticks(rotation=45)
plt.legend()
plt.tight_layout()
plt.grid(True)
plt.show()
-110
View File
@@ -1,110 +0,0 @@
import sys
import numpy as np
import pandas as pd
from sklearn.metrics import r2_score
from sklearn.preprocessing import MinMaxScaler
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_error
import matplotlib.pyplot as plt
# from global_config import DATA_FILE_NAME
DATA_FILE_NAME = "hanoi_weather_data.csv"
# from load_data import cut_headers
import io
# from itertools import islice
from typing import Union
def cut_headers(stream: Union[io.StringIO, io.FileIO, io.TextIOWrapper]):
headers = []
exist_startheader = False
while line := stream.readline():
if "-BEGIN HEADER-" in line and not exist_startheader:
exist_startheader = True
headers.append(str(line.strip()))
elif "-END HEADER-" in line and exist_startheader:
headers.append(str(line.strip()))
break
elif exist_startheader:
# print(f"{line = }")
headers.append(str(line.strip()))
elif not exist_startheader:
continue
if not exist_startheader:
# If no headers are found, reset the stream and return
stream.seek(0)
return "", stream
return "\n".join(headers), stream
# 1. Load data
with open(DATA_FILE_NAME, "r", encoding="utf-8") as file:
data_header, csv_file = cut_headers(file)
data = pd.read_csv(csv_file, na_values=-999)
if all(z in data.columns for z in ("YEAR", "MO", "DY")):
data["date"] = pd.to_datetime(
{k: data[v] for v, k in (zip(["YEAR", "MO", "DY"], ["year", "month", "day"]))}
)
data.drop(inplace=True, columns=["YEAR", "MO", "DY"])
data.set_index(["date"], inplace=True)
data.dropna(inplace=True)
# 2. Normalize data
scaler = MinMaxScaler()
print(data.columns)
scaled_data = scaler.fit_transform(data)
# 3. Create sequences for supervised learning
def create_sequences(data, seq_length):
xs, ys = [], []
for i in range(len(data) - seq_length):
x = data[i : i + seq_length].flatten()
y = data[i + seq_length]
xs.append(x)
ys.append(y)
return np.array(xs), np.array(ys)
seq_length = 50
X, y = create_sequences(scaled_data, seq_length)
# 4. Split into training and testing
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.02)
# 5. Train linear regression model
model = LinearRegression()
model.fit(X_train, y_train)
# 6. Make predictions
predictions = model.predict(X_test)
# 7. Evaluate performance
mse = mean_squared_error(y_test, predictions)
r2 = r2_score(y_test, predictions)
print(f"Test MSE: {mse:.4f}")
print(f"Test r2: {r2:.4f}")
print(f"Score: {model.score(X_test, y_test)}")
# 8. Inverse transform predictions
predictions_rescaled = scaler.inverse_transform(predictions.reshape(-1, data.shape[1]))
y_test_rescaled = scaler.inverse_transform(y_test.reshape(-1, data.shape[1]))
# 9. Plot results
# Loss bar
# Prediction vs Actual
plt.plot(y_test_rescaled, label="Actual")
plt.plot(predictions_rescaled, label="Predicted")
plt.title("Actual vs. Predicted")
plt.xlabel("Sample")
plt.ylabel("Value")
plt.legend()
plt.show()
File renamed without changes.
+16200 -14752
View File
File diff suppressed because it is too large. Load diff
+95
View File
@@ -0,0 +1,95 @@
"extracting the load data step from the notebook"
import io
# from itertools import islice
from typing import Union
import pandas as pd
from global_config import DATA_FILE_NAME
def cut_headers(stream: Union[io.StringIO, io.FileIO, io.TextIOWrapper]):
headers = []
exist_startheader = False
p99_header = 123 # should there be header
while (line := stream.readline()) and p99_header > 0:
if "-BEGIN HEADER-" in line and not exist_startheader:
exist_startheader = True
headers.append(str(line.strip()))
elif "-END HEADER-" in line and exist_startheader:
headers.append(str(line.strip()))
break
elif exist_startheader:
# print(f"{line = }")
headers.append(str(line.strip()))
elif not exist_startheader:
p99_header -= 1
# continue
if not exist_startheader or p99_header == 0:
# If no headers are found, reset the stream and return
stream.seek(0)
return "", stream
return "\n".join(headers), stream
# if __name__ == "__main__":
# with open("hanoi_qv2m_latest.csv", "r", encoding="utf-8") as file:
# header, file = cut_headers(file)
# print("Extracted Header:")
# print(header)
# data = pd.read_csv(file)
# print("\nFirst 5 Lines of Data:")
# print(data.head())
# print(data.isnull().sum())
def load_data(
weather_file_name, columns=["Year", "Month", "Day", "Humidity"].copy(), na=-999
):
with open(weather_file_name, "r", encoding="utf-8") as file:
_header, file = cut_headers(file)
data = pd.read_csv(file, na_values=na)
# print(header)
data.columns = columns
return data
def date_combine(data: pd.DataFrame, verbose=False):
data["Date"] = pd.to_datetime(data[["Year", "Month", "Day"]])
data = data.drop(columns=["Year", "Month", "Day"])
if verbose:
print("b4 set index", data.columns)
data = data.set_index("Date")
if verbose:
print("after set index", data.columns)
return data
def validate_view(data: pd.DataFrame, verbose=False):
if verbose:
print(f"Shape with N/A values: {data.shape}")
isn = data.isnull().sum().iloc[0]
print(f"Count of N/A values: {isn}")
data = data.dropna() # Drop the rows with missing values
if verbose:
isn = data.isnull().sum().iloc[0]
print(f"Count after drop: {isn}")
print(data.describe())
return data
def load_this_data(filename=DATA_FILE_NAME, verbose=False, *a):
d = load_data(filename, *a)
d = date_combine(d, verbose)
d = validate_view(d, verbose)
if verbose:
print(d.head())
print(d.columns)
return d
if __name__ == "__main__":
load_this_data(verbose=True)
+186 -186
View File
@@ -66,17 +66,17 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": 2,
"metadata": { "metadata": {
"id": "9vfz_tsewSmD",
"outputId": "2efacccd-4025-444c-ab48-34ae58e55462",
"colab": { "colab": {
"base_uri": "https://localhost:8080/", "base_uri": "https://localhost:8080/",
"height": 551 "height": 551
} },
"id": "9vfz_tsewSmD",
"outputId": "2efacccd-4025-444c-ab48-34ae58e55462"
}, },
"outputs": [ "outputs": [
{ {
"output_type": "stream",
"name": "stdout", "name": "stdout",
"output_type": "stream",
"text": [ "text": [
"-BEGIN HEADER-\n", "-BEGIN HEADER-\n",
"\n", "\n",
@@ -98,17 +98,12 @@
] ]
}, },
{ {
"output_type": "execute_result",
"data": { "data": {
"text/plain": [ "application/vnd.google.colaboratory.intrinsic+json": {
" Humidity\n", "summary": "{\n \"name\": \"data\",\n \"rows\": 16197,\n \"fields\": [\n {\n \"column\": \"Date\",\n \"properties\": {\n \"dtype\": \"date\",\n \"min\": \"1981-01-01 00:00:00\",\n \"max\": \"2025-05-06 00:00:00\",\n \"num_unique_values\": 16197,\n \"samples\": [\n \"2008-04-18 00:00:00\",\n \"1983-12-23 00:00:00\",\n \"1990-11-18 00:00:00\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Humidity\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 4.796305273033087,\n \"min\": 3.15,\n \"max\": 23.39,\n \"num_unique_values\": 1864,\n \"samples\": [\n 17.59,\n 16.12,\n 18.47\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}",
"Date \n", "type": "dataframe",
"1981-01-01 9.57\n", "variable_name": "data"
"1981-01-02 8.51\n", },
"1981-01-03 7.24\n",
"1981-01-04 9.20\n",
"1981-01-05 11.80"
],
"text/html": [ "text/html": [
"\n", "\n",
" <div id=\"df-7d81f82a-224a-4844-87a0-190aa05ad2ef\" class=\"colab-df-container\">\n", " <div id=\"df-7d81f82a-224a-4844-87a0-190aa05ad2ef\" class=\"colab-df-container\">\n",
@@ -371,14 +366,19 @@
" </div>\n", " </div>\n",
" </div>\n" " </div>\n"
], ],
"application/vnd.google.colaboratory.intrinsic+json": { "text/plain": [
"type": "dataframe", " Humidity\n",
"variable_name": "data", "Date \n",
"summary": "{\n \"name\": \"data\",\n \"rows\": 16197,\n \"fields\": [\n {\n \"column\": \"Date\",\n \"properties\": {\n \"dtype\": \"date\",\n \"min\": \"1981-01-01 00:00:00\",\n \"max\": \"2025-05-06 00:00:00\",\n \"num_unique_values\": 16197,\n \"samples\": [\n \"2008-04-18 00:00:00\",\n \"1983-12-23 00:00:00\",\n \"1990-11-18 00:00:00\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Humidity\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 4.796305273033087,\n \"min\": 3.15,\n \"max\": 23.39,\n \"num_unique_values\": 1864,\n \"samples\": [\n 17.59,\n 16.12,\n 18.47\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" "1981-01-01 9.57\n",
} "1981-01-02 8.51\n",
"1981-01-03 7.24\n",
"1981-01-04 9.20\n",
"1981-01-05 11.80"
]
}, },
"execution_count": 2,
"metadata": {}, "metadata": {},
"execution_count": 2 "output_type": "execute_result"
} }
], ],
"source": [ "source": [
@@ -420,22 +420,22 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": 3,
"metadata": { "metadata": {
"id": "KGuNRxutwSmE",
"outputId": "c676b5a0-1b45-42ff-a23e-5e98d506c273",
"colab": { "colab": {
"base_uri": "https://localhost:8080/" "base_uri": "https://localhost:8080/"
} },
"id": "KGuNRxutwSmE",
"outputId": "c676b5a0-1b45-42ff-a23e-5e98d506c273"
}, },
"outputs": [ "outputs": [
{ {
"output_type": "execute_result",
"data": { "data": {
"text/plain": [ "text/plain": [
"(16197, 1)" "(16197, 1)"
] ]
}, },
"execution_count": 3,
"metadata": {}, "metadata": {},
"execution_count": 3 "output_type": "execute_result"
} }
], ],
"source": [ "source": [
@@ -445,23 +445,18 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": null,
"metadata": { "metadata": {
"id": "gtFfTZ-fwSmE",
"outputId": "d304b35d-5e95-47e2-b0eb-b187b47984c8",
"colab": { "colab": {
"base_uri": "https://localhost:8080/", "base_uri": "https://localhost:8080/",
"height": 115 "height": 115
} },
"id": "gtFfTZ-fwSmE",
"outputId": "d304b35d-5e95-47e2-b0eb-b187b47984c8"
}, },
"outputs": [ "outputs": [
{ {
"output_type": "execute_result",
"data": { "data": {
"text/plain": [
"Humidity 3\n",
"dtype: int64"
],
"text/html": [ "text/html": [
"<div>\n", "<div>\n",
"<style scoped>\n", "<style scoped>\n",
@@ -492,36 +487,36 @@
" </tbody>\n", " </tbody>\n",
"</table>\n", "</table>\n",
"</div><br><label><b>dtype:</b> int64</label>" "</div><br><label><b>dtype:</b> int64</label>"
],
"text/plain": [
"Humidity 3\n",
"dtype: int64"
] ]
}, },
"execution_count": 4,
"metadata": {}, "metadata": {},
"execution_count": 4 "output_type": "execute_result"
} }
], ],
"source": [ "source": [
"data.isnull().sum()\n", "data.isna().sum()\n",
"# There are 3 missing values in Humidity column" "# There are 3 missing values in Humidity column"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": null,
"metadata": { "metadata": {
"id": "yJuOfNUrwSmE",
"outputId": "a1614ee6-5680-4f54-bcfd-769a9a78943f",
"colab": { "colab": {
"base_uri": "https://localhost:8080/", "base_uri": "https://localhost:8080/",
"height": 115 "height": 115
} },
"id": "yJuOfNUrwSmE",
"outputId": "a1614ee6-5680-4f54-bcfd-769a9a78943f"
}, },
"outputs": [ "outputs": [
{ {
"output_type": "execute_result",
"data": { "data": {
"text/plain": [
"Humidity 0\n",
"dtype: int64"
],
"text/html": [ "text/html": [
"<div>\n", "<div>\n",
"<style scoped>\n", "<style scoped>\n",
@@ -552,10 +547,15 @@
" </tbody>\n", " </tbody>\n",
"</table>\n", "</table>\n",
"</div><br><label><b>dtype:</b> int64</label>" "</div><br><label><b>dtype:</b> int64</label>"
],
"text/plain": [
"Humidity 0\n",
"dtype: int64"
] ]
}, },
"execution_count": 5,
"metadata": {}, "metadata": {},
"execution_count": 5 "output_type": "execute_result"
} }
], ],
"source": [ "source": [
@@ -567,28 +567,20 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": 6,
"metadata": { "metadata": {
"id": "ODdNZOukwSmF",
"outputId": "f54da03b-895c-4027-9116-d76e88c093ad",
"colab": { "colab": {
"base_uri": "https://localhost:8080/", "base_uri": "https://localhost:8080/",
"height": 300 "height": 300
} },
"id": "ODdNZOukwSmF",
"outputId": "f54da03b-895c-4027-9116-d76e88c093ad"
}, },
"outputs": [ "outputs": [
{ {
"output_type": "execute_result",
"data": { "data": {
"text/plain": [ "application/vnd.google.colaboratory.intrinsic+json": {
" Humidity\n", "summary": "{\n \"name\": \"data\",\n \"rows\": 8,\n \"fields\": [\n {\n \"column\": \"Humidity\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 5720.786588664725,\n \"min\": 3.15,\n \"max\": 16194.0,\n \"num_unique_values\": 8,\n \"samples\": [\n 14.918440163023341,\n 15.57,\n 16194.0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}",
"count 16194.000000\n", "type": "dataframe"
"mean 14.918440\n", },
"std 4.796305\n",
"min 3.150000\n",
"25% 11.150000\n",
"50% 15.570000\n",
"75% 19.310000\n",
"max 23.390000"
],
"text/html": [ "text/html": [
"\n", "\n",
" <div id=\"df-3372d7c2-bbe3-491a-9a48-20a3092647a3\" class=\"colab-df-container\">\n", " <div id=\"df-3372d7c2-bbe3-491a-9a48-20a3092647a3\" class=\"colab-df-container\">\n",
@@ -859,13 +851,21 @@
" </div>\n", " </div>\n",
" </div>\n" " </div>\n"
], ],
"application/vnd.google.colaboratory.intrinsic+json": { "text/plain": [
"type": "dataframe", " Humidity\n",
"summary": "{\n \"name\": \"data\",\n \"rows\": 8,\n \"fields\": [\n {\n \"column\": \"Humidity\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 5720.786588664725,\n \"min\": 3.15,\n \"max\": 16194.0,\n \"num_unique_values\": 8,\n \"samples\": [\n 14.918440163023341,\n 15.57,\n 16194.0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" "count 16194.000000\n",
} "mean 14.918440\n",
"std 4.796305\n",
"min 3.150000\n",
"25% 11.150000\n",
"50% 15.570000\n",
"75% 19.310000\n",
"max 23.390000"
]
}, },
"execution_count": 6,
"metadata": {}, "metadata": {},
"execution_count": 6 "output_type": "execute_result"
} }
], ],
"source": [ "source": [
@@ -887,33 +887,33 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 7, "execution_count": 7,
"metadata": { "metadata": {
"id": "F_GnBSNPwSmF",
"outputId": "b3ae5237-1ead-4d3b-dbe4-fd3415e3be51",
"colab": { "colab": {
"base_uri": "https://localhost:8080/", "base_uri": "https://localhost:8080/",
"height": 444 "height": 444
} },
"id": "F_GnBSNPwSmF",
"outputId": "b3ae5237-1ead-4d3b-dbe4-fd3415e3be51"
}, },
"outputs": [ "outputs": [
{ {
"output_type": "execute_result",
"data": { "data": {
"text/plain": [ "text/plain": [
"<matplotlib.legend.Legend at 0x7c5c365680d0>" "<matplotlib.legend.Legend at 0x7c5c365680d0>"
] ]
}, },
"execution_count": 7,
"metadata": {}, "metadata": {},
"execution_count": 7 "output_type": "execute_result"
}, },
{ {
"output_type": "display_data",
"data": { "data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABkoAAAGsCAYAAACSD/sZAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjAsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvlHJYcgAAAAlwSFlzAAAPYQAAD2EBqD+naQABAABJREFUeJzsnXec3MTZx3/aveLee8PGuBsbY8CUGAwYDKGE0Esg9CQvkJAECIReQg0JEDoBGwhgejW2wRX3Bu69l7Pv3O7O1+929f6xO9qRNOoz0nI3Xz58fLsr6ZkZjUYz8zRFVVUVEolEIp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Ny4kfl7fn4+WrRoofs/FJIJYMssYMUnqX+T4rSaqqpi9OjRGDNmjOm3l19+Ga1atcLOnTuFyQ/CqFGjoCgKnnzySdNv55xzDhRFcVSeSSQSiUQikUj4M2+TdXhbiUQikUgkkmwjQbk0lFTUmrwOeKEoiuZRUJtI4uUZ7D3JKHj9B7HeNHbsOlgZipyyqjoUFFfpvpu9cV8osonaY+ycrdp3KLine truncated
"text/plain": [ "text/plain": [
"<Figure size 2000x500 with 1 Axes>" "<Figure size 2000x500 with 1 Axes>"
], ]
"image/png": "iVBORw0KGgoAAAANSUhEUgAABkoAAAGsCAYAAACSD/sZAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjAsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvlHJYcgAAAAlwSFlzAAAPYQAAD2EBqD+naQABAABJREFUeJzsnXec3MTZx3/aveLee8PGuBsbY8CUGAwYDKGE0Esg9CQvkJAECIReQg0JEDoBGwhgejW2wRX3Bu69l7Pv3O7O1+929f6xO9qRNOoz0nI3Xz58fLsr6ZkZjUYz8zRFVVUVEolEIpFIJBKJRCKRSCQSiUQikUgkDZBY1AWQSCQSiUQikUgkEolEIpFIJBKJRCKJCqkokUgkEolEIpFIJBKJRCKRSCQSiUTSYJGKEolEIpFIJBKJRCKRSCQSiUQikUgkDRapKJFIJBKJRCKRSCQSiUQikUgkEolE0mCRihKJRCKRSCQSiUQikUgkEolEIpFIJA0WqSiRSCQSiUQikUgkEolEIpFIJBKJRNJgkYoSiUQikUgkEolEIpFIJBKJRCKRSCQNlpyoC8CDZDKJgoICNG/eHIqiRF0ciUQikUgkEolEIpFIJBKJRCKRSCQRoqoqDh06hC5duiAWs/cZqReKkoKCAnTv3j3qYkgkEolEIpFIJBKJRCKRSCQSiUQiySJ27NiBbt262R5TLxQlzZs3B5CqcIsWLSIujUQikUgkEolEIpFIJBKJRCKRSCSSKCktLUX37t01/YEd9UJRQsJttWjRQipKJBKJRCKRS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sSkSZMwZcoUAEDLli3Rt29fnHzyydi9ezc6d+4MAPjmm29QUVGByy67TEzlJRKJRCKRSCQSiUQikUgkEonEA09NWos/jOoddTEkIdGgFSX3fr4ChaVVocnr2KIR/vHrIz2d880336BZs2a67xKJhGfZbdq0wQsvvIBYLIZ+/frh6aefRkVFBf7+978DAO655x48+eSTmD17Ni6//HLT+a+88gp69+6NZ599FgDQr18/rFixAk899RRTXuPGjdGsWTPk5OToQnideOKJ6NevH959913cddddAICxY8fikksuMdVTIpFIJBKJRCKRSCQSiUTSMKmoqUOTvAa9dSmRSEKkQY82XpUWUXDqqafilVde0X23YMEC/OY3v/F0nUGDBiEWy0Ra69ixoy5RezweR9u2bVFUVMQ8f82aNRgxYoTuuxNOOMFTGQg33ngjXn/9ddx1110oLCzExIkTMW3aNF/XkkgkEolEIpFIJBKJRCKR1D8GPjAZC+89HR2aN4q6KBKJpAHQoBUlPweaNm2KI444Qvfdzp07tb9jsRhUVdX9Xltba7pObm6u7rOiKMzvkslk0CI7cs011+Duu+/GvHnzMHfuXPTq1QsjR44ULlcikUgkEolEIpFIJBKJRPLzoS6hOh8kkUgkHJCKkp857du3x549e6CqKhRFAQBdAnZeDBgwAF999ZXuu/nz59uek5eXxwwT1rZtW1xwwQUYO3Ys5s2bh+uuu45rWSUSiUQikUgkEolEIpFIJD9/kqpUlEgkknCIOR8iyWZGjRqFvXv34umnn8amTZvw0ksvYeLEidzl/P73v8eGDRtw5513Yt26dXj//fcxbtw423N69uyJLVu2YOnSpdi3bx+qq6u132688Ua8/fbbWLNmDX77299yL69EIpFIJBKJRCKRSCQSieTnjdSTSESz82AFnpm8NupiSLIAqSj5mTNgwAC8/PLLeOmllzB06FAsXLgQd9xxB3c5PXr0wKeffoovvvgCQ4cOxauvvorHH3/c9pyLLroIZ511Fk499VS0b98eH3zwgfbb6NGj0blzZ4wZMwZdunThXl6JRCKRSCQSiUQikUgkEsnPG6kokYhmfeEhvDR9U9TFkGQBimpMcPEzpLS0FC1btkR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l6cvhHLdtiH9Q9KbSKJippowxf2vHuC7vOGwkMRlSTF/V+uxFdLCyItQxQcqqo1K0pW7sEnS3bilRmbsKpAbF+URIdvRUkymcTtt9+Ok046CYMHD2Yes2/fPjz66KO4+eabba911lln4Z133sHUqVPx1FNPYebMmTj77LORSLAHqCeeeAItW7bU/u/evbvfakgkEolEIpFIQuLez1dEXQSJRCKptyhSTyKRSOohiaSKpAr8d/ZmoXIUJfvCLZ3x7x8ilR9TFCRDapJEUkV1nX4fOJlUQ8m9RQwNyO0f+vB3mLVhr+6Y79cUorw6VRb5vq2/+FaU3HLLLVi5ciXGjx/P/L20tBTnnHMOBg4ciIceesj2WpdffjnOP/98HHnkkbjgggvwzTffYNGiRZgxYwbz+HvuuQclJSXa/zt27PBbDYmBcePGoVWrVlEXQyKRSCQSST3kvQXboy6CRCKRSCQSieRnRCK9U795b7lQOdm89/34t2sikburuBKlVeHkbXlj1mb85r8LdN9d89bCUHJvGRUfSRWoMoSzPFRVh9W7UxGNpAdn/cWXouTWW2/FN998g+nTp6Nbt26m3w8dOoSzzjoLzZs3x+eff47c3FxP1z/88MPRrl07bNy4kfl7fn4+WrRoofs/FJIJYMssYMUnqX+T4rSaqqpi9OjRGDNmjOm3l19+Ga1atcLOnTuFyQ/CqFGjoCgKnnzySdNv55xzDhRFcVSeSSQSiUQikUj4M2+TdXhbiUQikUgkkmwjQbk0lFTUmrwOeKEoiuZRUJtI4uUZ7D3JKHj9B7HeNHbsOlgZipyyqjoUFFfpvpu9cV8osonaY+ycrdp3KLine truncated
}, },
"metadata": {} "metadata": {},
"output_type": "display_data"
} }
], ],
"source": [ "source": [
@@ -937,23 +937,23 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 8, "execution_count": 8,
"metadata": { "metadata": {
"id": "qL3DAMVOwSmF",
"outputId": "4a1a8687-7e28-4ae0-8c4c-1b1dec21f004",
"colab": { "colab": {
"base_uri": "https://localhost:8080/", "base_uri": "https://localhost:8080/",
"height": 314 "height": 314
} },
"id": "qL3DAMVOwSmF",
"outputId": "4a1a8687-7e28-4ae0-8c4c-1b1dec21f004"
}, },
"outputs": [ "outputs": [
{ {
"output_type": "display_data",
"data": { "data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABNIAAAEpCAYAAABWYg+uAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjAsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvlHJYcgAAAAlwSFlzAAAPYQAAD2EBqD+naQAAVTJJREFUeJzt3XlcVfW+//H3BmUDFjiAIEriUA45dSRJs7TkiEOD5dix63BNOyZ1FMuhm5razWuD2WBZnRy6aQ6VZsO1TLNORZqaeSr1p4az4AgIKCj7+/vD2LJhgxvcm83wej4e+yF7re/6ru9a7PLje6/vWhZjjBEAAAAAAACAYvl4ewAAAAAAAABARUCQBgAAAAAAALiAIA0AAAAAAABwAUEaAAAAAAAA4AKCNAAAAAAAAMAFBGkAAAAAAACACwjSAAAAAAAAABcQpAEAAAAAAAAuIEgDAAAAAAAAXECQBsBlTz/9tCwWS6m27dq1q7p27ereAcEpT5zrq/ndAwAAVDYbN26UxWLRxo0b3dqvxWLR008/7dY+AbgXQRpQQSxatEgWi8X+8vf31w033KD4+HilpKS4bT9ZWVl6+umn3V4UlFRubq4iIiJksVj0f//3f1fVV3k5pvKO8wQAQNX0+uuvy2KxKCYm5qr6+fzzzwmBXMB5Aio2gjSggpkxY4b+93//V6+99po6deqkN954Qx07dlRWVpZb+s/KytL06dOdhilPPfWUzp0755b9XMmGDRt07NgxRUVFacmSJVfVV3HHhMvKy+8eAACUrSVLligqKkqbN2/W3r17S93P559/runTp7txZJVTcefp3Llzeuqpp8p4RABKgiANqGB69uypBx98UA899JAWLVqksWPHKikpSR9//PFV9Wuz2XT+/Pli21SrVk3+/v5XtR9Xvffee/rLX/6icePGafXq1crMzCyT/XrL+fPnZbPZnK4rD8delr97AABQdpKSkvTDDz9ozpw5Cg0NveovMMu7or58vnjxonJycsp4NIX5+/urWrVq3h4GgGIQpAEV3J133inpUhEkSS+88II6deqkOnXqKCAgQO3bt9cHH3xQaDuLxaL4+HgtWbJEN954o6xWq+bPn6/Q0FBJ0vTp0+3TSPMuPXd2n6yFCxfqzjvvVN26dWW1WtWyZUu98cYbV3VM586d06pVqzRo0CANGDBA586dcxoUFnUvsGHDhikqKkqStH///mKPSbp09dttt92mGjVqqGbNmrr33nu1c+fOQv0eOXJEI0aMUEREhKxWqxo1aqTRo0c7FF1//PGH+vfvr9q1ayswMFC33HKLPvvsM4d+8u6psWzZMj311FOqX7++AgMDlZ6ermHDhumaa67Rvn371KtXL1177bUaPHiwpEth59y5c3XjjTfK399fYWFhevjhh3XmzJliz2dOTo6mTp2q9u3bKzg4WDVq1NBtt92mr7/+2t7mSufJ2e/+4sWLmjlzppo0aSKr1aqoqCg9+eSTys7OdmgXFRWlu+66S9999506dOggf39/NW7cWO+++26x4wYAAJ63ZMkS1apVS71791a/fv0KBWlF3Qts//79slgsWrRokaRL9de8efMkyeF2JHkyMzM1fvx4RUZGymq1qlmzZnrhhRdkjCk0pvfee08dOnRQYGCgatWqpdtvv11ffvmlQ5vXX3/dXsNGRERozJgxSk1NdWjTtWtXtWrVSlu3btXtt9+uwMBAPfnkk/axv/DCC5o7d669lvn9998lSbt27VK/fv1Uu3Zt+fv7Kzo6WmvWrLniufzXv/6l/v3767rrrpPValVkZKTGjRvncFX/lc6Ts3uk/fzzz+rZs6eCgoJ0zTXXqFu3bvrxxx8d2uTdBub7779XQkKCQkNDVaNGDd133306ceLEFccOwHVE3UAFt2/fPklSnTp1JEkvv/yy7rnnHg0ePFg5OTlatmyZ+vfvr08//VS9e/d22HbDhg1asWKF4uPjFRISorZt2+qNN97Q6NGjdd999+n++++XJLVp06bI/b/xxhu68cYbdc8996hatWr65JNP9Mgjj8hms2nMmDGlOqY1a9YoIyNDgwYNUnh4uLp27aolS5bob3/7W4n7Cg0NLfaYvvrqK/Xs2VONGzfW008/rXPnzunVV1/Vrbfeqm3bttkDuaNHj6pDhw5KTU3VqFGj1Lx5cx05ckQffPCBsrKy5Ofnp5SUFHXq1ElZWVl67LHHVKdOHS1evFj33HOPPvjgA913330OY5s5c6b8/Pz0+OOPKzs7W35+fpIuBVRxcXHq3LmzXnjhBQUGBkqSHn74YS1atEjDhw/XY489pqSkJL322mv6+eef9f3336t69epOz0F6err++c9/6oEHHtDIkSN19uxZvfPOO4qLi9PmzZvVrl27K54nZx566CEtXrxY/fr10/jx47Vp0ybNmjVLO3fu1KpVqxza7t27V/369dOIESM0dOhQLViwQMOGDVP79u114403lvC3CgAA3GXJkiW6//775efnpwceeEBvvPGGfvrpJ918880l6ufhhx/W0aNHtW7dOv3v//6vwzpjjO655x59/fXXGjFihNq1a6cvvvhCTzzxhI4cOaKXXnrJ3nb69Ol6+umn1alTJ82YMUN+fn7atGmTNmzYoO7du0u69AXf9OnTFRsbq9GjR2v37t32cResiU6dOqWePXtq0KBBevDBBxUWFmZft3DhQp0/f16jRo2S1WpV7dq19dtvv+nWW29V/fr1NWnSJNWoUUMrVqxQnz599OGHHxaq5/JbuXKlsrKyNHr0aNWpU0ebN2/Wq6++qsOHD2vlypVXPE/O/Pbbb7rtttsUFBSkCRMmqHr16nrzzTfVtWtXffPNN4Xua/foo4+qVq1amjZtmvbv36+5c+cqPj5ey5cvv+K+ALjIAKgQFi5caCSZr776ypw4ccIcOnTILFu2zNSpU8cEBASYw4cPG2OMycrKctguJyfHtGrVytx5550OyyUZHx8f89tvvzksP3HihJFkpk2bVmgM06ZNMwX/t1Fwf8YYExcXZxo3buywrEuXLqZLly4uHetdd91lbr31Vvv7t956y1SrVs0cP37cpT6HDh1qGjZsaH9f3DG1a9fO1K1b15w6dcq+7JdffjE+Pj5myJAh9mVDhgwxPj4+5qeffirUh81mM8YYM3bsWCPJ/Otf/7KvO3v2rGnUqJGJiooyubm5xhhjvv76ayPJNG7cuND5Gzp0qJFkJk2a5LD8X//6l5FklixZ4rB87dq1hZYXPC8XL1402dnZ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MMNN6hatWoKCwtTs2bNHIqITz/9VM8884y2b9/ucK+qgve3kqRGjRpd9Xi+//57TZs2TYmJiYVu3pqWlqbg4OAS9bd8+XJduHBBN910k8NTo2JiYrRkyZJSTxd1Jq+gaNasWaF1LVq00BdffKHMzExlZGQoPT1drVq1umJ/zh4b36JFC/v6/H0Udf6rVaumBg0aOCzbs2eP0tLSVLduXafbHD9+vNixLV68WC+++KJ27dqlCxcuXHEMV3LgwAH5+PioadOmDsvDw8NVs2bNQsXaddddV6iPWrVqXfH+bgAAwDNyc3O1bNky3XHHHfZ77UqXaq4XX3xR69evt0+lvFoHDhxQRESErr32Wofl+Wsk6dItS3x8fIr9oreo+s3Pz0+NGzcuVIPUr1/f/oViQQXroL1798oYoylTpmjKlClOtzl+/Lj9C+yCDh48qKlTp2rNmjWFapzSfMF84sQJZWVlFVmr2mw2HTp0yOE2GQVrrlq1akkSNRfgRgRpQAXToUMHp1dFSZducHrPPffo9ttv1+uvv6569eqpevXqWrhwoZYuXVqofVFXQ7lq3Line truncated
"text/plain": [ "text/plain": [
"<Figure size 1500x300 with 2 Axes>" "<Figure size 1500x300 with 2 Axes>"
], ]
"image/png": "iVBORw0KGgoAAAANSUhEUgAABNIAAAEpCAYAAABWYg+uAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjAsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvlHJYcgAAAAlwSFlzAAAPYQAAD2EBqD+naQAAVTJJREFUeJzt3XlcVfW+//H3BmUDFjiAIEriUA45dSRJs7TkiEOD5dix63BNOyZ1FMuhm5razWuD2WBZnRy6aQ6VZsO1TLNORZqaeSr1p4az4AgIKCj7+/vD2LJhgxvcm83wej4e+yF7re/6ru9a7PLje6/vWhZjjBEAAAAAAACAYvl4ewAAAAAAAABARUCQBgAAAAAAALiAIA0AAAAAAABwAUEaAAAAAAAA4AKCNAAAAAAAAMAFBGkAAAAAAACACwjSAAAAAAAAABcQpAEAAAAAAAAuIEgDAAAAAAAAXECQBsBlTz/9tCwWS6m27dq1q7p27ereAcEpT5zrq/ndAwAAVDYbN26UxWLRxo0b3dqvxWLR008/7dY+AbgXQRpQQSxatEgWi8X+8vf31w033KD4+HilpKS4bT9ZWVl6+umn3V4UlFRubq4iIiJksVj0f//3f1fVV3k5pvKO8wQAQNX0+uuvy2KxKCYm5qr6+fzzzwmBXMB5Aio2gjSggpkxY4b+93//V6+99po6deqkN954Qx07dlRWVpZb+s/KytL06dOdhilPPfWUzp0755b9XMmGDRt07NgxRUVFacmSJVfVV3HHhMvKy+8eAACUrSVLligqKkqbN2/W3r17S93P559/runTp7txZJVTcefp3Llzeuqpp8p4RABKgiANqGB69uypBx98UA899JAWLVqksWPHKikpSR9//PFV9Wuz2XT+/Pli21SrVk3+/v5XtR9Xvffee/rLX/6icePGafXq1crMzCyT/XrL+fPnZbPZnK4rD8delr97AABQdpKSkvTDDz9ozpw5Cg0NveovMMu7or58vnjxonJycsp4NIX5+/urWrVq3h4GgGIQpAEV3J133inpUhEkSS+88II6deqkOnXqKCAgQO3bt9cHH3xQaDuLxaL4+HgtWbJEN954o6xWq+bPn6/Q0FBJ0vTp0+3TSPMuPXd2n6yFCxfqzjvvVN26dWW1WtWyZUu98cYbV3VM586d06pVqzRo0CANGDBA586dcxoUFnUvsGHDhikqKkqStH///mKPSbp09dttt92mGjVqqGbNmrr33nu1c+fOQv0eOXJEI0aMUEREhKxWqxo1aqTRo0c7FF1//PGH+vfvr9q1ayswMFC33HKLPvvsM4d+8u6psWzZMj311FOqX7++AgMDlZ6ermHDhumaa67Rvn371KtXL1177bUaPHiwpEth59y5c3XjjTfK399fYWFhevjhh3XmzJliz2dOTo6mTp2q9u3bKzg4WDVq1NBtt92mr7/+2t7mSufJ2e/+4sWLmjlzppo0aSKr1aqoqCg9+eSTys7OdmgXFRWlu+66S9999506dOggf39/NW7cWO+++26x4wYAAJ63ZMkS1apVS71791a/fv0KBWlF3Qts//79slgsWrRokaRL9de8efMkyeF2JHkyMzM1fvx4RUZGymq1qlmzZnrhhRdkjCk0pvfee08dOnRQYGCgatWqpdtvv11ffvmlQ5vXX3/dXsNGRERozJgxSk1NdWjTtWtXtWrVSlu3btXtt9+uwMBAPfnkk/axv/DCC5o7d669lvn9998lSbt27VK/fv1Uu3Zt+fv7Kzo6WmvWrLniufzXv/6l/v3767rrrpPValVkZKTGjRvncFX/lc6Ts3uk/fzzz+rZs6eCgoJ0zTXXqFu3bvrxxx8d2uTdBub7779XQkKCQkNDVaNGDd133306ceLEFccOwHVE3UAFt2/fPklSnTp1JEkvv/yy7rnnHg0ePFg5OTlatmyZ+vfvr08//VS9e/d22HbDhg1asWKF4uPjFRISorZt2+qNN97Q6NGjdd999+n++++XJLVp06bI/b/xxhu68cYbdc8996hatWr65JNP9Mgjj8hms2nMmDGlOqY1a9YoIyNDgwYNUnh4uLp27aolS5bob3/7W4n7Cg0NLfaYvvrqK/Xs2VONGzfW008/rXPnzunVV1/Vrbfeqm3bttkDuaNHj6pDhw5KTU3VqFGj1Lx5cx05ckQffPCBsrKy5Ofnp5SUFHXq1ElZWVl67LHHVKdOHS1evFj33HOPPvjgA913330OY5s5c6b8/Pz0+OOPKzs7W35+fpIuBVRxcXHq3LmzXnjhBQUGBkqSHn74YS1atEjDhw/XY489pqSkJL322mv6+eef9f3336t69epOz0F6err++c9/6oEHHtDIkSN19uxZvfPOO4qLi9PmzZvVrl27K54nZx566CEtXrxY/fr10/jx47Vp0ybNmjVLO3fu1KpVqxza7t27V/369dOIESM0dOhQLViwQMOGDVP79u114403lvC3CgAA3GXJkiW6//775efnpwceeEBvvPGGfvrpJ918880l6ufhhx/W0aNHtW7dOv3v//6vwzpjjO655x59/fXXGjFihNq1a6cvvvhCTzzxhI4cOaKXXnrJ3nb69Ol6+umn1alTJ82YMUN+fn7atGmTNmzYoO7du0u69AXf9OnTFRsbq9GjR2v37t32cResiU6dOqWePXtq0KBBevDBBxUWFmZft3DhQp0/f16jRo2S1WpV7dq19dtvv+nWW29V/fr1NWnSJNWoUUMrVqxQnz599OGHHxaq5/JbuXKlsrKyNHr0aNWpU0ebN2/Wq6++qsOHD2vlypVXPE/O/Pbbb7rtttsUFBSkCRMmqHr16nrzzTfVtWtXffPNN4Xua/foo4+qVq1amjZtmvbv36+5c+cqPj5ey5cvv+K+ALjIAKgQFi5caCSZr776ypw4ccIcOnTILFu2zNSpU8cEBASYw4cPG2OMycrKctguJyfHtGrVytx5550OyyUZHx8f89tvvzksP3HihJFkpk2bVmgM06ZNMwX/t1Fwf8YYExcXZxo3buywrEuXLqZLly4uHetdd91lbr31Vvv7t956y1SrVs0cP37cpT6HDh1qGjZsaH9f3DG1a9fO1K1b15w6dcq+7JdffjE+Pj5myJAh9mVDhgwxPj4+5qeffirUh81mM8YYM3bsWCPJ/Otf/7KvO3v2rGnUqJGJiooyubm5xhhjvv76ayPJNG7cuND5Gzp0qJFkJk2a5LD8X//6l5FklixZ4rB87dq1hZYXPC8XL1402dnZDtudOXPGhIWFmf/8z/906TwV/N1v377dSDIPPfSQQ7vHH3/cSDIbNmywL2vYsKGRZL799lv7suPHjxur1WrGjx9faF8AAKBsbNmyxUgy69atM8ZcqmkaNGhg/vGPf9jb5NUtX3/9tcO2SUlJRpJZuHChfdmYMWMK1YrGGLN69WojyTzzzDMOy/v162csFovZu3evMcaYPXv2GB8fH3PffffZ66Y8efXW8ePHjZ+fn+nevbtDm9dee81IMgsWLLAv69Kli5Fk5s+f73TsQUFBherLbt26mdatW5vz58877LtTp07m+uuvL/a8OKuLZ82aZSwWizlw4MAVz5MxplAt1qdPH+Pn52f27dtnX3b06FFz7bXXmttvv92+LO/fCrGxsfZzZYwx48aNM76+viY1NdXp/gCUHFM7gQomNjZWoaGhioyM1KBBg3TNNddo1apVql+/viQpICDA3vbMmTNKS0vTbbfdpm3bthXqq0uXLmrZsuVVjSf//tLS0nTy5El16dJFf/zxh9LS0krc36lTp/TFF1/ogQcesC/r27evLBaLVqxYcVVjLejYsWPavn27hg0bptq1a9u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Line truncated
}, },
"metadata": {} "metadata": {},
"output_type": "display_data"
} }
], ],
"source": [ "source": [
@@ -1014,22 +1014,22 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 12, "execution_count": 12,
"metadata": { "metadata": {
"id": "sZHbbu6QwSmG",
"outputId": "26b04185-11a0-4d02-9f7d-05afe5ead8c9",
"colab": { "colab": {
"base_uri": "https://localhost:8080/" "base_uri": "https://localhost:8080/"
} },
"id": "sZHbbu6QwSmG",
"outputId": "26b04185-11a0-4d02-9f7d-05afe5ead8c9"
}, },
"outputs": [ "outputs": [
{ {
"output_type": "execute_result",
"data": { "data": {
"text/plain": [ "text/plain": [
"((12955, 1), (3239, 1))" "((12955, 1), (3239, 1))"
] ]
}, },
"execution_count": 12,
"metadata": {}, "metadata": {},
"execution_count": 12 "output_type": "execute_result"
} }
], ],
"source": [ "source": [
@@ -1121,45 +1121,29 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 16, "execution_count": 16,
"metadata": { "metadata": {
"id": "hYq8SOknwSmI",
"outputId": "c233d7a4-d35d-4cd4-d152-9e80dab70ce7",
"colab": { "colab": {
"base_uri": "https://localhost:8080/", "base_uri": "https://localhost:8080/",
"height": 300 "height": 300
} },
"id": "hYq8SOknwSmI",
"outputId": "c233d7a4-d35d-4cd4-d152-9e80dab70ce7"
}, },
"outputs": [ "outputs": [
{ {
"output_type": "display_data",
"data": { "data": {
"text/plain": [
"\u001b[1mModel: \"sequential\"\u001b[0m\n"
],
"text/html": [ "text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\">Model: \"sequential\"</span>\n", "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\">Model: \"sequential\"</span>\n",
"</pre>\n" "</pre>\n"
],
"text/plain": [
"\u001b[1mModel: \"sequential\"\u001b[0m\n"
] ]
}, },
"metadata": {} "metadata": {},
"output_type": "display_data"
}, },
{ {
"output_type": "display_data",
"data": { "data": {
"text/plain": [
"┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓\n",
"┃\u001b[1m \u001b[0m\u001b[1mLayer (type) \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mOutput Shape \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1m Param #\u001b[0m\u001b[1m \u001b[0m┃\n",
"┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩\n",
"│ lstm (\u001b[38;5;33mLSTM\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m100\u001b[0m, \u001b[38;5;34m64\u001b[0m) │ \u001b[38;5;34m16,896\u001b[0m │\n",
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
"│ dropout (\u001b[38;5;33mDropout\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m100\u001b[0m, \u001b[38;5;34m64\u001b[0m) │ \u001b[38;5;34m0\u001b[0m │\n",
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
"│ lstm_1 (\u001b[38;5;33mLSTM\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m100\u001b[0m, \u001b[38;5;34m64\u001b[0m) │ \u001b[38;5;34m33,024\u001b[0m │\n",
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
"│ lstm_2 (\u001b[38;5;33mLSTM\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m64\u001b[0m) │ \u001b[38;5;34m33,024\u001b[0m │\n",
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
"│ dense (\u001b[38;5;33mDense\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m1\u001b[0m) │ \u001b[38;5;34m65\u001b[0m │\n",
"└─────────────────────────────────┴────────────────────────┴───────────────┘\n"
],
"text/html": [ "text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓\n", "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓\n",
"┃<span style=\"font-weight: bold\"> Layer (type) </span>┃<span style=\"font-weight: bold\"> Output Shape </span>┃<span style=\"font-weight: bold\"> Param # </span>┃\n", "┃<span style=\"font-weight: bold\"> Layer (type) </span>┃<span style=\"font-weight: bold\"> Output Shape </span>┃<span style=\"font-weight: bold\"> Param # </span>┃\n",
@@ -1175,48 +1159,64 @@
"│ dense (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">Dense</span>) │ (<span style=\"color: #00d7ff; text-decoration-color: #00d7ff\">None</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">1</span>) │ <span style=\"color: #00af00; text-decoration-color: #00af00\">65</span> │\n", "│ dense (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">Dense</span>) │ (<span style=\"color: #00d7ff; text-decoration-color: #00d7ff\">None</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">1</span>) │ <span style=\"color: #00af00; text-decoration-color: #00af00\">65</span> │\n",
"└─────────────────────────────────┴────────────────────────┴───────────────┘\n", "└─────────────────────────────────┴────────────────────────┴───────────────┘\n",
"</pre>\n" "</pre>\n"
],
"text/plain": [
"┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓\n",
"┃\u001b[1m \u001b[0m\u001b[1mLayer (type) \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mOutput Shape \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1m Param #\u001b[0m\u001b[1m \u001b[0m┃\n",
"┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩\n",
"│ lstm (\u001b[38;5;33mLSTM\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m100\u001b[0m, \u001b[38;5;34m64\u001b[0m) │ \u001b[38;5;34m16,896\u001b[0m │\n",
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
"│ dropout (\u001b[38;5;33mDropout\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m100\u001b[0m, \u001b[38;5;34m64\u001b[0m) │ \u001b[38;5;34m0\u001b[0m │\n",
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
"│ lstm_1 (\u001b[38;5;33mLSTM\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m100\u001b[0m, \u001b[38;5;34m64\u001b[0m) │ \u001b[38;5;34m33,024\u001b[0m │\n",
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
"│ lstm_2 (\u001b[38;5;33mLSTM\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m64\u001b[0m) │ \u001b[38;5;34m33,024\u001b[0m │\n",
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
"│ dense (\u001b[38;5;33mDense\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m1\u001b[0m) │ \u001b[38;5;34m65\u001b[0m │\n",
"└─────────────────────────────────┴────────────────────────┴───────────────┘\n"
] ]
}, },
"metadata": {} "metadata": {},
"output_type": "display_data"
}, },
{ {
"output_type": "display_data",
"data": { "data": {
"text/plain": [
"\u001b[1m Total params: \u001b[0m\u001b[38;5;34m83,009\u001b[0m (324.25 KB)\n"
],
"text/html": [ "text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\"> Total params: </span><span style=\"color: #00af00; text-decoration-color: #00af00\">83,009</span> (324.25 KB)\n", "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\"> Total params: </span><span style=\"color: #00af00; text-decoration-color: #00af00\">83,009</span> (324.25 KB)\n",
"</pre>\n" "</pre>\n"
],
"text/plain": [
"\u001b[1m Total params: \u001b[0m\u001b[38;5;34m83,009\u001b[0m (324.25 KB)\n"
] ]
}, },
"metadata": {} "metadata": {},
"output_type": "display_data"
}, },
{ {
"output_type": "display_data",
"data": { "data": {
"text/plain": [
"\u001b[1m Trainable params: \u001b[0m\u001b[38;5;34m83,009\u001b[0m (324.25 KB)\n"
],
"text/html": [ "text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\"> Trainable params: </span><span style=\"color: #00af00; text-decoration-color: #00af00\">83,009</span> (324.25 KB)\n", "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\"> Trainable params: </span><span style=\"color: #00af00; text-decoration-color: #00af00\">83,009</span> (324.25 KB)\n",
"</pre>\n" "</pre>\n"
],
"text/plain": [
"\u001b[1m Trainable params: \u001b[0m\u001b[38;5;34m83,009\u001b[0m (324.25 KB)\n"
] ]
}, },
"metadata": {} "metadata": {},
"output_type": "display_data"
}, },
{ {
"output_type": "display_data",
"data": { "data": {
"text/plain": [
"\u001b[1m Non-trainable params: \u001b[0m\u001b[38;5;34m0\u001b[0m (0.00 B)\n"
],
"text/html": [ "text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\"> Non-trainable params: </span><span style=\"color: #00af00; text-decoration-color: #00af00\">0</span> (0.00 B)\n", "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\"> Non-trainable params: </span><span style=\"color: #00af00; text-decoration-color: #00af00\">0</span> (0.00 B)\n",
"</pre>\n" "</pre>\n"
],
"text/plain": [
"\u001b[1m Non-trainable params: \u001b[0m\u001b[38;5;34m0\u001b[0m (0.00 B)\n"
] ]
}, },
"metadata": {} "metadata": {},
"output_type": "display_data"
} }
], ],
"source": [ "source": [
@@ -1260,16 +1260,16 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 18, "execution_count": 18,
"metadata": { "metadata": {
"id": "6JOTZ3zjwSmI",
"outputId": "142b6860-b4cc-46aa-ec32-40400202fe1d",
"colab": { "colab": {
"base_uri": "https://localhost:8080/" "base_uri": "https://localhost:8080/"
} },
"id": "6JOTZ3zjwSmI",
"outputId": "142b6860-b4cc-46aa-ec32-40400202fe1d"
}, },
"outputs": [ "outputs": [
{ {
"output_type": "stream",
"name": "stdout", "name": "stdout",
"output_type": "stream",
"text": [ "text": [
"Epoch 1/100\n", "Epoch 1/100\n",
"\u001b[1m101/101\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m7s\u001b[0m 25ms/step - loss: 0.0553 - val_loss: 0.0189 - learning_rate: 0.0010\n", "\u001b[1m101/101\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m7s\u001b[0m 25ms/step - loss: 0.0553 - val_loss: 0.0189 - learning_rate: 0.0010\n",
@@ -1474,14 +1474,14 @@
] ]
}, },
{ {
"output_type": "execute_result",
"data": { "data": {
"text/plain": [ "text/plain": [
"<keras.src.callbacks.history.History at 0x7c5c43602a10>" "<keras.src.callbacks.history.History at 0x7c5c43602a10>"
] ]
}, },
"execution_count": 18,
"metadata": {}, "metadata": {},
"execution_count": 18 "output_type": "execute_result"
} }
], ],
"source": [ "source": [
@@ -1518,16 +1518,16 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 19, "execution_count": 19,
"metadata": { "metadata": {
"id": "wSiP2xZkwSmO",
"outputId": "41202ce9-f617-4a62-acba-afe99fb40584",
"colab": { "colab": {
"base_uri": "https://localhost:8080/" "base_uri": "https://localhost:8080/"
} },
"id": "wSiP2xZkwSmO",
"outputId": "41202ce9-f617-4a62-acba-afe99fb40584"
}, },
"outputs": [ "outputs": [
{ {
"output_type": "stream",
"name": "stdout", "name": "stdout",
"output_type": "stream",
"text": [ "text": [
"\u001b[1m25/25\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 15ms/step\n" "\u001b[1m25/25\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 15ms/step\n"
] ]
@@ -1550,15 +1550,14 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 20, "execution_count": 20,
"metadata": { "metadata": {
"id": "rSmZGxXDwSmO",
"outputId": "647ec968-f97e-4e1b-d041-aea03636b60e",
"colab": { "colab": {
"base_uri": "https://localhost:8080/" "base_uri": "https://localhost:8080/"
} },
"id": "rSmZGxXDwSmO",
"outputId": "647ec968-f97e-4e1b-d041-aea03636b60e"
}, },
"outputs": [ "outputs": [
{ {
"output_type": "execute_result",
"data": { "data": {
"text/plain": [ "text/plain": [
"array([[18.85141 ],\n", "array([[18.85141 ],\n",
@@ -1570,8 +1569,9 @@
" [17.67097 ]], dtype=float32)" " [17.67097 ]], dtype=float32)"
] ]
}, },
"execution_count": 20,
"metadata": {}, "metadata": {},
"execution_count": 20 "output_type": "execute_result"
} }
], ],
"source": [ "source": [
@@ -1593,34 +1593,21 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 21, "execution_count": 21,
"metadata": { "metadata": {
"id": "H_VnZPtDwSmO",
"outputId": "c10bf3c1-2781-4bb2-a388-4f859c55e60f",
"colab": { "colab": {
"base_uri": "https://localhost:8080/", "base_uri": "https://localhost:8080/",
"height": 455 "height": 455
} },
"id": "H_VnZPtDwSmO",
"outputId": "c10bf3c1-2781-4bb2-a388-4f859c55e60f"
}, },
"outputs": [ "outputs": [
{ {
"output_type": "execute_result",
"data": { "data": {
"text/plain": [ "application/vnd.google.colaboratory.intrinsic+json": {
" Actual Predicted\n", "summary": "{\n \"name\": \"pred_df\",\n \"rows\": 3139,\n \"fields\": [\n {\n \"column\": \"Date\",\n \"properties\": {\n \"dtype\": \"date\",\n \"min\": \"2016-09-29 00:00:00\",\n \"max\": \"2025-05-03 00:00:00\",\n \"num_unique_values\": 3139,\n \"samples\": [\n \"2021-08-29 00:00:00\",\n \"2018-12-06 00:00:00\",\n \"2017-12-23 00:00:00\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Actual\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 4.922379959478632,\n \"min\": 4.27,\n \"max\": 23.39,\n \"num_unique_values\": 1395,\n \"samples\": [\n 10.32,\n 8.52,\n 15.38\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Predicted\",\n \"properties\": {\n \"dtype\": \"float32\",\n \"num_unique_values\": 3137,\n \"samples\": [\n 21.144052505493164,\n 8.950167655944824,\n 6.3031134605407715\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}",
"Date \n", "type": "dataframe",
"2016-09-29 18.54 18.851410\n", "variable_name": "pred_df"
"2016-09-30 16.50 18.478785\n", },
"2016-10-01 16.03 16.582554\n",
"2016-10-02 16.06 16.595911\n",
"2016-10-03 17.03 16.462191\n",
"... ... ...\n",
"2025-04-29 16.88 17.737617\n",
"2025-04-30 17.44 16.928251\n",
"2025-05-01 17.31 17.847725\n",
"2025-05-02 17.37 17.350359\n",
"2025-05-03 19.26 17.670971\n",
"\n",
"[3139 rows x 2 columns]"
],
"text/html": [ "text/html": [
"\n", "\n",
" <div id=\"df-e72b2590-c412-4153-a00b-da1085937b97\" class=\"colab-df-container\">\n", " <div id=\"df-e72b2590-c412-4153-a00b-da1085937b97\" class=\"colab-df-container\">\n",
@@ -1976,14 +1963,27 @@
" </div>\n", " </div>\n",
" </div>\n" " </div>\n"
], ],
"application/vnd.google.colaboratory.intrinsic+json": { "text/plain": [
"type": "dataframe", " Actual Predicted\n",
"variable_name": "pred_df", "Date \n",
"summary": "{\n \"name\": \"pred_df\",\n \"rows\": 3139,\n \"fields\": [\n {\n \"column\": \"Date\",\n \"properties\": {\n \"dtype\": \"date\",\n \"min\": \"2016-09-29 00:00:00\",\n \"max\": \"2025-05-03 00:00:00\",\n \"num_unique_values\": 3139,\n \"samples\": [\n \"2021-08-29 00:00:00\",\n \"2018-12-06 00:00:00\",\n \"2017-12-23 00:00:00\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Actual\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 4.922379959478632,\n \"min\": 4.27,\n \"max\": 23.39,\n \"num_unique_values\": 1395,\n \"samples\": [\n 10.32,\n 8.52,\n 15.38\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Predicted\",\n \"properties\": {\n \"dtype\": \"float32\",\n \"num_unique_values\": 3137,\n \"samples\": [\n 21.144052505493164,\n 8.950167655944824,\n 6.3031134605407715\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" "2016-09-29 18.54 18.851410\n",
} "2016-09-30 16.50 18.478785\n",
"2016-10-01 16.03 16.582554\n",
"2016-10-02 16.06 16.595911\n",
"2016-10-03 17.03 16.462191\n",
"... ... ...\n",
"2025-04-29 16.88 17.737617\n",
"2025-04-30 17.44 16.928251\n",
"2025-05-01 17.31 17.847725\n",
"2025-05-02 17.37 17.350359\n",
"2025-05-03 19.26 17.670971\n",
"\n",
"[3139 rows x 2 columns]"
]
}, },
"execution_count": 21,
"metadata": {}, "metadata": {},
"execution_count": 21 "output_type": "execute_result"
} }
], ],
"source": [ "source": [
@@ -2008,16 +2008,16 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 22, "execution_count": 22,
"metadata": { "metadata": {
"id": "TA_pBedxwSmT",
"outputId": "3da2b6b2-c50c-4656-ffaf-5effd15384d7",
"colab": { "colab": {
"base_uri": "https://localhost:8080/" "base_uri": "https://localhost:8080/"
} },
"id": "TA_pBedxwSmT",
"outputId": "3da2b6b2-c50c-4656-ffaf-5effd15384d7"
}, },
"outputs": [ "outputs": [
{ {
"output_type": "stream",
"name": "stdout", "name": "stdout",
"output_type": "stream",
"text": [ "text": [
"0.9214262573889067\n", "0.9214262573889067\n",
"1.903221483260166\n" "1.903221483260166\n"
@@ -2034,33 +2034,33 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 23, "execution_count": 23,
"metadata": { "metadata": {
"id": "qgPJTuV-wSmT",
"outputId": "f7c2277e-be4c-4453-cfc8-651bd08dba4e",
"colab": { "colab": {
"base_uri": "https://localhost:8080/", "base_uri": "https://localhost:8080/",
"height": 444 "height": 444
} },
"id": "qgPJTuV-wSmT",
"outputId": "f7c2277e-be4c-4453-cfc8-651bd08dba4e"
}, },
"outputs": [ "outputs": [
{ {
"output_type": "execute_result",
"data": { "data": {
"text/plain": [ "text/plain": [
"<matplotlib.legend.Legend at 0x7c5c445a7cd0>" "<matplotlib.legend.Legend at 0x7c5c445a7cd0>"
] ]
}, },
"execution_count": 23,
"metadata": {}, "metadata": {},
"execution_count": 23 "output_type": "execute_result"
}, },
{ {
"output_type": "display_data",
"data": { "data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABkoAAAGsCAYAAACSD/sZAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjAsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvlHJYcgAAAAlwSFlzAAAPYQAAD2EBqD+naQABAABJREFUeJzs3Xd8VfX9x/HXuTN7byAkzLA3CCgCouIeOLBuba27Wmtb29qfo62t1tatVXHiFhFFBRXZe2/CDIHskD1u7jq/P77n3puQBBISCMjn+XjkkeTec8899ya5Sb6f8/m8NV3XdYQQQgghhBBCCCGEEEIIIU5Dpo4+ACGEEEIIIYQQQgghhBBCiI4ihRIhhBBCCCGEEEIIIYQQQpy2pFAihBBCCCGEEEIIIYQQQojTlhRKhBBCCCGEEEIIIYQQQghx2pJCiRBCCCGEEEIIIYQQQgghTltSKBFCCCGEEEIIIYQQQgghxGlLCiVCCCGEEEIIIYQQQgghhDhtWTr6ANqD1+slNzeX8PBwNE3r6MMRQgghhBBCCCGEEEIIIUQH0nWdyspKUlJSMJmO3DPysyiU5Obm0qVLl44+DCGEEEIIIYQQQgghhBBCnEQOHDhA586dj7jNz6JQEh4eDqgHHBER0cFHI4QQQgghhBBCCCGEEEKIjlRRUUGXLl389YMj+VkUSnzjtiIiIqRQIoQQQgghhBBCCCGEEEIIgBbFdUiYuxBCCCGEEEIIIYQQQgghTltSKBFCCCGEEEIIIYQQQgghxGlLCiVCCCGEEEIIIYQQQgghhDht/SwySoQQQgghhBBCCCGEEEKI1vJ4PLhcro4+DHGMrFYrZrO5zfuRQokQQgghhBBCCCGEEEKI04qu6+Tn51NWVtbRhyLaKCoqiqSkpBaFtjdHCiVCCCGEEEIIIYQQQgghTiu+IklCQgIhISFtWmQXHUPXdWpqaigsLAQgOTn5mPclhRIhhBBCCCGEEEIIIYQQpw2Px+MvksTGxnb04Yg2CA4OBqCwsJCEhIRjHsMlYe5CC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vlwceeICxY8fSv3//JrcpLi7mySef5I477jjiviZPnsx7773HvHnz+Ne//sXChQu54IIL8Hg8TW7/1FNPERkZ6X/r0qXLsT4MIYQQQgjxM+EbvZUYYWdYajQAlZu+gcw5R7qZaKUap5vFu9QC8Pn9VEf4iDRVKFktge5UOlz8YcYmvt2cz2drD3T04XS4CoeLHfnqxLbhXaP9P5unehFzb5HRURIf5r+sd0II/bSswEYFW07wUQmAR77YzNh//kRptfOI2729NIvccvV7o7TmyNuKgB35lby9NAuvDmf2iOMfVwwAoNbV9PqNEEKIU9ctt9zC5Zdf7v98/PjxPPDAAyf8OBYsWICmaZSVlR3X+znmQsk999zDli1b+Pjjj5u8vqKigosuuoi+ffvy2GOPHXFfU6dO5dJLL2XAgAFcfvnlzJ49m9WrV7NgwYImt3/kkUcoLy/3vx04IP+ACCGEEEKczhwuD5UONwDx4UEM6xpNGDVcu/cR+OR6qJFOh/ayMLOIOreX1JgQMowxW4NTozCbNHLKasmtF9p9OvpgZbb/e3F+ZmEHH03HW7e/FF2HrrEhJEQEMbRrtHF5WcceWBvoul4voyTQUdLfXkioVu+seimUnHAFFQ4+Xp1NTlntEbuWSLine truncated
"text/plain": [ "text/plain": [
"<Figure size 2000x500 with 1 Axes>" "<Figure size 2000x500 with 1 Axes>"
], ]
"image/png": "iVBORw0KGgoAAAANSUhEUgAABkoAAAGsCAYAAACSD/sZAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjAsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvlHJYcgAAAAlwSFlzAAAPYQAAD2EBqD+naQABAABJREFUeJzs3Xd8VfX9x/HXuTN7byAkzLA3CCgCouIeOLBuba27Wmtb29qfo62t1tatVXHiFhFFBRXZe2/CDIHskD1u7jq/P77n3puQBBISCMjn+XjkkeTec8899ya5Sb6f8/m8NV3XdYQQQgghhBBCCCGEEEIIIU5Dpo4+ACGEEEIIIYQQQgghhBBCiI4ihRIhhBBCCCGEEE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m9WrV7NgwYImt3/kkUcoLy/3vx04IP+ACCGEEEKczhwuD5UONwDx4UEM6xpNGDVcu/cR+OR6qJFOh/ayMLOIOreX1JgQMowxW4NTozCbNHLKasmtF9p9OvpgZbb/e3F+ZmEHH03HW7e/FF2HrrEhJEQEMbRrtHF5WcceWBvoul4voyTQUdLfXkioVu+seimUnHAFFQ4+Xp1NTlntEbuWSLine truncated
}, },
"metadata": {} "metadata": {},
"output_type": "display_data"
} }
], ],
"source": [ "source": [
@@ -2073,9 +2073,10 @@
} }
], ],
"metadata": { "metadata": {
"accelerator": "GPU",
"colab": { "colab": {
"provenance": [], "gpuType": "T4",
"gpuType": "T4" "provenance": []
}, },
"kernelspec": { "kernelspec": {
"display_name": "Python 3", "display_name": "Python 3",
@@ -2092,8 +2093,7 @@
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.9.18" "version": "3.9.18"
}, }
"accelerator": "GPU"
}, },
"nbformat": 4, "nbformat": 4,
"nbformat_minor": 0 "nbformat_minor": 0
-71
View File
@@ -1,71 +0,0 @@
# import pandas as pd
from data_loader import load_weather_data
from preprocessing import scale_data, create_sequences, inverse_scale
from model_train import (
train_linear_regression_gd,
predict_linear_regression,
evaluate_model,
)
from visualize import (
plot_original_vs_scaled,
plot_predictions,
plot_residuals,
plot_error_hist,
plot_scatter,
plot_loss_curve,
plot_value_distribution,
visualize_sequence_window,
)
from sklearn.model_selection import train_test_split
# Step 1: Load data
data = load_weather_data("hanoi_weather_data.csv")
plot_value_distribution(data)
# Step 2: Preprocess (scale and sequence)
scaled_data, scaler = scale_data(data)
plot_original_vs_scaled(data, scaled_data)
seq_length = 50
X, y = create_sequences(scaled_data, seq_length)
visualize_sequence_window(data["QV2M"], seq_length=10, start_idx=1000)
# Step 3: Train/test split
date_index = data.index[seq_length:]
X_train, X_test, y_train, y_test = train_test_split(
X, y.reshape(-1), test_size=0.02, shuffle=False
)
date_train, date_test = train_test_split(date_index, test_size=0.02, shuffle=False)
# Step 4: Train model with gradient descent
# import math
# lr_schedule = lambda epoch: max(0.005, 0.01 * (1 + math.cos(epoch / 1000 * math.pi)) / 2)
theta, losses = train_linear_regression_gd(
X_train,
y_train,
# lr_schedule=lr_schedule,
n_epochs=10000,
)
predictions = predict_linear_regression(X_test, theta)
# Step 5: Evaluate
mse, r2 = evaluate_model(y_test, predictions)
print(f"MSE: {mse:.4f}, R2: {r2:.4f}")
# Step 6: Rescale predictions
y_test_rescaled = inverse_scale(y_test, scaler, data.shape[1])
predictions_rescaled = inverse_scale(predictions, scaler, data.shape[1])
# Step 7: Visualize
residuals = y_test - predictions
errors = abs(residuals)
plot_predictions(date_test, y_test_rescaled, predictions_rescaled)
plot_residuals(date_test.to_numpy(), residuals)
plot_error_hist(errors)
plot_scatter(y_test.reshape(-1, 1), predictions.reshape(-1, 1))
plot_loss_curve(losses)
-45
View File
@@ -1,45 +0,0 @@
import numpy as np
from sklearn.metrics import mean_squared_error, r2_score
def train_linear_regression_gd(X_train, y_train, lr_schedule= lambda _e: 0.01, n_epochs=1000):
"""
Train linear regression model using batch gradient descent.
Returns:
theta: learned weights
losses: list of MSE loss per epoch
"""
m, n = X_train.shape
X_b = np.hstack([np.ones((m, 1)), X_train])
theta = np.zeros(n + 1)
losses = []
for epoch in range(n_epochs):
lr = lr_schedule(epoch)
predictions = X_b @ theta
errors = predictions - y_train
gradients = (2 / m) * X_b.T @ errors
gradients = np.clip(gradients, -1, 1) # gradient clipping
theta -= lr * gradients
loss = np.mean(errors ** 2)
losses.append(loss)
if epoch % 1000 == 0:
print(f"Epoch {epoch}: Loss = {loss:.6f}, LR: {lr:.6f}")
print(f"Final Loss: {losses[-1]:.6f}")
return theta, losses
def predict_linear_regression(X, theta):
"""Predict using learned linear model."""
X_b = np.hstack([np.ones((X.shape[0], 1)), X])
return X_b @ theta
def evaluate_model(y_true, y_pred):
"""Evaluate using sklearn's built-in MSE and R² functions."""
mse = mean_squared_error(y_true, y_pred)
r2 = r2_score(y_true, y_pred)
return mse, r2
-26
View File
@@ -1,26 +0,0 @@
import numpy as np
from sklearn.preprocessing import MinMaxScaler
from sklearn.model_selection import train_test_split
def scale_data(data):
"""Normalize the data using MinMaxScaler."""
scaler = MinMaxScaler()
scaled_data = scaler.fit_transform(data)
return scaled_data, scaler
def inverse_scale(scaled, scaler, n_features):
"""Inverse transform using stored scaler."""
return scaler.inverse_transform(scaled.reshape(-1, n_features))
def create_sequences(data, seq_length):
"""Transform the time series into overlapping sequences."""
xs, ys = [], []
for i in range(len(data) - seq_length):
x = data[i : i + seq_length].flatten()
y = data[i + seq_length]
xs.append(x)
ys.append(y)
return np.array(xs), np.array(ys)
+35 -15
View File
@@ -1,3 +1,5 @@
import os
from sklearn.model_selection import train_test_split from sklearn.model_selection import train_test_split
import torch import torch
@@ -20,23 +22,22 @@ scaled_data = scaler.fit_transform(a)
def create_sequences(data, seq_length): def create_sequences(data, seq_length):
"see this? return[0] is the big x and return[1] is the big y. and h(x) = y. and h(x) is the model." "see this? return[0] is the big x and return[1] is the big y. and h(x) = y. and h(x) is the model."
xs = [] xs, ys, dates = [], [], []
ys = []
for i in range(len(data) - seq_length): for i in range(len(data) - seq_length):
x = data[i : (i + seq_length)] xs.append(data[i : i + seq_length])
y = data[i + seq_length] ys.append(data[i + seq_length])
xs.append(x) dates.append(i + seq_length) # index of target
ys.append(y) return np.array(xs), np.array(ys), np.array(dates)
return np.array(xs), np.array(ys)
seq_length = 20 seq_length = 20
X, y = create_sequences(scaled_data, seq_length) X, y, y_indices = create_sequences(scaled_data, seq_length)
X_train, X_test, y_train, y_test = train_test_split( X_train, X_test, y_train, y_test = train_test_split(
X, y, test_size=0.2, random_state=42 X, y, test_size=0.2, random_state=42
) )
from torch.utils.data import TensorDataset, DataLoader from torch.utils.data import TensorDataset, DataLoader
X_train_tensor = torch.tensor(X_train, dtype=torch.float32) X_train_tensor = torch.tensor(X_train, dtype=torch.float32)
@@ -66,21 +67,28 @@ class LSTMModel(nn.Module):
return out return out
model = LSTMModel( modfile = "data/model.pth"
yesmod = os.path.isfile(modfile)
if yesmod:
model = torch.load(modfile)
else:
model = LSTMModel(
input_size=X_train.shape[2], input_size=X_train.shape[2],
hidden_size=64, hidden_size=64,
num_layers=2, num_layers=2,
output_size=y_train.shape[1], output_size=y_train.shape[1],
) )
model.to(device) model.to(device)
criterion = nn.MSELoss()
optimizer = torch.optim.Adam(model.parameters(), lr=0.001)
train_losses = [] train_losses = []
val_losses = [] val_losses = []
criterion = nn.MSELoss()
optimizer = torch.optim.Adam(model.parameters(), lr=0.001)
for epoch in range(100): if not yesmod:
for epoch in range(100):
model.train() model.train()
running_train_loss = 0.0 running_train_loss = 0.0
@@ -103,6 +111,9 @@ for epoch in range(100):
epoch_train_loss = running_train_loss / len(train_loader.dataset) epoch_train_loss = running_train_loss / len(train_loader.dataset)
train_losses.append(epoch_train_loss) train_losses.append(epoch_train_loss)
torch.save(model, modfile)
# yesmod = True
model.eval() model.eval()
X_test_tensor = torch.tensor(X_test, dtype=torch.float32).to(device) X_test_tensor = torch.tensor(X_test, dtype=torch.float32).to(device)
@@ -152,8 +163,17 @@ ax1.legend()
ax1.grid(True) ax1.grid(True)
# Prediction vs Actual on the right # Prediction vs Actual on the right
ax2.plot(y_test_rescaled, label="Actual")
ax2.plot(predictions_rescaled, label="Predicted") # 2024 - 25
_, X_test_idx, _, y_test_idx = train_test_split(
X, y_indices, test_size=0.2, random_state=42
)
dates_test = a["Date"].iloc[y_test_idx].values # Actual datetime values
mask = (dates_test >= "2024-01-01") & (dates_test <= "2025-12-31")
# Plot the results
ax2.plot(dates_test[mask], y_test_rescaled[mask], label="Actual")
ax2.plot(dates_test[mask], predictions_rescaled[mask], label="Predicted")
ax2.set_title("Actual vs. Predicted") ax2.set_title("Actual vs. Predicted")
ax2.set_xlabel("Sample") ax2.set_xlabel("Sample")
ax2.set_ylabel("Value") ax2.set_ylabel("Value")
File diff suppressed because it is too large. Load diff
-137
View File
@@ -1,137 +0,0 @@
import matplotlib.pyplot as plt
import numpy as np
def plot_predictions(date_test, y_test_rescaled, predictions_rescaled):
plt.figure(figsize=(12, 6))
plt.plot(date_test, y_test_rescaled[:, 0], label="Actual")
plt.plot(date_test, predictions_rescaled[:, 0], label="Predicted")
plt.title("Actual vs Predicted (First Feature)")
plt.xlabel("Date")
plt.ylabel("Value")
plt.xticks(rotation=45)
plt.legend()
plt.tight_layout()
plt.grid(True)
plt.show()
def plot_residuals(date_test, residuals):
plt.figure(figsize=(10, 4))
plt.plot(date_test, residuals, label="Residuals")
plt.hlines(0, 0, len(residuals), colors="red")
plt.xlim(date_test.min(), date_test.max())
plt.title("Residuals Over Time")
plt.xlabel("Date")
plt.ylabel("Error")
plt.xticks(rotation=45)
plt.grid(True)
plt.tight_layout()
plt.legend()
plt.show()
def plot_error_hist(errors):
plt.hist(errors, bins=50)
plt.title("Error Distribution")
plt.xlabel("Absolute Error")
plt.ylabel("Frequency")
plt.grid(True)
plt.show()
def plot_scatter(y_test, predictions):
plt.scatter(y_test[:, 0], predictions[:, 0], alpha=0.5)
plt.plot([0, 1], [0, 1], "r--")
plt.title("Predicted vs Actual (Normalized)")
plt.xlabel("Actual")
plt.ylabel("Predicted")
plt.grid(True)
plt.show()
def plot_loss_curve(losses):
plt.plot(losses)
plt.title("Training Loss Curve")
plt.xlabel("Epoch")
plt.ylabel("MSE Loss")
plt.grid(True)
plt.tight_layout()
plt.show()
def plot_original_vs_scaled(original_data, scaled_data, feature_names=None):
"""
Plot original and scaled data, aligned by date.
"""
if feature_names is None:
feature_names = original_data.columns[:2]
dates = original_data.index # Grab the datetime index
fig, axs = plt.subplots(2, 1, figsize=(12, 6), sharex=True)
for col in feature_names:
axs[0].plot(dates, original_data[col], label=f"Original {col}")
axs[0].set_title("Original Data")
axs[0].legend()
axs[0].grid(True)
for i, col in enumerate(feature_names):
col_index = original_data.columns.get_loc(col)
axs[1].plot(dates, scaled_data[:, col_index], label=f"Scaled {col}")
axs[1].set_title("Scaled Data (MinMaxScaler)")
axs[1].legend()
axs[1].grid(True)
plt.xlabel("Date")
plt.tight_layout()
plt.show()
def plot_value_distribution(data):
# import matplotlib.pyplot as plt
plt.figure(figsize=(8, 4))
plt.hist(data.iloc[:, 0], bins=40, color="skyblue", edgecolor="black")
plt.title("Distribution of Values")
plt.xlabel(data.columns[0])
plt.ylabel("Frequency")
plt.grid(True)
plt.tight_layout()
plt.show()
def visualize_sequence_window(series, seq_length=5, start_idx=0):
"""
Visualize how a sequence window is used to create X (input) and y (target).
Parameters:
series (pd.Series or np.ndarray): 1D time series data
seq_length (int): Length of input window
start_idx (int): Where to start slicing from for demo
"""
if isinstance(series, np.ndarray):
data = series
else:
data = series.to_numpy()
x_seq = data[start_idx:start_idx + seq_length]
y_val = data[start_idx + seq_length]
full_seq = np.concatenate([x_seq, [y_val]])
plt.figure(figsize=(8, 3))
plt.plot(range(start_idx, start_idx + seq_length + 1), full_seq, marker='o')
plt.axvline(x=start_idx + seq_length - 0.5, linestyle="--", color="gray")
for i in range(seq_length):
plt.text(start_idx + i, x_seq[i], f"x[{i}]", ha="center", va="bottom", fontsize=9)
plt.text(start_idx + seq_length, y_val, "y", ha="center", va="bottom", color="red", fontsize=9)
plt.title(f"Sequence Window (seq_length={seq_length}) → Predict Next")
plt.xlabel("Time Step")
plt.ylabel("Value")
plt.grid(True)
plt.tight_layout()
plt.show()