How to register models

This guide will show you how to register models to Vectice.

The Vectice API enables you to register all models used during development to the Vectice UI. To register your model's data and metadata, use the following Model method to declare your model.

model = Model(name, library, technique, metrics, predictor, attachments)

Once your model is declared, sync the model and its metadata to vectice by assigning the model to your project's phase iteration as follows:

iteration.step_register_model = model

Example

Below is a full example showcasing the concepts mentioned above.

from vectice.models.metric import Metric
from vectice.models.model import Model
from sklearn import ...

# Connect to your project by entering your 
# API Token, endpoint, workspace, and project name.
my_project = vectice.connect(
        api_token="YOUR_API_TOKEN",
        host="YOUR_ENDPOINT",
        workspace="YOUR_WORKSPACE",
        project="YOUR_PROJECT_NAME",
    )

# Retrieve the project phase to begin the model development.  
phase = my_project.phase("phase one")

# Initialize iteration and retrieve the first step
iteration = phase.iteration()

# Model metrics and metadata
metrics = [Metric("RMSE", 153), Metric("Clusters number", 5)]
technique = "clustering"
name = "My model"
predictor = my_sklearn_predictor

# Declaring your model and its metadata
model = Model(library, technique, metrics, name=name, predictor=my_predictor)

# Connecting your model to an iteration will automatically sync the information to Vectice UI
iteration.step_register_model = model

For an in-depth example, view the code example found in the Iterative Development guide.

Last updated