Deleting

Machine Learning object deletion.

Once an entity is saved to the ML Registry following the instructions outlined here, it is available for use by other users. However, the storage of these models may result in errors or may not need to be persisted for all time. As such, the kxi.ml.registry.delete class provides a user with the ability to remove models, parameters, metrics etc from an ML Registry. All functionality within this class is described below.

kxi.ml.registry.delete.registry

Delete a registry.

Parameters:

Name Type Description Default
folder_path Union[str, dict]

Either a string containing the folder path denoting location of the registry, or a dictionary specifying the vendor (as key) and the path (as value), e.g. {'aws':'s3://kx-ml-registry-bucket'}, or None to default to local current working directory.

None
config dict

Either a registry configuration as dictionary, or None.

None

Examples:

Delete the registry:

>>> from kxi import ml
>>> ml.init()
>>> ml.registry.delete.registry(folder_path="/tmp")

kxi.ml.registry.delete.experiment

Delete an experiment within the specified registry.

Parameters:

Name Type Description Default
folder_path Union[str, dict]

Either a string containing the folder path denoting where to delete the experiment, or a dictionary specifying the vendor (as key) and the path (as value), e.g. {'aws':'s3://kx-ml-registry-bucket'} or None to default to local current working directory.

None
experiment_name str

The name of the experiment.

None

Examples:

Delete an experiment from the registry:

>>> from kxi import ml
>>> ml.init()
>>> ml.registry.delete.experiment(folder_path="/tmp", experiment_name="day0")

kxi.ml.registry.delete.model

Delete a model within the specified registry.

Parameters:

Name Type Description Default
folder_path Union[str, dict]

Either a string containing the folder path denoting where to delete the model, or a dictionary specifying the vendor (as key) and the path (as value), e.g. {'aws':'s3://kx-ml-registry-bucket'}, or None to default to local current working directory.

None
experiment_name str

Either the name of the experiment under which the model resides as a string, or None if unnamed.

None
model_name str

Either the name of model to be deleted as a string, or None if latest model to be deleted.

None
version List[int]

A list of the major and minor versions of the model - [major, minor]. If None, the latest version of the model associated with model_name is used. If None and a model_name is specified, all versions of this model will be deleted.

None

Returns:

Type Description
Optional[uuid.UUID]

Unique ID of given model or None if multiple versions are to be deleted.

Examples:

Delete a model from the registry:

>>> from kxi import ml
>>> ml.init()
>>> ml.registry.delete.model(folder_path="/tmp",
experiment_name="day0",
model_name="linear_regression")

kxi.ml.registry.delete.code

Delete a code file associated with a specific model.

Parameters:

Name Type Description Default
code_file str

The name of the code file to be deleted.

required
folder_path Union[str, dict]

Either a string containing the folder path denoting where to delete the code, or a dictionary specifying the vendor (as key) and the path (as value), e.g. {'aws':'s3://kx-ml-registry-bucket'}, or None to default to local current working directory.

None
experiment_name str

The name of the experiment under which the code resides.

None
model_name str

The name of model whose code is to be deleted.

None
version List[int]

The version of model whose code is to be deleted as a length two list of integers indicating the major and minor versions.

None

Examples:

Delete a code file from a model in the registry:

>>> from kxi import ml
>>> ml.init()
>>> ml.registry.delete.code(code_file="prerequisites.py",
folder_path="/tmp",
experiment_name="day0",
model_name="complex_model")

kxi.ml.registry.delete.parameters

Delete a parameter file associated with a specific model.

Parameters:

Name Type Description Default
param_file str

A string giving the name of the parameter file to be deleted.

required
folder_path Union[str, dict]

Either a string containing the folder path denoting where to delete the parameters, or a dictionary specifying the vendor (as key) and the path (as value), e.g. {'aws':'s3://kx-ml-registry-bucket'}, or None to default to local current working directory.

None
experiment_name str

The name of the experiment under which the parameter file resides.

None
model_name str

The name of model whose parameters are to be deleted.

None
version List[int]

The version of model whose parameters are to be deleted as a length two list of integers indicating the major and minor versions.

None

Examples:

Delete a parameter file from a model in the registry:

>>> from kxi import ml
>>> ml.init()
>>> ml.registry.delete.parameters(param_file="alpha.json",
folder_path="/tmp",
experiment_name="day0",
model_name="logistic_regression")

kxi.ml.registry.delete.metrics

Delete metrics table associated with a specific model.

Parameters:

Name Type Description Default
folder_path Union[str, dict]

Either a string containing the folder path denoting the registry from which to delete the metrics, or a dictionary specifying the vendor (as key) and the path (as value), e.g. {'aws':'s3://kx-ml-registry-bucket'}, or None to default to local current working directory.

None
experiment_name str

The name of the experiment under which the metrics table resides.

None
model_name str

The name of model whose metrics are to be deleted.

None
version List[int]

The version of model whose metrics are to be deleted as a length two list of integers indicating the major and minor versions.

None

Examples:

Delete all metrics from a model in the registry:

>>> from kxi import ml
>>> ml.init()
>>> ml.registry.delete.metrics(folder_path="/tmp",
experiment_name="day0",
model_name="linear_regression")

kxi.ml.registry.delete.metric

Delete metric associated with a specific model.

Parameters:

Name Type Description Default
metric_name str

The name of the metric to be deleted.

required
folder_path Union[str, dict]

Either a string containing the folder path denoting the registry from which to delete the metric, or a dictionary specifying the vendor (as key) and the path (as value), e.g. {'aws':'s3://kx-ml-registry-bucket'}, or None to default to local current working directory.

None
experiment_name str

The name of the experiment under which the metric resides.

None
model_name str

The name of model whose metric is to be deleted.

None
version List[int]

The version of model whose metric is to be deleted as a length two list of integers indicating the major and minor versions.

None

Examples:

Delete a metric from a model in the registry:

>>> from kxi import ml
>>> ml.init()
>>> ml.registry.delete.metric(metric_name="mse",
folder_path="/tmp",
experiment_name="day0",
model_name="linear_regression")