mirror of
https://github.com/webclinic017/drift.git
synced 2026-08-08 00:27:50 +00:00
feat(Models): added MAE & RMSE metrics, fixed NaN & Inf values in data,
This commit is contained in:
@@ -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)
|
||||
@@ -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)
|
||||
Reference in New Issue
Block a user