Skip to content

Model Version Representation

ModelVersionRepresentation

Represents the metadata of a Vectice model version.

A Model Version Representation shows information about a specific version of a model from the Vectice app. It makes it easier to get and read this information through the API.

Hint

A model version ID starts with 'MDV-XXX'. Retrieve the ID in the Vectice App, then use the ID with the following methods to get the model version: connect.model_version('MDV-XXX') or connect.browse('MDV-XXX') (see Connection page).

Attributes:

Name Type Description
id str

The unique identifier of the model version.

project_id str

The identifier of the project to which the model version belongs.

name str

The name of the model version. For model versions it corresponds to the version number.

status str

The status of the model version (EXPERIMENTATION, STAGING, PRODUCTION, or RETIRED).

risk str

The risk status of the model version (HIGH, MEDIUM, LOW, or UNDEFINED).

approval str

The approval status of the model version (ToValidate, InValidation, Validated, Approved, or Rejected).

description str

The description of the model version.

technique str

The technique used by the model version.

library str

The library used by the model version.

inventory_id str | None

The model version inventory id.

iteration_origin str | None

The iteration in which this model version was created.

phase_origin str | None

The phase in which this model version was created.

metrics List[Dict[str, Any]]

The metrics associated with the model version.

properties List[Dict[str, Any]]

The properties associated with the model version.

model_representation ModelRepresentation

Holds informations about the source model linked to the model version, where all versions are grouped together.

creator Dict[str, str]

Creator of the model version.

asdict

asdict()

Transform the ModelVersionRepresentation into a organised dictionary.

Returns:

Type Description
Dict[str, Any]

The object represented as a dictionary

download_attachments

download_attachments(attachments=None, output_dir=None)

Downloads attachments of this version.

Parameters:

Name Type Description Default
attachments list[str] | str | None

Specific attachments to download, if None then all the version attachments will be downloaded.

None
output_dir str | None

Destination for the attachments to be downloaded to. If None then attachments will be downloaded to the current directory.

None

Returns:

Type Description
None

None.

get_approval_history

get_approval_history()

Retrieves approval history of the current model version.

Returns:

Type Description
dict[str, datetime | None]

A dictionary with last updated dates for each model version approval status.

get_table

get_table(table)

Extracts the Vectice table in attachment of the model version representation into a DataFrame for better readability.

Returns:

Type Description
DataFrame

A pandas DataFrame representing the table of the model version.

list_attachments

list_attachments()

Lists all the attachments (tables, files, pickle...) of the ModelVersionRepresentation.

Returns:

Type Description
list[Attachment]

The attachments list.

list_issues

list_issues(number_of_items=DEFAULT_NUMBER_OF_ITEMS)

Retrieves a list of issue representations associated with the current model version. See here: https://api-docs.vectice.com/reference/vectice/representation/issue/

Parameters:

Name Type Description Default
number_of_items int

The number of issues to retrieve. Defaults to 30.

DEFAULT_NUMBER_OF_ITEMS

Returns:

Type Description
list[IssueRepresentation]

A list of IssueRepresentation instances corresponding to the issues in the current model version.

list_lineage_inputs

list_lineage_inputs()

Retrieves all the lineage inputs of the current model version.

Returns:

Type Description
list[DatasetVersionRepresentation]

The list of dataset version used as input of the current model version.

metrics_as_dataframe

metrics_as_dataframe()

Transforms the metrics of the ModelVersionRepresentation into a DataFrame for better readability.

Returns:

Type Description
DataFrame

A pandas DataFrame containing the metrics of the model version.

properties_as_dataframe

properties_as_dataframe()

Transforms the properties of the ModelVersionRepresentation into a DataFrame for better readability.

Returns:

Type Description
DataFrame

A pandas DataFrame containing the properties of the model version.

update

update(
    status=None,
    metrics=None,
    properties=None,
    attachments=None,
)

Update the Model Version from the API.

Parameters:

Name Type Description Default
status str | None

The new status of the model. Accepted values are EXPERIMENTATION, STAGING, PRODUCTION and RETIRED.

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

The new properties of the model.

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

The new metrics of the model.

None
attachments TAttachment | None

The new attachments of the model.

None

Returns:

Type Description
None

None