Skip to content

kxi.ml.registry.delete

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.

registry

def registry(folder_path: Union[str, dict] = None,
             config: dict = None) -> None

Delete a registry.

Arguments:

  • folder_path - 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.
  • config - Either a registry configuration as dictionary, or None.

Examples:

Delete the registry:

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

experiment

def experiment(folder_path: Union[str, dict] = None,
               experiment_name: str = None) -> None

Delete an experiment within the specified registry.

Arguments:

  • folder_path - 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.
  • experiment_name - The name of the experiment.

Examples:

Delete an experiment from the registry:

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

model

def model(folder_path: Union[str, dict] = None,
          experiment_name: str = None,
          model_name: str = None,
          version: List[int] = None) -> Union[UUID, None]

Delete a model within the specified registry.

Arguments:

  • folder_path - 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.
  • experiment_name - Either the name of the experiment under which the model resides as a string, or None if unnamed.
  • model_name - Either the name of model to be deleted as a string, or None if latest model to be deleted. If None takes the most recent version of this model.
  • version - 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.

Returns:

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")

code

def code(code_file: str,
         *,
         folder_path: Union[str, dict] = None,
         experiment_name: str = None,
         model_name: str = None,
         version: List[int] = None) -> None

Delete a code file associated with a specific model.

Arguments:

  • code_file - The name of the code file to be deleted.
  • folder_path - 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.
  • experiment_name - The name of the experiment under which the code resides.
  • model_name - The name of model whose code is to be deleted. If None takes the most recent model.
  • version - The version of model whose code is to be deleted as a length two list of integers indicating the major and minor versions. If None takes the most recent version.

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")

parameters

def parameters(param_file: str,
               *,
               folder_path: Union[str, dict] = None,
               experiment_name: str = None,
               model_name: str = None,
               version: List[int] = None) -> None

Delete a parameter file associated with a specific model.

Arguments:

  • param_file - A string giving the name of the parameter file to be deleted.
  • folder_path - 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.
  • experiment_name - The name of the experiment under which the parameter file resides.
  • model_name - The name of model whose parameters are to be deleted. If None takes the most recent model.
  • version - The version of model whose parameters are to be deleted as a length two list of integers indicating the major and minor versions. If None takes the most recent version.

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")

metrics

def metrics(folder_path: Union[str, dict] = None,
            experiment_name: str = None,
            model_name: str = None,
            version: List[int] = None) -> None

Delete metrics table associated with a specific model.

Arguments:

  • folder_path - 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.
  • experiment_name - The name of the experiment under which the metrics table resides.
  • model_name - The name of model whose metrics are to be deleted. If None takes the most recent model.
  • version - The version of model whose metrics are to be deleted as a length two list of integers indicating the major and minor versions. If None takes the most recent version.

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")

metric

def metric(metric_name: str,
           *,
           folder_path: Union[str, dict] = None,
           experiment_name: str = None,
           model_name: str = None,
           version: List[int] = None) -> None

Delete metric associated with a specific model.

Arguments:

  • metric_name - The name of the metric to be deleted.
  • folder_path - 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.
  • experiment_name - The name of the experiment under which the metric resides.
  • model_name - The name of model whose metric is to be deleted. If None takes the most recent model.
  • version - The version of model whose metric is to be deleted as a length two list of integers indicating the major and minor versions. If None takes the most recent version.

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")