View AI
  • Welcome to View AI's Documentation!
  • Product Tour
  • UI Guide
    • Explainable AI
    • Fairness
    • Monitoring
    • Analyze
  • Platform Guide
    • Interpretability
      • ML Tasks
      • Evaluate
    • Observability
  • Client Guide
    • Quickstart
    • Training Models
    • Deploying Models
    • Inference
    • Updating Schemas
Powered by GitBook
On this page
  • Understanding Model Schemas
  • Initialize Manager
  • Creating a schema
  • Loading a schema
  • Validation Rules
  • Publish

Was this helpful?

  1. Client Guide

Deploying Models

View AI includes a ModelSchemaManager class designed for robust data validation and schema management.

Understanding Model Schemas

This is intended for data scientists and developers who need robust data validation and schema management in machine learning projects.

The ModelSchemaManager class provides functionalities to:

  • Load and save schemas from/to files or API endpoints.

  • Update schema configurations, such as categories for categorical fields or ranges for numerical fields.

  • Validate incoming data against the schema.

  • Deploy models with the associated schemas using the ViewAI platform.

Initialize Manager

from viewai_client.schema import ModelSchemaManager

schema_manager = ModelSchemaManager(api_key)

Creating a schema

# Create a schema 

schema = schema_manager.create_schema_from_data(blackbox_model, X_train)

Loading a schema

# Load a schema 

schema = schema_manager.load_schema("your_model_id")

Validation Rules

Extract validation rules from the loaded schema to apply to incoming data. These rules ensure data conforms to the model’s requirements.

What Rules Are Created:

  • Data type checks (e.g., int, float, str).

  • Range checks for numerical fields.

  • Category membership validation for categorical fields, including handling of new allowed categories.

# Get validation rules from the schema 

rules = schema_manager.get_validation_rules()

Publish

Deploy a model with or without an explicit schema:

model = client.deploy(
    blackbox_model,
    df=df,
    target=target,
    schema=schema,
    name=model_name,
    workspace_id=workspace_id,
)
PreviousTraining ModelsNextInference

Last updated 1 year ago

Was this helpful?

Once the model is deployed, you can use the predict method to make predictions or explore the dashboard at to monitor the model's behaviour and gain insights.

↪ Questions? Chat with an AI or talk to a .

app.viewai.ca
product expert