Skip to main content

Set Up a Model to Ingest Data

There are three simple steps required to set up a model to ingest whylogs profile data uploaded to the platform.

  1. Set up a model in WhyLabs
  2. Create an API access token WhyLabs
  3. Update whylogs script locally

1. Set Up a Model

First, log into hub.whylabsapp.com. Then, from the Model Dashboard click one of the "Set up model" buttons. Alternatively, you can click the menu icon in the top-left corner of the screen, next to the WhyLabs logo. From the side menu select "Settings" and then "Model Management" option.

Set up model from Model Dashboard

From the Model Management page simply provide a name for your model, and optionally select the type of model. The type of model will determine which performance metrics will be displayed in the Model Performance tab. The type can be updated later if it's left blank when setting up the model. If you have multiple models that need to be set up, you can use the bulk set up option. The Model Management page is shown below:

Model Management

After setting up your new model, you will need to copy its model ID and add it to your code when using whylogs to log and profile data. Note that in whylogs, the datasetID refers to the modelID created in the WhyLabs Platform.

2. Create an API Access Token

In order to upload whylogs profiles to the platform you will need an API access token, in addition to the model ID. You can create a new API token from the Access Tokens page in the "Settings" section of the platform.

The token will be displayed only while the page is loaded. Alternatively, you can use a previously created access token that you have already saved to your local environment.

Access Tokens

You will need your organization ID, which can also be found on the API token page:

Access Tokens

3. Update whylogs Script Locally

You will need to create an API access token (key), a model ID, and the organization ID in order to upload and ingest whylogs profile data to the platform from your local environment. A basic python example of how to start a whylogs session is shown below. Note: the organization ID is case sensitive.

import pandas as pd
import os
from whylogs.app import Session
from whylogs.app.writers import WhyLabsWriter

os.environ["WHYLABS_API_KEY"] = "YOUR-API-KEY"
os.environ["WHYLABS_DEFAULT_ORG_ID"] = "YOUR-ORG-ID" # ORG-ID is case sensistive

# Adding the WhyLabs Writer to utilize WhyLabs platform
writer = WhyLabsWriter()

session = Session(project="demo-project", pipeline="demo-pipeline", writers=[writer])

# Point to your local CSV if you have your own data
df = pd.read_csv("https://whylabs-public.s3.us-west-2.amazonaws.com/datasets/tour/current.csv")

# Run whylogs on current data and upload to the WhyLabs Platform
# Note: 'datasetId' in whylogs maps to 'model-id' that is provided when you set up a model in WhyLabs
with session.logger(tags={"datasetId": "model-0"}) as ylog:
ylog.log_dataframe(df)
Prefooter Illustration Mobile
Run AI With Certainty
Get started for free
Prefooter Illustration