leaspy.models.BaseModel
- class BaseModel(name: str, **kwargs)
Bases:
ABCBase model class from which all
Leaspymodels 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
Datasetand an initialization method.save(path, **kwargs)Save
Leaspyobject as json model parameter file.validate_compatibility_of_dataset(dataset)Raise if the given
Datasetis 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
Datasetand an initialization method.After calling this method
is_initializedshould beTrueand model should be ready for use.
- abstract save(path: str, **kwargs) None
Save
Leaspyobject as json model parameter file.- Parameters:
- path
str Path to store the model’s parameters.
- **kwargs
Additional parameters for writing.
- path