Quickstart
This guide will help you get started quickly with installing the View AI Client and training your first interpretable model.
View AI Client is a Python library that provides an interface to interact with the View AI API. It offers functionalities for model training, deployment, prediction, and explanations. This documentation will guide you through the setup process, and usage of the View AI Client.
Resources
View the current API status
Getting Started
If you already have your own model, View AI supports explaining blackbox models or even pipelines. Alternatively, if you are looking to build new models, View AI trains interpretable models tailored to your specific needs.
Installation
Install the View AI Client using pip:
!pip install viewai
2. Account Setup
To use the View AI Client, you'll need an API key. Follow these steps to set up your account and obtain your API key:
Create an Account: Sign up for an account on the View.AI website.
Generate an API Key: Navigate to the API key page in your account settings and click on "Create new secret key". Make sure to save this key securely.
3. Environment Setup
Step 1: Setting up Python
To use the View AI Python library, ensure you have Python installed.
Install Python
Download and install Python from the official Python website. You need at least Python 3.7.1 or newer.
Set up a Virtual Environment (Optional)
Creating a virtual environment can help manage dependencies:
python -m venv myenv
source myenv/bin/activate # On Windows, use `myenv\Scripts\activate`
Install the View AI Python Library
Install the View AI Client using pip:
!pip install viewai
Step 2: Set up Your API Key
Set up Your API Key for All Projects (Recommended)
Create a .env
file in your project directory with your API key:
VIEWAI_API_KEY=your_api_key_here
Set up Your API Key for a Single Project
Alternatively, set the API key directly in your script:
api_key = "your_api_key_here"
client = ViewAIClient(api_key=api_key)
Step 3: Sending Your First API Request
Making an API Request
Follow these steps to send your first API request using the View AI Client.
Step 1: Prepare Your Dataset
Load your dataset into a pandas DataFrame:
import pandas as pd
df = pd.read_csv("path/to/your/dataset.csv")
Step 2: Load Environment Variables and Initialize the Client
Import and initialize the ViewAI Client:
from viewai import ViewAIClient
# Initialize the client
client = ViewAIClient(api_key=api_key)
Step 3: Train Your First Interpretable Model
Use the train
method to train a model with your dataset and target column:
client.train(
df=df,
target="YourTargetColumn",
name="YourModelName"
)
Once the model is trained, you can use the predict
method to make predictions or explore the dashboard at app.viewai.ca to understand the model's behaviour and insights.
↪ Questions? Chat with an AI or talk to a product expert.
Last updated
Was this helpful?