mirror of
https://github.com/webclinic017/drift.git
synced 2026-07-27 18:57:55 +00:00
1856fcad22
* 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
33 lines
870 B
Python
33 lines
870 B
Python
from __future__ import annotations
|
|
from models.base import Model
|
|
import numpy as np
|
|
|
|
class StaticAverageModel(Model):
|
|
'''
|
|
Model that averages .
|
|
'''
|
|
|
|
data_transformation = 'original'
|
|
only_column = 'model_'
|
|
feature_selection = 'off'
|
|
model_type = 'static'
|
|
predict_window_size = 'single_timestamp'
|
|
|
|
def fit(self, X: np.ndarray, y: np.ndarray) -> None:
|
|
# This is a static model, it can' learn anything
|
|
pass
|
|
|
|
def predict(self, X) -> tuple[float, np.ndarray]:
|
|
# Make sure there's data to average
|
|
assert X.shape[1] > 0
|
|
prediction = np.average(X[-1])
|
|
return (prediction, np.array([]))
|
|
|
|
def clone(self) -> StaticAverageModel:
|
|
return self
|
|
|
|
def get_name(self) -> str:
|
|
return 'static_average'
|
|
|
|
def initialize_network(self, input_dim:int, output_dim:int):
|
|
pass |