How to register models

Learn how to register models to Vectice.

Make sure to complete the prerequisites before getting started with registering 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:

my_iteration.step_register_model = model

Example

Below is a full example showcasing the concepts mentioned above.

import vectice
from vectice import Model, Metric
from sklearn import ...

# Connect to Vectice
connection = vectice.connect(config="vectice_config.json")

# Retrieve the project phase to begin the model development  
phase = connection.phase("PHA-XXX")

# Initialize iteration
my_iteration = phase.iteration()

# Model metrics and metadata
model_name = "My model"
model_library = "sklearn"
model_technique = "clustering"
model_metrics = [Metric("RMSE", 153), Metric("Clusters number", 5)]
model_predictor = my_sklearn_predictor
model_attachments = ["attachment1.png", "attachment2.png" ]

# Declaring your model and its metadata
model = Model(name=model_name, library=model_library, technique=model_technique, metrics=model_metrics, predictor=model_predictor, attachments=model_attachments)

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

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