easypheno.model._param_free_base_model
Module Contents
Classes
BaseModel parent class for all models that do not have hyperparameters, e.g. BLUP. |
- class easypheno.model._param_free_base_model.ParamFreeBaseModel(task, encoding=None)[source]
Bases:
abc.ABC
BaseModel parent class for all models that do not have hyperparameters, e.g. BLUP.
Every model must be based on
ParamFreeBaseModel
directly or ParamFreeBaseModel’s child classes.Please add
super().__init__(PARAMS)
to the constructor in case you override it in a child classAttributes
Class attributes
standard_encoding (str): the standard encoding for this model
possible_encodings (List<str>): a list of all encodings that are possible according to the model definition
Instance attributes
task (str): ML task (‘regression’ or ‘classification’) depending on target variable
encoding (str): the encoding to use (standard encoding or user-defined)
- Parameters
- property standard_encoding(cls)
the standard encoding for this model
- property possible_encodings(cls)
a list of all encodings that are possible according to the model definition
- abstract fit(self, X, y)[source]
Method that fits the model based on features X and targets y
- Parameters
X (numpy.array) – feature matrix for retraining
y (numpy.array) – target vector
- Returns
numpy array with values predicted for X
- Return type
numpy.array
- abstract predict(self, X_in)[source]
Method that predicts target values based on the input X_in
- Parameters
X_in (numpy.array) – feature matrix as input
- Returns
numpy array with the predicted values
- Return type
numpy.array
- save_model(self, path, filename)[source]
Persist the whole model object on a hard drive (can be loaded with
load_model
)- Parameters
path (pathlib.Path) – path where the model will be saved
filename (str) – filename of the model