mirror of
https://github.com/webclinic017/drift.git
synced 2026-08-03 06:07:50 +00:00
feat(Data): added various data loading config options, walk forward method draft (#9)
* feat(Eval): added format_data_for_backtest() * feat(Data): added many configurable parameters to load_files to reduce boilerplate and prepare for HPO * feat(Core): added walk forward method of training/testing * fix(Model): remove the unnecessary softmax activation from the keras models * feat(Core): added walk_forward_train_test()
This commit is contained in:
committed by
GitHub
parent
d4676e099b
commit
7aedb91069
+12
-1
@@ -1,6 +1,8 @@
|
||||
from math import sqrt
|
||||
from sklearn.metrics import mean_squared_error, mean_absolute_error, accuracy_score
|
||||
from sklearn.metrics import confusion_matrix
|
||||
import pandas as pd
|
||||
|
||||
def print_regression_metrics(y_true, y_pred):
|
||||
rmse = sqrt(mean_squared_error(y_true, y_pred))
|
||||
print("RMSE: %.2f" % rmse)
|
||||
@@ -10,4 +12,13 @@ def print_regression_metrics(y_true, y_pred):
|
||||
|
||||
def print_classification_metrics(y_true, y_pred):
|
||||
print("Accuracy: %.2f" % accuracy_score(y_true, y_pred))
|
||||
print("Confusion Matrix: \n", confusion_matrix(y_true, y_pred))
|
||||
print("Confusion Matrix: \n", confusion_matrix(y_true, y_pred))
|
||||
|
||||
def format_data_for_backtest(aggregated_data: pd.DataFrame, returns_col: str, only_test_data: pd.DataFrame, preds) -> pd.DataFrame:
|
||||
backtest_data = aggregated_data.iloc[-only_test_data.shape[0]:].copy()[returns_col]
|
||||
assert backtest_data.shape[0] == only_test_data.shape[0]
|
||||
backtest_data = backtest_data.reset_index(drop=True)
|
||||
return pd.concat([backtest_data, pd.Series(preds)], axis='columns')
|
||||
|
||||
|
||||
# def backtest()
|
||||
Reference in New Issue
Block a user