mirror of
https://github.com/webclinic017/drift.git
synced 2026-08-16 20:38:07 +00:00
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
This commit is contained in:
@@ -42,13 +42,13 @@ class EvenOddStubModel(Model):
|
||||
super().__init__()
|
||||
self.window_length = window_length
|
||||
|
||||
def fit(self, X, y, prev_model):
|
||||
def fit(self, X, y):
|
||||
assert len(X) == self.window_length
|
||||
for i in range(len(X)):
|
||||
assert y[i] == -1 if X[i][0] == 1 else 1
|
||||
|
||||
def predict(self, X):
|
||||
return np.array([-1 if X[0][0] == 1 else 1])
|
||||
return (-1 if X[0][0] == 1 else 1, np.array([]))
|
||||
|
||||
def clone(self):
|
||||
return self
|
||||
@@ -62,7 +62,7 @@ def test_evaluation():
|
||||
model = EvenOddStubModel(window_length = window_length)
|
||||
scaler = None
|
||||
|
||||
models, predictions = walk_forward_train_test(
|
||||
models, predictions, probs = walk_forward_train_test(
|
||||
model_name='test',
|
||||
model=model,
|
||||
X=X,
|
||||
|
||||
Reference in New Issue
Block a user