leaspy.models
.BaseModel
- class BaseModel(name: str, **kwargs)
Bases:
ABC
Base model class from which all
Leaspy
models should inherit.It defines the interface that a model should implement to be compatible with
Leaspy
.- Parameters:
- name
str
The name of the model.
- **kwargs
Hyperparameters of the model
- name
- Attributes:
Methods
initialize
(dataset[, method])Initialize the model given a
Dataset
and an initialization method.save
(path, **kwargs)Save
Leaspy
object as json model parameter file.validate_compatibility_of_dataset
(dataset)Raise if the given
Dataset
is not compatible with the current model.- property dimension: int | None
The dimension of the model. If the private attribute is defined, then it takes precedence over the feature length. The associated setters are responsible for their coherence.
- initialize(dataset: Dataset, method: str = 'default') None
Initialize the model given a
Dataset
and an initialization method.After calling this method
is_initialized
should beTrue
and model should be ready for use.
- abstract save(path: str, **kwargs) None
Save
Leaspy
object as json model parameter file.- Parameters:
- path
str
Path to store the model’s parameters.
- **kwargs
Additional parameters for writing.
- path