mirror of
https://github.com/webclinic017/drift.git
synced 2026-07-28 11:17:47 +00:00
b6cd6b14fe
* feat(Config): feature extractors are enabled one-by-one with a bool, added previous model to model.fit() * fix(Sweep): removed unused `other_features` parameter that fails sweep * feat(Config): using preset names for defining feature extractors again * fix(Tests): fixed model stub classes
42 lines
874 B
Python
42 lines
874 B
Python
|
|
from typing import Literal, Optional
|
|
from sklearn.base import clone
|
|
from abc import ABC, abstractmethod, abstractproperty
|
|
|
|
class Model(ABC):
|
|
|
|
# data_format: Literal['dataframe', 'numpy']
|
|
data_scaling: Literal["scaled", "unscaled"]
|
|
# data_format: Literal["wide", "narrow"]
|
|
only_column: Optional[str]
|
|
|
|
@abstractmethod
|
|
def fit(self, X, y, prev_model):
|
|
pass
|
|
|
|
@abstractmethod
|
|
def predict(self, X):
|
|
pass
|
|
|
|
@abstractmethod
|
|
def clone(self):
|
|
pass
|
|
|
|
|
|
class SKLearnModel(Model):
|
|
|
|
# data_format = 'numpy'
|
|
data_scaling = 'scaled'
|
|
only_column = None
|
|
|
|
def __init__(self, model):
|
|
self.model = model
|
|
|
|
def fit(self, X, y, prev_model):
|
|
self.model.fit(X, y)
|
|
|
|
def predict(self, X):
|
|
return self.model.predict(X)
|
|
|
|
def clone(self):
|
|
return SKLearnModel(clone(self.model)) |