mirror of
https://github.com/webclinic017/drift.git
synced 2026-08-18 05:18:09 +00:00
feat(Transformations): added Transformations abstraction & handling in walk_forward_train() & inference() (#161)
* feat(Transformations): added Transformations abstraction & handling in walk_forward_train() & inference() * fix(WalkForward): use Dataframes to call Transformation.fit_transform() * feat(WalkForward): restored option for models to recieve unscaled data * fix(Transformations): output DataFrame as expected * fix(Tests): missing new property
This commit is contained in:
@@ -4,7 +4,6 @@ import pandas as pd
|
||||
from training.walk_forward import walk_forward_train, walk_forward_inference
|
||||
from models.base import Model
|
||||
from utils.evaluate import evaluate_predictions
|
||||
from sklearn.preprocessing import MinMaxScaler
|
||||
|
||||
no_of_rows = 100
|
||||
|
||||
@@ -36,7 +35,7 @@ class EvenOddStubModel(Model):
|
||||
It verifies that the X[n][any_column] == 1 if n is even,
|
||||
'''
|
||||
|
||||
data_scaling = "unscaled"
|
||||
data_transformation = "original"
|
||||
only_column = None
|
||||
predict_window_size = 'single_timestamp'
|
||||
|
||||
@@ -68,9 +67,8 @@ def test_evaluation():
|
||||
window_length = 10
|
||||
|
||||
model = EvenOddStubModel(window_length = window_length)
|
||||
scaler = MinMaxScaler()
|
||||
|
||||
models, scalers = walk_forward_train(
|
||||
model_over_time, transformations_over_time = walk_forward_train(
|
||||
model_name='test',
|
||||
model=model,
|
||||
X=X,
|
||||
@@ -79,11 +77,11 @@ def test_evaluation():
|
||||
expanding_window=False,
|
||||
window_size=window_length,
|
||||
retrain_every=10,
|
||||
scaler=scaler)
|
||||
predictions, probs = walk_forward_inference(
|
||||
transformations=[])
|
||||
predictions, _ = walk_forward_inference(
|
||||
model_name='test',
|
||||
models=models,
|
||||
scalers=scalers,
|
||||
model_over_time=model_over_time,
|
||||
transformations_over_time=transformations_over_time,
|
||||
X=X,
|
||||
expanding_window=False,
|
||||
window_size=window_length
|
||||
|
||||
Reference in New Issue
Block a user