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
+2
View File
@@ -47,6 +47,7 @@ def __load_df(path: str, prefix: str, add_features: bool, log_returns: bool) ->
df['mom_60'] = df['close'].pct_change(60)
df['mom_90'] = df['close'].pct_change(90)
df = df.replace([np.inf, -np.inf], 0.)
df = df.drop(columns=['open', 'high', 'low', 'close'])
df.columns = [prefix + "_" + c for c in df.columns]
return df
@@ -54,4 +55,5 @@ def __load_df(path: str, prefix: str, add_features: bool, log_returns: bool) ->
# %%
def create_target_cum_forward_returns(df: pd.DataFrame, source_column: str, period: int) -> pd.DataFrame:
df['target'] = df[source_column].diff(period).shift(-period)
df = df.iloc[:-period]
return df