Skip to content

Models

Model

Model(
    library=None,
    technique=None,
    metrics=None,
    properties=None,
    name=None,
    attachments=None,
    predictor=None,
    derived_from=None,
    additional_info=None,
)

Represent a wrapped model.

To document models within an iteration, you need to wrap it as a Vectice model. It involves capturing metadata about the predictor. This metadata enables Vectice to provide summaries and insights about the model.

A Vectice Model is a wrapped predictor that can be logged inside a Vectice iteration.

Parameters:

Name Type Description Default
library str | None

The library used to generate the model.

None
technique str | None

The modeling technique used.

None
metrics dict[str, int | float] | list[Metric] | Metric | None

A dict for example {"MSE": 1}.

None
properties dict[str, str | int] | list[Property] | Property | None

A dict, for example {"folds": 32}.

None
name str | None

The model name. If None, will be auto-generated by Vectice.

None
attachments TAttachment | None

Path of a file that will be attached to the iteration along with the predictor.

None
predictor Any

The predictor.

None
derived_from list[TDerivedFrom] | None

List of dataset verions (or version ids) to link as lineage.

None
additional_info dict[str, str] | AdditionalInfo | None

An optional set of key values related to the context in which the model was created. For instance if an experiment tracker was used or a specific framework.

None

additional_info property writable

additional_info

The additional info associated with the model.

Returns:

Type Description
AdditionalInfo | None

The additional info associated with the model.

attachments property writable

attachments

The attachments associated with the model.

Returns:

Type Description
list[TFormattedAttachment] | None

The attachments associated with the model.

derived_from property

derived_from

The datasets versions from which this model is derived.

Returns:

Type Description
list[str]

The datasets versions from which this model is derived.

latest_version_id property writable

latest_version_id

The id of the latest version of this model.

Returns:

Type Description
str | None

The id of the latest version of this model.

library property writable

library

The name of the library used to generate the model.

Returns:

Type Description
str | None

The name of the library used to generate the model.

metrics property writable

metrics

The model's metrics.

Returns:

Type Description
list[Metric] | None

The model's metrics.

name property writable

name

The model's name.

Returns:

Type Description
str | None

The model's name.

predictor property writable

predictor

The model's predictor.

Returns:

Type Description
Any

The model's predictor.

properties property writable

properties

The model's properties.

Returns:

Type Description
list[Property] | None

The model's properties.

technique property writable

technique

The name of the modeling technique used to learn the model.

Returns:

Type Description
str | None

The name of the modeling technique used to learn the model.

mlflow staticmethod

mlflow(run_id, client, url=None, derived_from=None)

Extract automatically information from an Mlflow run into a Vectice model to be assigned to an iteration.

import mlflow
from mlflow.client import MlflowClient
from vectice import Model

model = Model.mlflow(
        run_id="d479ca87954f4a0abc4da3333b990cb3",
        client=MlflowClient() #also work with client=mlflow
    )

Parameters:

Name Type Description Default
run_id str

The run id of the mlflow model to be wrapped.

required
client MlflowClient

The mlflow client in order to access the run through get_run() method. WARNING: the client should have the tracking URI where the run is located.

required
url str | None

The Mlflow UI URL to access the run info.

None
derived_from list[TDerivedFrom] | None

List of dataset versions (or version ids) to link as lineage.

None