simpleml.utils.training.create_persistable
Module with helper classes to create new persistables
Module Contents
Classes
Attributes
- class simpleml.utils.training.create_persistable.DatasetCreator[source]
Bases:
PersistableCreator
- classmethod create(cls, registered_name, **kwargs)[source]
Stateless method to create a new persistable with the desired parameters kwargs are passed directly to persistable
- Parameters
registered_name (str) – Class name registered in SimpleML
dataset_pipeline – dataset pipeline object
- Return type
- classmethod determine_filters(cls, strict=True, **kwargs)[source]
stateless method to determine which filters to apply when looking for existing persistable
Returns: database class, filter dictionary
- Parameters
registered_name – Class name registered in SimpleML
strict (bool) – whether to assume same class and name = same persistable,
- Return type
Tuple[simpleml.datasets.base_dataset.Dataset, Dict[str, Any]]
or, load the data and compare the hash
- class simpleml.utils.training.create_persistable.MetricCreator[source]
Bases:
PersistableCreator
- classmethod create(cls, registered_name, **kwargs)[source]
Stateless method to create a new persistable with the desired parameters kwargs are passed directly to persistable
- Parameters
registered_name (str) – Class name registered in SimpleML
model – model class
- Return type
- classmethod determine_filters(cls, strict=False, **kwargs)[source]
stateless method to determine which filters to apply when looking for existing persistable
Returns: database class, filter dictionary
- Parameters
registered_name – Class name registered in SimpleML
strict (bool) – whether to fit objects first before assuming they are identical
- Return type
Tuple[simpleml.metrics.base_metric.Metric, Dict[str, Any]]
In theory if all inputs and classes are the same, the outputs should deterministically be the same as well (up to random iter). So, you dont need to fit objects to be sure they are the same
- class simpleml.utils.training.create_persistable.ModelCreator[source]
Bases:
PersistableCreator
- classmethod create(cls, registered_name, **kwargs)[source]
Stateless method to create a new persistable with the desired parameters kwargs are passed directly to persistable
- Parameters
registered_name (str) – Class name registered in SimpleML
pipeline – pipeline object
- Return type
- classmethod determine_filters(cls, strict=False, **kwargs)[source]
stateless method to determine which filters to apply when looking for existing persistable
Returns: database class, filter dictionary
- Parameters
registered_name – Class name registered in SimpleML
strict (bool) – whether to fit objects first before assuming they are identical
- Return type
Tuple[simpleml.models.base_model.Model, Dict[str, Any]]
In theory if all inputs and classes are the same, the outputs should deterministically be the same as well (up to random iter). So, you dont need to fit objects to be sure they are the same
- class simpleml.utils.training.create_persistable.PersistableCreator[source]
Bases:
object
- abstract create(cls, **kwargs)[source]
method to create a new persistable with the desired parameters kwargs are passed directly to persistable
- abstract determine_filters(cls, strict=False, **kwargs)[source]
method to determine which filters to apply when looking for existing persistable
- Parameters
strict (bool) – whether to fit objects first before assuming they are identical
In theory if all inputs and classes are the same, the outputs should deterministically be the same as well (up to random iter). So, you dont need to fit objects to be sure they are the same
- Default design iterates through 2 (or 3) options when retrieving persistables:
By name and version (unique properties that define persistables)
2) By name, registered_name, and computed hash 2.5) Optionally, just use name and registered_name (assumes class
definition is the same and would result in an identical persistable)
Returns: database class, filter dictionary
- static retrieve(cls, filters)[source]
Query database using the table model (cls) and filters for a matching persistable
- Parameters
filters (Dict[str, Any]) –
- Return type
- classmethod retrieve_dataset(cls, dataset=None, dataset_id=None, dataset_kwargs=None, **kwargs)[source]
- Parameters
dataset (Optional[simpleml.datasets.base_dataset.Dataset]) –
dataset_id (str) –
dataset_kwargs (Optional[Dict[str, Any]]) –
- Return type
- static retrieve_dependency(dependency_cls, **dependency_kwargs)[source]
Base method to query for dependency Raises TrainingError if dependency does not exist
- Parameters
dependency_cls (PersistableCreator) –
- Return type
- static retrieve_from_registry(registered_name)[source]
stateless method to query registry for class definitions. handles errors
- Parameters
registered_name (str) –
- Return type
- classmethod retrieve_model(cls, model=None, model_id=None, model_kwargs=None, **kwargs)[source]
- Parameters
model (Optional[simpleml.models.base_model.Model]) –
model_id (str) –
model_kwargs (Optional[Dict[str, Any]]) –
- Return type
- classmethod retrieve_or_create(self, **kwargs)[source]
Wrapper method to first attempt to retrieve a matching persistable and then create a new one if it isn’t found
- classmethod retrieve_pipeline(cls, pipeline=None, pipeline_id=None, pipeline_kwargs=None, **kwargs)[source]
- Parameters
pipeline (Optional[simpleml.pipelines.base_pipeline.Pipeline]) –
pipeline_id (str) –
pipeline_kwargs (Optional[Dict[str, Any]]) –
- Return type
- class simpleml.utils.training.create_persistable.PipelineCreator[source]
Bases:
PersistableCreator
- classmethod create(cls, registered_name, **kwargs)[source]
Stateless method to create a new persistable with the desired parameters kwargs are passed directly to persistable
- Parameters
registered_name (str) – Class name registered in SimpleML
dataset – dataset object
- Return type
- classmethod determine_filters(cls, strict=False, **kwargs)[source]
stateless method to determine which filters to apply when looking for existing persistable
Returns: database class, filter dictionary
- Parameters
registered_name – Class name registered in SimpleML
strict (bool) – whether to fit objects first before assuming they are identical
- Return type
Tuple[simpleml.pipelines.base_pipeline.Pipeline, Dict[str, Any]]
In theory if all inputs and classes are the same, the outputs should deterministically be the same as well (up to random iter). So, you dont need to fit objects to be sure they are the same