sempy_labs.ml_model package

Module contents

sempy_labs.ml_model.activate_ml_model_endpoint_version(ml_model: str | UUID, name: str, workspace: str | UUID | None = None)

Activates the specified model version endpoint.

This is a wrapper function for the following API: Endpoint - Activate ML Model Endpoint Version.

Service Principal Authentication is supported (see here for examples).

Parameters:
  • ml_model (str | uuid.UUID) – Name or ID of the ML model.

  • name (str) – The ML model version name.

  • workspace (str | uuid.UUID, default=None) – The Fabric workspace name or ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

sempy_labs.ml_model.create_ml_model(name: str, description: str | None = None, workspace: str | UUID | None = None)

Creates a Fabric ML model.

This is a wrapper function for the following API: Items - Create ML Model.

Parameters:
  • name (str) – Name of the ML model.

  • description (str, default=None) – A description of the ML model.

  • workspace (str | uuid.UUID, default=None) – The Fabric workspace name or ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

sempy_labs.ml_model.deactivate_all_ml_model_endpoint_versions(ml_model: str | UUID, workspace: str | UUID | None = None)

Deactivates the specified machine learning model and its version’s endpoints.

This is a wrapper function for the following API: Endpoint - Deactivate All ML Model Endpoint Versions.

Service Principal Authentication is supported (see here for examples).

Parameters:
  • ml_model (str | uuid.UUID) – Name or ID of the ML model.

  • workspace (str | uuid.UUID, default=None) – The Fabric workspace name or ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

sempy_labs.ml_model.deactivate_ml_model_endpoint_version(ml_model: str | UUID, name: str, workspace: str | UUID | None = None)

Deactivates the specified model version endpoint.

This is a wrapper function for the following API: Endpoint - Deactivate ML Model Endpoint Version.

Service Principal Authentication is supported (see here for examples).

Parameters:
  • ml_model (str | uuid.UUID) – Name or ID of the ML model.

  • name (str) – The ML model version name.

  • workspace (str | uuid.UUID, default=None) – The Fabric workspace name or ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

sempy_labs.ml_model.delete_ml_model(ml_model: str | UUID, workspace: str | UUID | None = None)

Deletes a Fabric ML model.

This is a wrapper function for the following API: Items - Delete ML Model.

Parameters:
  • ml_model (str | uuid.UUID) – Name or ID of the ML model.

  • workspace (str | uuid.UUID, default=None) – The Fabric workspace name or ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

sempy_labs.ml_model.list_ml_model_endpoint_versions(ml_model: str | UUID, workspace: str | UUID | None = None) DataFrame

Lists all machine learning model endpoint versions.

This is a wrapper function for the following API: Endpoint - List ML Model Endpoint Versions.

Service Principal Authentication is supported (see here for examples).

Parameters:
  • ml_model (str | uuid.UUID) – Name or ID of the ML model.

  • workspace (str | uuid.UUID, default=None) – The Fabric workspace name or ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

Returns:

A pandas dataframe showing the ML model endpoint versions within a workspace.

Return type:

pandas.DataFrame

sempy_labs.ml_model.list_ml_models(workspace: str | UUID | None = None) DataFrame

Shows the ML models within a workspace.

This is a wrapper function for the following API: Items - List ML Models.

Parameters:

workspace (str | uuid.UUID, default=None) – The Fabric workspace name or ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

Returns:

A pandas dataframe showing the ML models within a workspace.

Return type:

pandas.DataFrame

sempy_labs.ml_model.score_ml_model_endpoint(ml_model: str | UUID, inputs: List[List[Any]], orientation: str = 'values', workspace: str | UUID | None = None) dict

Scores input data using the default version of the endpoint and returns results.

This is a wrapper function for the following API: Endpoint - Score ML Model Endpoint.

Service Principal Authentication is supported (see here for examples).

Parameters:
  • ml_model (str | uuid.UUID) – Name or ID of the ML model.

  • inputs (List[List[Any]]) – Machine learning inputs to score in the form of Pandas dataset arrays that can include strings, numbers, integers and booleans.

  • orientation (str, default='values') – Orientation of the input data.

  • workspace (str | uuid.UUID, default=None) – The Fabric workspace name or ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.

sempy_labs.ml_model.score_ml_model_endpoint_version(ml_model: str | UUID, name: str, inputs: List[List[Any]], orientation: str = 'values', workspace: str | UUID | None = None) dict

Scores input data using the default version of the endpoint and returns results.

This is a wrapper function for the following API: Endpoint - Score ML Model Endpoint Version.

Service Principal Authentication is supported (see here for examples).

Parameters:
  • ml_model (str | uuid.UUID) – Name or ID of the ML model.

  • name (str) – The ML model version name.

  • inputs (List[List[Any]]) – Machine learning inputs to score in the form of Pandas dataset arrays that can include strings, numbers, integers and booleans.

  • orientation (str, default='values') –

    Orientation of the input data.

  • workspace (str | uuid.UUID, default=None) – The Fabric workspace name or ID. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook.