Source code for onetick.ml.interfaces.models
from abc import ABC, abstractmethod
from onetick.ml.utils.paramsaver import BaseParameterSaver
[docs]class BaseModel(ABC, BaseParameterSaver):
def __init__(self, *args, **kwargs):
self.model = None
self.sklearn_searcher = None
super().__init__(**kwargs)
def fit(self, *args, **kwargs):
pass
@abstractmethod
def init_model(self, dsf_params=None, init_params=None):
pass
@abstractmethod
def predict(self, *args, **kwargs):
pass
def save_model(self, *args, **kwargs):
pass
def load_model(self, *args, experiment=None, **kwargs):
pass
def get_mlflow_model(self):
return self.model
@property
def name(self):
return self.__class__.__name__
@property
def model_name(self):
return f'{self.name}'