feat(Models): added MAE & RMSE metrics, fixed NaN & Inf values in data,

This commit is contained in:
Mark Aron Szulyovszky
2021-11-14 23:50:25 +01:00
parent 3581c8db83
commit 07302a7541
6 changed files with 51 additions and 225 deletions
+9
View File
@@ -0,0 +1,9 @@
from math import sqrt
from sklearn.metrics import mean_squared_error, mean_absolute_error
def print_metrics(y_true, y_pred):
rmse = sqrt(mean_squared_error(y_true, y_pred))
print("RMSE: %.2f" % rmse)
mae = mean_absolute_error(y_true, y_pred)
print("MAE: %.2f" % mae)
+6
View File
@@ -0,0 +1,6 @@
import numpy as np
def rolling_window(a, window):
shape = a.shape[:-1] + (a.shape[-1] - window + 1, window)
strides = a.strides + (a.strides[-1],)
return np.lib.stride_tricks.as_strided(a, shape=shape, strides=strides)