2022-01-04 11:44:35 +01:00
|
|
|
from __future__ import annotations
|
2021-12-21 15:57:08 +01:00
|
|
|
from models.base import Model
|
|
|
|
|
import numpy as np
|
|
|
|
|
|
|
|
|
|
class StaticNaiveModel(Model):
|
|
|
|
|
'''
|
|
|
|
|
Model that carries the last observation (from returns) to the next one, naively.
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
data_scaling = 'unscaled'
|
|
|
|
|
only_column = None
|
2021-12-27 21:59:22 +01:00
|
|
|
feature_selection = 'off'
|
|
|
|
|
model_type = 'static'
|
2022-01-04 11:44:35 +01:00
|
|
|
predict_window_size = 'single_timestamp'
|
2021-12-21 15:57:08 +01:00
|
|
|
|
2022-01-04 11:44:35 +01:00
|
|
|
def fit(self, X: np.ndarray, y: np.ndarray) -> None:
|
2021-12-21 15:57:08 +01:00
|
|
|
# This is a static model, it can' learn anything
|
|
|
|
|
pass
|
|
|
|
|
|
2022-01-04 11:44:35 +01:00
|
|
|
def predict(self, X) -> tuple[float, np.ndarray]:
|
|
|
|
|
return (X[-1][0], np.array([]))
|
2021-12-21 15:57:08 +01:00
|
|
|
|
2022-01-04 11:44:35 +01:00
|
|
|
def clone(self) -> StaticNaiveModel:
|
|
|
|
|
return self
|
|
|
|
|
|
|
|
|
|
def get_name(self) -> str:
|
2022-01-05 12:25:03 +01:00
|
|
|
return 'static_naive'
|
|
|
|
|
|
|
|
|
|
def initialize_network(self, input_dim:int, output_dim:int):
|
|
|
|
|
pass
|