Skip to content

hsml.sklearn.signature #

create_model #

create_model(
    name: str,
    version: int | None = None,
    metrics: dict | None = None,
    description: str | None = None,
    input_example: pandas.DataFrame
    | pandas.Series
    | numpy.ndarray
    | list
    | None = None,
    model_schema: ModelSchema | None = None,
    feature_view: FeatureView | None = None,
    training_dataset_version: int | None = None,
) -> Model

Create an SkLearn model metadata object.

Lazy

This method is lazy and does not persist any metadata or uploads model artifacts in the model registry on its own. To save the model object and the model artifacts, call the save() method with a local file path to the directory containing the model artifacts.

PARAMETER DESCRIPTION
name

Name of the model to create.

TYPE: str

version

Optionally version of the model to create, defaults to None and will create the model with incremented version from the last version in the model registry.

TYPE: int | None DEFAULT: None

metrics

Optionally a dictionary with model evaluation metrics (e.g., accuracy, MAE)

TYPE: dict | None DEFAULT: None

description

Optionally a string describing the model, defaults to empty string "".

TYPE: str | None DEFAULT: None

input_example

Optionally an input example that represents a single input for the model, defaults to None.

TYPE: pandas.DataFrame | pandas.Series | numpy.ndarray | list | None DEFAULT: None

model_schema

Optionally a model schema for the model inputs and/or outputs.

TYPE: ModelSchema | None DEFAULT: None

feature_view

Optionally a feature view object returned by querying the feature store. If the feature view is not provided, the model will not have access to provenance.

TYPE: FeatureView | None DEFAULT: None

training_dataset_version

Optionally a training dataset version. If training dataset version is not provided, but the feature view is provided, the training dataset version used will be the last accessed training dataset of the feature view, within the code/notebook that reads the feature view and training dataset and then creates the model.

TYPE: int | None DEFAULT: None

RETURNS DESCRIPTION
Model

The model metadata object.