Files
drift/exploration.ipynb
T
Mark Aron SzulyovszkyandGitHub 1cd0119589 feat(DataLoader): caching MVP, added ability to use standard scaling for exogenous data, scaling is now also done before feature selection (#105)
* fix(FeatureExtractor): apply log to transform some series to normality

* feat(DataLoader): add ability of not returning returns when they're not needed (exogenous data), applied log to certain features

* feat(FeatureExtractors): added standard scaling for exogenous data

* feat(FeatureSelection): scale data with the passed in scaler before doing feature-selection

* fix(Config): sweep config

* feat(Models): output probability, store it

* feat(Core): added caching to select_features() and load_data()

* fix(Dependencies): added diskcache

* fix(Training): error when creating results DF

* feat(Models): added xgboost, fixed tests

* refactor(Cache): moved hashing to a separate function, created wrapper functions to separate business logic and caching

* fix(Tests): new syntax

* fix(Model): XGboost can't handle -1 class, so we'll use the deprecated label_encoder fornow

* fix(Model): XGBoost config

* feat(Cache): add run_clear_cache script

* fix(Pipeline) accidentally re-instatiating all_predictions for each asset
2022-01-04 11:44:35 +01:00

44 KiB

In [1]:
import pandas as pd
import pandas_ta as ta
from config.config import get_default_level_2_daily_config
from config.preprocess import preprocess_config
from data_loader.load_data import load_data
import seaborn as sns
import numpy as np

model_config, training_config, data_config = get_default_level_2_daily_config()
model_config, training_config, data_config = preprocess_config(model_config, training_config, data_config)

data_config['target_asset'] = data_config['assets'][0]
X, y, target_returns = load_data(**data_config)
(__load_df pid=52067) /usr/local/anaconda3/envs/quant/lib/python3.9/site-packages/pandas/core/arraylike.py:364: RuntimeWarning: divide by zero encountered in log
(__load_df pid=52067)   result = getattr(ufunc, method)(*inputs, **kwargs)
(__load_df pid=52074) /usr/local/anaconda3/envs/quant/lib/python3.9/site-packages/pandas/core/arraylike.py:364: RuntimeWarning: divide by zero encountered in log
(__load_df pid=52074)   result = getattr(ufunc, method)(*inputs, **kwargs)
(__load_df pid=52071) /usr/local/anaconda3/envs/quant/lib/python3.9/site-packages/pandas/core/arraylike.py:364: RuntimeWarning: divide by zero encountered in log
(__load_df pid=52071)   result = getattr(ufunc, method)(*inputs, **kwargs)
(__load_df pid=52072) /usr/local/anaconda3/envs/quant/lib/python3.9/site-packages/pandas/core/arraylike.py:364: RuntimeWarning: divide by zero encountered in log
(__load_df pid=52072)   result = getattr(ufunc, method)(*inputs, **kwargs)
(__load_df pid=52069) /usr/local/anaconda3/envs/quant/lib/python3.9/site-packages/pandas/core/arraylike.py:364: RuntimeWarning: divide by zero encountered in log
(__load_df pid=52069)   result = getattr(ufunc, method)(*inputs, **kwargs)
In [3]:
X.columns
Out [3]:
Index(['ADA_USD_returns', 'ADA_USD_mom_10', 'ADA_USD_mom_20', 'ADA_USD_mom_30',
       'ADA_USD_mom_60', 'ADA_USD_mom_90', 'ADA_USD_vol_10', 'ADA_USD_vol_20',
       'ADA_USD_vol_30', 'ADA_USD_vol_60',
       ...
       'msol_standard_scaling_0', 'dormancy_standard_scaling_0',
       'liveliness_standard_scaling_0',
       'relative_unrealized_profit_standard_scaling_0',
       'relative_unrealized_loss_standard_scaling_0',
       'nupl_standard_scaling_0', 'sth_nupl_standard_scaling_0',
       'lth_nupl_standard_scaling_0', 'ssr_standard_scaling_0',
       'bvin_standard_scaling_0'],
      dtype='object', length=542)
In [6]:
X['liveliness_standard_scaling_0'].plot()
Out [6]:
<AxesSubplot:>
In [7]:
X['BTC_USD_returns'].plot()
Out [7]:
<AxesSubplot:>
In [7]:
# pd.plotting.scatter_matrix(X, figsize=(12, 12));
In [ ]: