leaspy.models.base
Classes
str(object='') -> str |
|
Base model class from which all |
Module Contents
- class InitializationMethod
-
str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.
- DEFAULT = 'default'
- RANDOM = 'random'
- class BaseModel(name, **kwargs)
Bases:
abc.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:
- Parameters:
name (str)
- name
- property features: list[leaspy.utils.typing.FeatureType] | None
- Return type:
Optional[list[leaspy.utils.typing.FeatureType]]
- 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.
- Return type:
Optional[int]
- initialize(dataset=None, method=None)
Initialize the model given a
Datasetand an initialization method.After calling this method
is_initializedshould beTrueand model should be ready for use.- Parameters:
- dataset
Dataset, optional The dataset we want to initialize from.
- methodInitializationMethod, optional
A custom method to initialize the model
- dataset
- Parameters:
dataset (Optional[Dataset])
method (Optional[InitializationMethod])
- Return type:
None