mirror of
https://github.com/webclinic017/drift.git
synced 2026-07-28 03:08:01 +00:00
3084f5e271
* refr: Took out main primary and secondary loops and data processing. * feat: Tidied the code up. * feat: Saving models and results now works in a type safe way. * fix: There was error in the saving function. * chore: Took out some remaining comments. * fix: Fixed the previous data checking process. * feat: Fixed model selection method. I will continue the inference after we merged. Co-authored-by: Daniel Szemerey <szemereydaniel@gmail.com>
40 lines
971 B
Python
40 lines
971 B
Python
from __future__ import annotations
|
|
from typing import Literal, Optional, Union
|
|
from abc import ABC, abstractmethod
|
|
import numpy as np
|
|
|
|
# import numpy as np
|
|
|
|
class Model(ABC):
|
|
|
|
data_scaling: Literal["scaled", "unscaled"]
|
|
feature_selection: Literal["on", "off"]
|
|
# data_format: Literal["wide", "narrow"]
|
|
only_column: Optional[str]
|
|
model_type: Literal['ml', 'static']
|
|
predict_window_size: Literal['single_timestamp', 'window_size']
|
|
|
|
@abstractmethod
|
|
def fit(self, X: np.ndarray, y: np.ndarray) -> None:
|
|
raise NotImplementedError
|
|
|
|
@abstractmethod
|
|
def predict(self, X: np.ndarray) -> tuple[float, np.ndarray]:
|
|
raise NotImplementedError
|
|
|
|
@abstractmethod
|
|
def clone(self) -> Model:
|
|
raise NotImplementedError
|
|
|
|
@abstractmethod
|
|
def get_name(self) -> str:
|
|
raise NotImplementedError
|
|
|
|
@abstractmethod
|
|
def initialize_network(self, input_dim:int, output_dim:int):
|
|
pass
|
|
|
|
|
|
|
|
|