feat(Project): use SKLearn models directly, removed custom ensembling, use 5 minute data, batch inference, numba cusum filter (#192)

* feat(Project): use 5 minute data, running training in parallel, sped up cusum filter by 10x with numba

* fix(WalkForward): inference mini-batch parallelization

* fix(WalkForward): don't use the parallel version of any of the functions

* feat(CI): download the data required

* fix(Project): 5min_crypto folder added

* fix(Evaluate): make sure we have numerical stability in returns

* feat(Models): use SKLearn models directly to enable composability

* feat(Inference): batched inference now working, added forecasting_horizon

* fix(Inference): works again

* fix(Inference)

* chore(Models): remove unused Ensemble model

* fix(Labeller): don't just forward shift returns, also take the sum of the data happened until then

* Update test.yml
This commit is contained in:
Mark Aron Szulyovszky
2022-02-17 16:36:35 +01:00
committed by GitHub
parent 5c94af8b01
commit 9d47ee942d
52 changed files with 470 additions and 628 deletions
+3 -12
View File
@@ -14,7 +14,7 @@ cache = Cache(".cachedir/data")
def load_data(**kwargs) -> tuple[XDataFrame, ReturnSeries, ForwardReturnSeries]:
def load_data(**kwargs) -> tuple[XDataFrame, ReturnSeries]:
hashed = hash_data_config(kwargs)
if hashed in cache:
return cache.get(hashed)
@@ -31,7 +31,7 @@ def __load_data(assets: DataCollection,
own_features: list[tuple[str, FeatureExtractor, list[int]]],
other_features: list[tuple[str, FeatureExtractor, list[int]]],
exogenous_features: list[tuple[str, FeatureExtractor, list[int]]],
) -> tuple[XDataFrame, ReturnSeries, ForwardReturnSeries]:
) -> tuple[XDataFrame, ReturnSeries]:
"""
Loads asset data from the specified path.
Returns:
@@ -85,12 +85,8 @@ def __load_data(assets: DataCollection,
## Create target
returns = df_target_asset_only_returns[target_asset[1] + '_returns']
returns.index = pd.DatetimeIndex(X.index)
forward_returns = __create_target_cum_forward_returns(returns, 1)
forward_returns.index = pd.DatetimeIndex(X.index)
# we need to null out the last forward returns row, because when doing forward-shifting, we automatically get the first row, which is definitely incorrect
forward_returns[forward_returns.index[-1]] = 0.
return X, returns, forward_returns
return X, returns
@ray.remote
@@ -130,11 +126,6 @@ def __apply_feature_extractors(df: pd.DataFrame, feature_extractors: list[tuple[
return df
def __create_target_cum_forward_returns(series: pd.Series, period: int) -> pd.Series:
assert period > 0
return series.shift(-period).copy()
def load_only_returns(assets: DataCollection, returns: Literal['price', 'returns']) -> pd.DataFrame:
assets_future = [__load_df.remote(