Module panama.ml.tunable.base
Classes
class BaseTunableModel
-
A base class for tunable machine learning models.
This class defines a set of abstract methods that must be implemented by any concrete subclass.
Attributes
None.
Expand source code
class BaseTunableModel(ABC): """A base class for tunable machine learning models. This class defines a set of abstract methods that must be implemented by any concrete subclass. Attributes: None. """ @abstractmethod def fit(self, X: DataFrame, y: Union[DataFrame, Series]): """Fit the model to the training data. Args: X: The training data. y: The target values. Returns: None. """ raise NotImplementedError("Subclass must implement fit method.") @abstractmethod def predict(self, X: DataFrame): """Predict target values for the given data. Args: X: The input data. Returns: y_pred: The predicted target values. """ raise NotImplementedError("Subclass must implement predict method.") @abstractmethod def set_params(self, params: Dict): """Set the hyperparameters of the model. Args: params: hyperparameters and their values. Returns: None. """ raise NotImplementedError("Subclass must implement set_params method.") @abstractmethod def get_params(self, deep: bool): """Set the hyperparameters of the model. Args: params: hyperparameters and their values. Returns: None. """ raise NotImplementedError("Subclass must implement set_params method.") def get_name(self) -> str: """Returns the name of the model. Args: None. Returns: str: The name of the model. """ return self.name def get_default_search_space(self): sp = SearchSpace() sp.from_default(self) return sp def get_model(self): """Returns the name of the model. Args: None. Returns: str: The name of the model. """ return self.model
Ancestors
- abc.ABC
Subclasses
- BaseTunableForecaster
- TunableCatBoostRegressor
- TunableLGBMRegressor
- TunableRandomForestRegressor
- TunableSGDRegressor
- TunableXGBRegressor
Methods
def fit(self, X: pandas.core.frame.DataFrame, y: Union[pandas.core.frame.DataFrame, pandas.core.series.Series])
-
Fit the model to the training data.
Args
X
- The training data.
y
- The target values.
Returns
None.
def get_default_search_space(self)
def get_model(self)
-
Returns the name of the model.
Args
None.
Returns
str
- The name of the model.
def get_name(self) ‑> str
-
Returns the name of the model.
Args
None.
Returns
str
- The name of the model.
def get_params(self, deep: bool)
-
Set the hyperparameters of the model.
Args
params
- hyperparameters and their values.
Returns
None.
def predict(self, X: pandas.core.frame.DataFrame)
-
Predict target values for the given data.
Args
X
- The input data.
Returns
y_pred
- The predicted target values.
def set_params(self, params: Dict)
-
Set the hyperparameters of the model.
Args
params
- hyperparameters and their values.
Returns
None.