"""Base Model abstract class."""
from abc import ABCMeta, abstractmethod
from typing import Any, Final
from DashAI.back.config_object import ConfigObject
[docs]class BaseModel(ConfigObject, metaclass=ABCMeta):
"""Abstract class of all machine learning models.
All models must extend this class and implement save and load methods.
"""
TYPE: Final[str] = "Model"
@abstractmethod
def save(self, filename: str) -> None:
"""Store an instance of a model.
filename (Str): Indicates where to store the model,
if filename is None, this method returns a bytes array with the model.
"""
raise NotImplementedError
@abstractmethod
def load(self, filename: str) -> Any:
"""Restores an instance of a model.
filename (Str): Indicates where the model was stored.
"""
raise NotImplementedError