Model Observability with Assays

How to use Wallaroo Assays to monitor the environment and know when to retrain the model based on changes to data.

This tutorial and the assets can be downloaded as part of the Wallaroo Tutorials repository.

Model Drift Observability with Assays

The Model Insights feature lets you monitor how the environment that your model operates within may be changing in ways that affect it’s predictions so that you can intervene (retrain) in an efficient and timely manner. Changes in the inputs, data drift, can occur due to errors in the data processing pipeline or due to changes in the environment such as user preference or behavior.

This notebook focuses on interactive exploration over historical data. After you are comfortable with how your data has behaved historically, you can schedule this same analysis (called an assay) to automatically run periodically, looking for indications of data drift or concept drift.

In this notebook, we will be running a drift assay on an ONNX model pre-trained to predict house prices.

Goal

Model insights monitors the output of the spam classifier model over a designated time window and compares it to an expected baseline distribution. We measure the difference between the window distribution and the baseline distribution; large differences indicate that the behavior of the model (or its inputs) has changed from what we expect. This possibly indicates a change that should be accounted for, possibly by retraining the models.

Resources

This tutorial provides the following:

  • Models:
    • models/rf_model.onnx: The champion model that has been used in this environment for some time.
    • Various inputs:
      • smallinputs.df.json: A set of house inputs that tends to generate low house price values.
      • biginputs.df.json: A set of house inputs that tends to generate high house price values.

Prerequisites

  • A deployed Wallaroo instance
  • The following Python libraries installed:
    • wallaroo: The Wallaroo SDK. Included with the Wallaroo JupyterHub service by default.
    • pandas: Pandas, mainly used for Pandas DataFrame

Steps

  • Deploying a sample ML model used to determine house prices based on a set of input parameters.
  • Build an assay baseline from a set of baseline start and end dates, and an assay baseline from a numpy array.
  • Preview the assay and show different assay configurations.
  • Upload the assay.
  • View assay results.
  • Pause and resume the assay.

Import Libraries

The first step will be to import our libraries, and set variables used through this tutorial.

import wallaroo
from wallaroo.object import EntityNotFoundError
from wallaroo.framework import Framework

from IPython.display import display

# used to display DataFrame information without truncating
from IPython.display import display
import pandas as pd
pd.set_option('display.max_colwidth', None)
pd.set_option('display.max_columns', None)

import datetime
import time

workspace_name = f'assay-demonstration-tutorial-2'
main_pipeline_name = f'assay-demonstration-tutorial'
model_name_control = f'house-price-estimator'
model_file_name_control = './models/rf_model.onnx'

# Set the name of the assay
assay_name=f"house price assay demo"

# ignoring warnings for demonstration
import warnings
warnings.filterwarnings('ignore')

# used to display DataFrame information without truncating
from IPython.display import display
import pandas as pd
pd.set_option('display.max_colwidth', None)
pd.set_option('display.max_columns', None)

Connect to the Wallaroo Instance

The first step is to connect to Wallaroo through the Wallaroo client. The Python library is included in the Wallaroo install and available through the Jupyter Hub interface provided with your Wallaroo environment.

This is accomplished using the wallaroo.Client() command, which provides a URL to grant the SDK permission to your specific Wallaroo environment. When displayed, enter the URL into a browser and confirm permissions. Store the connection into a variable that can be referenced later.

If logging into the Wallaroo instance through the internal JupyterHub service, use wl = wallaroo.Client(). For more information on Wallaroo Client settings, see the Client Connection guide.

# Login through local Wallaroo instance

wl = wallaroo.Client()

Create Workspace

We will create a workspace to manage our pipeline and models. The following variables will set the name of our sample workspace then set it as the current workspace.

Workspace, pipeline, and model names should be unique to each user, so we’ll add in a randomly generated suffix so multiple people can run this tutorial in a Wallaroo instance without effecting each other.

workspace = wl.get_workspace(name=workspace_name, create_if_not_exist=True)

wl.set_current_workspace(workspace)
{'name': 'assay-demonstration-tutorial-2', 'id': 11, 'archived': False, 'created_by': '3eeab554-fc2e-41ac-8b4e-0d778e8a471b', 'created_at': '2024-10-09T19:50:23.231562+00:00', 'models': [{'name': 'house-price-estimator', 'versions': 2, 'owner_id': '""', 'last_update_time': datetime.datetime(2024, 10, 16, 22, 0, 48, 467677, tzinfo=tzutc()), 'created_at': datetime.datetime(2024, 10, 9, 19, 50, 24, 679975, tzinfo=tzutc())}], 'pipelines': [{'name': 'assay-demonstration-tutorial', 'create_time': datetime.datetime(2024, 10, 9, 19, 50, 25, 224073, tzinfo=tzutc()), 'definition': '[]'}]}

Upload The Champion Model

For our example, we will upload the champion model that has been trained to derive house prices from a variety of inputs. The model file is rf_model.onnx, and is uploaded with the name house-price-estimator.

housing_model_control = (wl.upload_model(model_name_control, 
                                        model_file_name_control, 
                                        framework=Framework.ONNX)
                                        .configure(tensor_fields=["tensor"])
                        )

Build the Pipeline

This pipeline is made to be an example of an existing situation where a model is deployed and being used for inferences in a production environment. We’ll call it assay-demonstration-tutorial, set housing_model_control as a pipeline step, then run a few sample inferences.

This pipeline will be a simple one - just a single pipeline step.

# mainpipeline = wl.build_pipeline(main_pipeline_name)
# # clear the steps if used before
# mainpipeline.clear()

# mainpipeline.add_model_step(housing_model_control)

mainpipeline = wl.get_pipeline(main_pipeline_name)

#minimum deployment config
deploy_config = wallaroo.DeploymentConfigBuilder().replica_count(1).cpus(0.5).memory("1Gi").build()

mainpipeline.deploy(deployment_config = deploy_config)
 ok
nameassay-demonstration-tutorial
created2024-10-09 19:50:25.224073+00:00
last_updated2024-10-18 15:50:20.759830+00:00
deployedTrue
workspace_id11
workspace_nameassay-demonstration-tutorial-2
archx86
accelnone
tags
versionsba6b344c-83a0-4308-bc62-f198f8af8a5d, 0740ad84-a770-4cf9-b1ce-1f45dbe9c1c4, a2494de7-4d3a-428f-a241-9ddff1ae6772, 6ff08bf3-9be8-484c-b35f-cfde42854ad7, 54380aa2-8722-4b80-b511-b494c6f42c4b, b7a878c6-4f62-4e57-843c-23604c38704b
stepshouse-price-estimator
publishedFalse

Testing

We’ll use two inferences as a quick sample test - one that has a house that should be determined around $700k, the other with a house determined to be around $1.5 million.

normal_input = pd.DataFrame.from_records({"tensor": [[4.0, 2.5, 2900.0, 5505.0, 2.0, 0.0, 0.0, 3.0, 8.0, 2900.0, 0.0, 47.6063, -122.02, 2970.0, 5251.0, 12.0, 0.0, 0.0]]})
result = mainpipeline.infer(normal_input)
display(result)
timein.tensorout.variableanomaly.count
02024-10-18 15:50:21.222[4.0, 2.5, 2900.0, 5505.0, 2.0, 0.0, 0.0, 3.0, 8.0, 2900.0, 0.0, 47.6063, -122.02, 2970.0, 5251.0, 12.0, 0.0, 0.0][718013.7]0
large_house_input = pd.DataFrame.from_records({'tensor': [[4.0, 3.0, 3710.0, 20000.0, 2.0, 0.0, 2.0, 5.0, 10.0, 2760.0, 950.0, 47.6696, -122.261, 3970.0, 20000.0, 79.0, 0.0, 0.0]]})
large_house_result = mainpipeline.infer(large_house_input)
display(large_house_result)
timein.tensorout.variableanomaly.count
02024-10-18 15:50:21.270[4.0, 3.0, 3710.0, 20000.0, 2.0, 0.0, 2.0, 5.0, 10.0, 2760.0, 950.0, 47.6696, -122.261, 3970.0, 20000.0, 79.0, 0.0, 0.0][1514079.4]0

Generate Sample Data

Before creating the assays, we must generate data for the assays to build from.

For this example, we will:

  • Perform sample inferences based on lower priced houses and use that as our baseline.
  • Generate inferences from specific set of high priced houses create inference outputs that will be outside the baseline. This is used in later steps to demonstrate baseline comparison against assay analyses.

Inference Results History Generation

To start the demonstration, we’ll create a set of inferences based on houses with small estimated prices.

We will save the beginning and end periods of inferences to the variables assay_baseline_start and assay_baseline_end. These will be used later to create assay baselines from a range of dates.

small_houses_inputs = pd.read_json('./data/smallinputs.df.json')
baseline_size = 500

# Where the baseline data will start
assay_baseline_start = datetime.datetime.now()

# These inputs will be random samples of small priced houses.  Around 30,000 is a good number
small_houses = small_houses_inputs.sample(baseline_size, replace=True).reset_index(drop=True)

# Wait 60 seconds to set this data apart from the rest
time.sleep(60)
small_results = mainpipeline.infer(small_houses)

# Set the baseline end

assay_baseline_end = datetime.datetime.now()

Generate Numpy Baseline Values

From our inference outputs, we will create an array of numpy values. These are used for assays baselines created from numpy values.

# get the numpy values

# set the results to a non-array value
small_results_baseline_df = small_results.copy()
small_results_baseline_df['variable']=small_results['out.variable'].map(lambda x: x[0])
small_results_baseline_df

# set the numpy array
small_results_baseline = small_results_baseline_df['variable'].to_numpy()

Assay Test Data

The following will generate inference data for us to test against the assay baseline. For this, we will add in house data that generate higher house prices than the baseline data we used earlier.

This process should take 6 minutes to generate the historical data we’ll later use in our assays. We store the DateTime assay_window_start to determine where to start out assay analyses.

# Get a spread of house values

# # Set the start for our assay window period.
assay_window_start = datetime.datetime.now()

for x in range(10):
    time.sleep(65)
    inference_size = 1000

    # And a spread of small house values

    small_houses_inputs = pd.read_json('./data/smallinputs.df.json', orient="records")
    small_houses = small_houses_inputs.sample(inference_size, replace=True).reset_index(drop=True)

    mainpipeline.infer(small_houses)

time.sleep(65)
# Get a spread of large house values

for x in range(10):
    time.sleep(65)
    inference_size = 1000

    # And a spread of large house values

    big_houses_inputs = pd.read_json('./data/biginputs.df.json', orient="records")
    big_houses = big_houses_inputs.sample(inference_size, replace=True).reset_index(drop=True)

    mainpipeline.infer(big_houses)

time.sleep(65)

Model Insights via the Wallaroo Dashboard SDK

Assays generated through the Wallaroo SDK can be previewed, configured, and uploaded to the Wallaroo Ops instance. The following is a condensed version of this process. For full details see the Wallaroo SDK Essentials Guide: Assays Management guide.

Model drift detection with assays using the Wallaroo SDK follows this general process.

  • Define the Baseline: From either historical inference data for a specific model in a pipeline, or from a pre-determine array of data, a baseline is formed.
  • Assay Preview: Once the baseline is formed, we preview the assay and configure the different options until we have the the best method of detecting environment or model drift.
  • Create Assay: With the previews and configuration complete, we upload the assay. The assay will perform an analysis on a regular scheduled based on the configuration.
  • Get Assay Results: Retrieve the analyses and use them to detect model drift and possible sources.
  • Pause/Resume Assay: Pause or restart an assay as needed.

Define the Baseline

Assay baselines are defined with the wallaroo.client.build_assay method. Through this process we define the baseline from either a range of dates or pre-generated values.

wallaroo.client.build_assay take the following parameters:

ParameterTypeDescription
assay_nameString (Required) - requiredThe name of the assay. Assay names must be unique across the Wallaroo instance.
pipelinewallaroo.pipeline.Pipeline (Required)The pipeline the assay is monitoring.
model_nameString (Optional) / NoneThe name of the model to monitor. This field should only be used to track the inputs/outputs for a specific model step in a pipeline. If no model_name is to be included, then the parameters must be passed a named parameters not positional ones.
iopathString (Required)The input/output data for the model being tracked in the format input/output field index. Only one value is tracked for any assay. For example, to track the output of the model’s field house_value at index 0, the iopath is 'output house_value 0.
baseline_startdatetime.datetime (Optional)The start time for the inferences to use as the baseline. Must be included with baseline_end. Cannot be included with baseline_data.
baseline_enddatetime.datetime (Optional)The end time of the baseline window. the baseline. Windows start immediately after the baseline window and are run at regular intervals continuously until the assay is deactivated or deleted. Must be included with baseline_start. Cannot be included with baseline_data..
baseline_datanumpy.array (Optional)The baseline data in numpy array format. Cannot be included with either baseline_start or baseline_data.

Note that model_name is an optional parameters when parameters are named. For example:

assay_builder_from_dates = wl.build_assay(assay_name="assays from date baseline", 
                                          pipeline=mainpipeline, 
                                          iopath="output variable 0",
                                          baseline_start=assay_baseline_start, 
                                          baseline_end=assay_baseline_end)

or:

assay_builder_from_dates = wl.build_assay("assays from date baseline", 
                                          mainpipeline, 
                                          None, ## since we are using positional parameters, `None` must be included for the model parameter
                                          "output variable 0",
                                          assay_baseline_start, 
                                          assay_baseline_end)

Baselines are created in one of two mutually exclusive methods:

  • Date Range: The baseline_start and baseline_end retrieves the inference requests and results for the pipeline from the start and end period. This data is summarized and used to create the baseline. For our examples, we’re using the variables assay_baseline_start and assay_baseline_end to represent a range of dates, with assay_baseline_start being set before assay_baseline_end.
  • Numpy Values: The baseline_data sets the baseline from a provided numpy array. This allows assay baselines to be created without first performing inferences in Wallaroo.

Define the Baseline Example

This example shows two methods of defining the baseline for an assay:

  • "assays from date baseline": This assay uses historical inference requests to define the baseline. This assay is saved to the variable assay_builder_from_dates.
  • "assays from numpy": This assay uses a pre-generated numpy array to define the baseline. This assay is saved to the variable assay_builder_from_numpy.

In both cases, the following parameters are used:

ParameterValue
assay_name"assays from date baseline" and "assays from numpy"
pipelinemainpipeline: A pipeline with a ML model that predicts house prices. The output field for this model is variable.
iopathThese assays monitor the model’s output field variable at index 0 for the pipeline. From this, the iopath setting is "output variable 0".

The difference between the two assays’ parameters determines how the baseline is generated.

  • "assays from date baseline": Uses the baseline_start and baseline_end to set the time period of inference requests and results to gather data from.
  • "assays from numpy": Uses a pre-generated numpy array as for the baseline data.

First we generate an assay baseline from a range of historical inferences performed through the specified pipeline deployment.

# Build the assay, based on the start and end of our baseline time, 
# and tracking the output variable index 0

display(assay_baseline_start)
display(assay_baseline_end)

assay_baseline_from_dates = wl.build_assay(assay_name="assays from date baseline", 
                                          pipeline=mainpipeline, 
                                          iopath="output variable 0",
                                          baseline_start=assay_baseline_start, 
                                          baseline_end=assay_baseline_end)

# create the baseline from the dates
assay_baseline_run_from_dates = assay_baseline_from_dates.build().interactive_baseline_run()
datetime.datetime(2024, 10, 18, 15, 50, 21, 296181)

datetime.datetime(2024, 10, 18, 15, 51, 21, 378013)

# storing the workspace id for later requests
workspace_id = workspace.id()
workspace_id
11

In this code sample, we generate the assay baseline from a preset numpy array called small_results_baseline.

# build the baseline from the numpy array
display(small_results_baseline[0:5])

# assay builder by baseline
assay_baseline_from_numpy = wl.build_assay(assay_name="assays from numpy", 
                               pipeline=mainpipeline, 
                               iopath="output variable 0", 
                               baseline_data = small_results_baseline)

# create the baseline from the numpy array
assay_baseline_run_from_numpy = assay_baseline_from_numpy.build().interactive_baseline_run()
array([ 450867.7 , 1140733.8 ,  974485.3 ,  873848.44,  249227.83])

Baseline Chart

The baseline chart is displayed with wallaroo.assay.AssayAnalysis.chart(), which returns a chart with:

  • baseline mean: The mean value of the baseline values.
  • baseline median: The median value of the baseline values.
  • bin_mode: The binning mode. See Binning Mode
  • aggregation: The aggregation type. See Aggregation Options
  • metric: The assay’s metric type. See Score Metric
  • weighted: Whether the binning mode is weighted. See Binning Mode

The first chart is from an assay baseline generated from a set of inferences across a range of dates.

assay_baseline_run_from_dates.chart()
baseline mean = 539895.63075
baseline median = 450283.78125
bin_mode = Quantile
aggregation = Density
metric = PSI
weighted = False

This chart is from an assay baseline generated from a set of numpy values.

assay_baseline_run_from_numpy.chart()
baseline mean = 539895.6332000002
baseline median = 450283.79
bin_mode = Quantile
aggregation = Density
metric = PSI
weighted = False

Baseline DataFrame

The method wallaroo.assay_config.AssayBuilder.baseline_dataframe returns a DataFrame of the assay baseline generated from the provided parameters. This includes:

  • metadata: The inference metadata with the model information, inference time, and other related factors.
  • in data: Each input field assigned with the label in.{input field name}.
  • out data: Each output field assigned with the label out.{output field name}

Note that for assays generated from numpy values, there is only the out data based on the supplied baseline data.

In the following example, the baseline DataFrame is retrieved.

This baseline DataFrame is from an assay baseline generated from a set of inferences across a range of dates.

display(assay_baseline_from_dates.baseline_dataframe())
timemetadatainput_tensor_0input_tensor_1input_tensor_2input_tensor_3input_tensor_4input_tensor_5input_tensor_6input_tensor_7input_tensor_8input_tensor_9input_tensor_10input_tensor_11input_tensor_12input_tensor_13input_tensor_14input_tensor_15input_tensor_16input_tensor_17output_variable_0
01729266681362{'last_model': '{"model_name":"house-price-estimator","model_sha":"e22a0831aafd9917f3cc87a15ed267797f80e2afa12ad7d8810ca58f173b8cc6"}', 'pipeline_version': 'ba6b344c-83a0-4308-bc62-f198f8af8a5d', 'elapsed': [2131469, 3616390], 'dropped': [], 'partition': 'engine-67d6ff94cb-mtn8m'}3.01.001030.03000.01.00.00.03.07.0830.0200.047.681301-122.3170011830.03000.090.00.00.04.508677e+05
11729266681362{'last_model': '{"model_name":"house-price-estimator","model_sha":"e22a0831aafd9917f3cc87a15ed267797f80e2afa12ad7d8810ca58f173b8cc6"}', 'pipeline_version': 'ba6b344c-83a0-4308-bc62-f198f8af8a5d', 'elapsed': [2131469, 3616390], 'dropped': [], 'partition': 'engine-67d6ff94cb-mtn8m'}4.04.253500.08750.01.00.04.05.09.02140.01360.047.722198-122.3669973110.08750.063.00.00.01.140734e+06
21729266681362{'last_model': '{"model_name":"house-price-estimator","model_sha":"e22a0831aafd9917f3cc87a15ed267797f80e2afa12ad7d8810ca58f173b8cc6"}', 'pipeline_version': 'ba6b344c-83a0-4308-bc62-f198f8af8a5d', 'elapsed': [2131469, 3616390], 'dropped': [], 'partition': 'engine-67d6ff94cb-mtn8m'}5.03.003320.05354.02.00.00.03.09.03320.00.047.654202-122.3310012330.04040.011.00.00.09.744853e+05
31729266681362{'last_model': '{"model_name":"house-price-estimator","model_sha":"e22a0831aafd9917f3cc87a15ed267797f80e2afa12ad7d8810ca58f173b8cc6"}', 'pipeline_version': 'ba6b344c-83a0-4308-bc62-f198f8af8a5d', 'elapsed': [2131469, 3616390], 'dropped': [], 'partition': 'engine-67d6ff94cb-mtn8m'}4.03.503660.04903.02.00.00.03.09.02760.0900.047.718399-122.1559983630.04992.00.00.00.08.738484e+05
41729266681362{'last_model': '{"model_name":"house-price-estimator","model_sha":"e22a0831aafd9917f3cc87a15ed267797f80e2afa12ad7d8810ca58f173b8cc6"}', 'pipeline_version': 'ba6b344c-83a0-4308-bc62-f198f8af8a5d', 'elapsed': [2131469, 3616390], 'dropped': [], 'partition': 'engine-67d6ff94cb-mtn8m'}2.02.001390.01302.02.00.00.03.07.01390.00.047.308899-122.3300021390.01302.028.00.00.02.492278e+05
..................................................................
4951729266681362{'last_model': '{"model_name":"house-price-estimator","model_sha":"e22a0831aafd9917f3cc87a15ed267797f80e2afa12ad7d8810ca58f173b8cc6"}', 'pipeline_version': 'ba6b344c-83a0-4308-bc62-f198f8af8a5d', 'elapsed': [2131469, 3616390], 'dropped': [], 'partition': 'engine-67d6ff94cb-mtn8m'}1.01.001090.032010.01.00.00.04.06.01090.00.047.692799-121.8700031870.025346.056.00.00.04.444080e+05
4961729266681362{'last_model': '{"model_name":"house-price-estimator","model_sha":"e22a0831aafd9917f3cc87a15ed267797f80e2afa12ad7d8810ca58f173b8cc6"}', 'pipeline_version': 'ba6b344c-83a0-4308-bc62-f198f8af8a5d', 'elapsed': [2131469, 3616390], 'dropped': [], 'partition': 'engine-67d6ff94cb-mtn8m'}3.01.751630.015600.01.00.00.03.07.01630.00.047.680000-122.1650011830.010850.056.00.00.05.596311e+05
4971729266681362{'last_model': '{"model_name":"house-price-estimator","model_sha":"e22a0831aafd9917f3cc87a15ed267797f80e2afa12ad7d8810ca58f173b8cc6"}', 'pipeline_version': 'ba6b344c-83a0-4308-bc62-f198f8af8a5d', 'elapsed': [2131469, 3616390], 'dropped': [], 'partition': 'engine-67d6ff94cb-mtn8m'}2.01.00770.05040.01.00.00.03.05.0770.00.047.596401-122.2990041330.02580.085.00.00.04.486278e+05
4981729266681362{'last_model': '{"model_name":"house-price-estimator","model_sha":"e22a0831aafd9917f3cc87a15ed267797f80e2afa12ad7d8810ca58f173b8cc6"}', 'pipeline_version': 'ba6b344c-83a0-4308-bc62-f198f8af8a5d', 'elapsed': [2131469, 3616390], 'dropped': [], 'partition': 'engine-67d6ff94cb-mtn8m'}5.02.502600.03839.02.00.00.03.07.02600.00.047.432400-122.1449972180.04800.09.00.00.04.006765e+05
4991729266681362{'last_model': '{"model_name":"house-price-estimator","model_sha":"e22a0831aafd9917f3cc87a15ed267797f80e2afa12ad7d8810ca58f173b8cc6"}', 'pipeline_version': 'ba6b344c-83a0-4308-bc62-f198f8af8a5d', 'elapsed': [2131469, 3616390], 'dropped': [], 'partition': 'engine-67d6ff94cb-mtn8m'}3.01.751520.012282.01.00.00.03.08.01220.0300.047.751598-122.2990041860.013500.036.00.00.04.249666e+05

500 rows × 21 columns

This baseline DataFrame is from an assay baseline generated from an array of numpy values.

display(assay_baseline_from_numpy.baseline_dataframe())
output_variable_0
0450867.70
11140733.80
2974485.30
3873848.44
4249227.83
......
495444408.00
496559631.06
497448627.80
498400676.47
499424966.60

500 rows × 1 columns

Baseline Stats

The method wallaroo.assay.AssayAnalysis.baseline_stats() returns a pandas.core.frame.DataFrame of the baseline stats.

The baseline stats for each assay are displayed in the examples below.

This baseline states DataFrame is from an assay baseline generated from a set of inferences across a range of dates.

assay_baseline_run_from_dates.baseline_stats()
Baseline
count500
min236238.671875
max1489624.25
mean539895.63075
median450283.78125
std252708.493978
start2024-10-18T15:50:21.296181+00:00
end2024-10-18T15:51:21.377181+00:00

This baseline states DataFrame is from an assay baseline generated from an array of numpy values.

assay_baseline_run_from_numpy.baseline_stats()
Baseline
count500
min236238.67
max1489624.3
mean539895.6332
median450283.79
std252708.498359
startNone
endNone

Baseline Bins

The method wallaroo.assay.AssayAnalysis.baseline_bins a simple dataframe to with the edge/bin data for a baseline.

These baseline bins DataFrame is from an assay baseline generated from a set of inferences across a range of dates.

assay_baseline_run_from_dates.baseline_bins()
b_edgesb_edge_namesb_aggregated_valuesb_aggregation
02.362387e+05left_outlier0.000Aggregation.DENSITY
13.383579e+05q_200.202Aggregation.DENSITY
24.371780e+05q_400.212Aggregation.DENSITY
35.235762e+05q_600.186Aggregation.DENSITY
47.184457e+05q_800.204Aggregation.DENSITY
51.489624e+06q_1000.196Aggregation.DENSITY
6infright_outlier0.000Aggregation.DENSITY

These baseline bins DataFrame is from an assay baseline generated from an array of numpy values.

assay_baseline_run_from_numpy.baseline_bins()
b_edgesb_edge_namesb_aggregated_valuesb_aggregation
0236238.67left_outlier0.000Aggregation.DENSITY
1338357.88q_200.202Aggregation.DENSITY
2437177.97q_400.212Aggregation.DENSITY
3523576.20q_600.186Aggregation.DENSITY
4718445.70q_800.204Aggregation.DENSITY
51489624.30q_1000.196Aggregation.DENSITY
6infright_outlier0.000Aggregation.DENSITY

Baseline Histogram Chart

The method wallaroo.assay_config.AssayBuilder.baseline_histogram returns a histogram chart of the assay baseline generated from the provided parameters.

These chart is from an assay baseline generated from a set of inferences across a range of dates.

assay_baseline_from_dates.baseline_histogram()

Baseline KDE Chart

The method wallaroo.assay_config.AssayBuilder.baseline_kde returns a Kernel Density Estimation (KDE) chart of the assay baseline generated from the provided parameters.

These chart is from an assay baseline generated from a set of inferences across a range of dates.

assay_baseline_from_dates.baseline_kde()

Baseline ECDF Chart

The method wallaroo.assay_config.AssayBuilder.baseline_ecdf returns a Empirical Cumulative Distribution Function (CDF) chart of the assay baseline generated from the provided parameters.

These chart is from an assay baseline generated from a set of inferences across a range of dates.

assay_baseline_from_dates.baseline_ecdf()

Assay Preview

Now that the baseline is defined, we look at different configuration options and view how the assay baseline and results changes. Once we determine what gives us the best method of determining model drift, we can create the assay.

Analysis List Chart Scores

Analysis List scores show the assay scores for each assay result interval in one chart. Values that are outside of the alert threshold are colored red, while scores within the alert threshold are green.

Assay chart scores are displayed with the method wallaroo.assay.AssayAnalysisList.chart_scores, with ability to display an optional title with the chart. This takes the following parameters:

ParameterTypeDescription
titleString (Optional)The title to assign the chart.
nth_x_tickInteger (Optional) (Default: 4)The density of the x ticks.
startDateTime (Optional)The start time of the chart. If start is set, the parameter end must be set.
endDateTime (Optional)The end time of the chart. If end is set, the parameter start must be set.

The following example shows retrieving the assay results and displaying the chart scores. From our example, we have two windows - the first should be green, and the second is red showing that values were outside the alert threshold.

assay_baseline = wl.build_assay(assay_name="assays from date baseline", 
                                          pipeline=mainpipeline, 
                                          iopath="output variable 0",
                                          baseline_start=assay_baseline_start, 
                                          baseline_end=assay_baseline_end)

# Set the assay parameters

# The end date to gather inference results
assay_baseline.add_run_until(datetime.datetime.now())

# Set the interval and window to one minute each, set the start date for gathering inference results
assay_baseline.window_builder().add_width(minutes=1).add_interval(minutes=1).add_start(assay_window_start)

# build the assay configuration
assay_config = assay_baseline.build()

# perform an interactive run and collect inference data
assay_results = assay_config.interactive_run()

# show the analyses chart
assay_results.chart_scores()

The following chart uses the nth_x_tick setting to space out the x-axis labels further.

# set different nth_x_tick
assay_results.chart_scores(nth_x_tick=10)

Analysis Chart

The method wallaroo.assay.AssayAnalysis.chart() displays a comparison between the baseline and an interval of inference data.

This is compared to the Chart Scores, which is a list of all of the inference data split into intervals, while the Analysis Chart shows the breakdown of one set of inference data against the baseline.

Score from the Analysis List Chart Scores and each element from the Analysis List DataFrame generates

The following fields are included.

FieldTypeDescription
baseline meanFloatThe mean of the baseline values.
window meanFloatThe mean of the window values.
baseline medianFloatThe median of the baseline values.
window medianFloatThe median of the window values.
bin_modeStringThe binning mode used for the assay.
aggregationStringThe aggregation mode used for the assay.
metricStringThe metric mode used for the assay.
weightedBoolWhether the bins were manually weighted.
scoreFloatThe score from the assay window.
scoresList(Float)The score from each assay window bin.
indexInteger/NoneThe window index. Interactive assay runs are None.
# Create the assay baseline
assay_baseline = wl.build_assay(assay_name="assays from date baseline sample", 
                                          pipeline=mainpipeline, 
                                          iopath="output variable 0",
                                          baseline_start=assay_baseline_start, 
                                          baseline_end=assay_baseline_end)

# Set the assay parameters

# The end date to gather inference results
assay_baseline.add_run_until(datetime.datetime.now())

# Set the interval and window to one minute each, set the start date for gathering inference results
assay_baseline.window_builder().add_width(minutes=1).add_interval(minutes=1).add_start(assay_window_start)

# build the assay configuration
assay_config = assay_baseline.build()

# perform an interactive run and collect inference data
assay_results = assay_config.interactive_run()

# display one of the analysis from the total results
assay_results[0].chart()
baseline mean = 539895.63075
window mean = 520529.742265625
baseline median = 450283.78125
window median = 450867.6875
bin_mode = Quantile
aggregation = Density
metric = PSI
weighted = False
score = 0.027998899384779063
scores = [0.0, 0.00031071866653010913, 0.00030773024662236867, 0.002769365409558061, 0.015958199760662362, 0.008652885301406161, 0.0]
index = None

Analysis List DataFrame

wallaroo.assay.AssayAnalysisList.to_dataframe() returns a DataFrame showing the assay results for each window aka individual analysis. This DataFrame contains the following fields:

FieldTypeDescription
assay_idInteger/NoneThe assay id. Only provided from uploaded and executed assays.
nameString/NoneThe name of the assay. Only provided from uploaded and executed assays.
iopathString/NoneThe iopath of the assay. Only provided from uploaded and executed assays.
scoreFloatThe assay score.
startDateTimeThe DateTime start of the assay window.
minFloatThe minimum value in the assay window.
maxFloatThe maximum value in the assay window.
meanFloatThe mean value in the assay window.
medianFloatThe median value in the assay window.
stdFloatThe standard deviation value in the assay window.
warning_thresholdFloat/NoneThe warning threshold of the assay window.
alert_thresholdFloat/NoneThe alert threshold of the assay window.
statusStringThe assay window status. Values are:
  • OK: The score is within accepted thresholds.
  • Warning: The score has triggered the warning_threshold if exists, but not the alert_threshold.
  • Alert: The score has triggered the the alert_threshold.

For this example, the assay analysis list DataFrame is listed.

From this tutorial, we should have 2 windows of dta to look at, each one minute apart. The first window should show status: OK, with the second window with the very large house prices will show status: alert

# Create the assay baseline
assay_baseline = wl.build_assay(assay_name="assays from date baseline", 
                                          pipeline=mainpipeline, 
                                          iopath="output variable 0",
                                          baseline_start=assay_baseline_start, 
                                          baseline_end=assay_baseline_end)

# Set the assay parameters

# The end date to gather inference results
assay_baseline.add_run_until(datetime.datetime.now())

# Set the interval and window to one minute each, set the start date for gathering inference results
assay_baseline.window_builder().add_width(minutes=1).add_interval(minutes=1).add_start(assay_window_start)

# build the assay configuration
assay_config = assay_baseline.build()

# perform an interactive run and collect inference data
assay_results = assay_config.interactive_run()

# display the dataframe from the analyses
assay_results.to_dataframe()
idassay_idassay_nameiopathpipeline_idpipeline_nameworkspace_idworkspace_namescorestartminmaxmeanmedianstdwarning_thresholdalert_thresholdstatus
0NoneNoneassays from date baselineNoneNoneNone0.0279992024-10-18T15:52:21.396951+00:002.362387e+051489624.2505.205297e+054.508677e+05226843.358512None0.25Ok
1NoneNoneassays from date baselineNoneNoneNone0.0168212024-10-18T15:53:21.396951+00:002.362387e+051489624.2505.231229e+054.508677e+05226845.586466None0.25Ok
2NoneNoneassays from date baselineNoneNoneNone0.0101602024-10-18T15:54:21.396951+00:002.362387e+051489624.2505.183006e+054.486278e+05227582.307451None0.25Ok
3NoneNoneassays from date baselineNoneNoneNone0.0246602024-10-18T15:55:21.396951+00:002.362387e+051489624.2505.178753e+054.486278e+05228060.575593None0.25Ok
4NoneNoneassays from date baselineNoneNoneNone0.0264672024-10-18T15:56:21.396951+00:002.362387e+051489624.2505.120811e+054.486278e+05218875.510587None0.25Ok
5NoneNoneassays from date baselineNoneNoneNone0.0129312024-10-18T15:57:21.396951+00:002.362387e+051489624.2505.246340e+054.500488e+05233440.321856None0.25Ok
6NoneNoneassays from date baselineNoneNoneNone0.0237602024-10-18T15:58:21.396951+00:002.362387e+051489624.2505.024677e+054.486278e+05214154.238483None0.25Ok
7NoneNoneassays from date baselineNoneNoneNone0.0148652024-10-18T15:59:21.396951+00:002.362387e+051489624.2505.240553e+054.508677e+05243061.741658None0.25Ok
8NoneNoneassays from date baselineNoneNoneNone0.0476262024-10-18T16:00:21.396951+00:002.362387e+051489624.2505.184981e+054.508677e+05228599.592756None0.25Ok
9NoneNoneassays from date baselineNoneNoneNone0.0145592024-10-18T16:01:21.396951+00:002.362387e+051489624.2505.219783e+054.508677e+05234342.656919None0.25Ok
10NoneNoneassays from date baselineNoneNoneNone8.8694522024-10-18T16:04:21.396951+00:001.514079e+062016006.1251.878114e+061.946438e+06165762.752603None0.25Alert
11NoneNoneassays from date baselineNoneNoneNone8.8694522024-10-18T16:05:21.396951+00:001.514079e+062016006.1251.869432e+061.946438e+06169654.651904None0.25Alert
12NoneNoneassays from date baselineNoneNoneNone8.8694522024-10-18T16:06:21.396951+00:001.514079e+062016006.1251.881715e+061.946438e+06162160.610713None0.25Alert
13NoneNoneassays from date baselineNoneNoneNone8.8694522024-10-18T16:07:21.396951+00:001.514079e+062016006.1251.883215e+061.946438e+06160483.084939None0.25Alert
14NoneNoneassays from date baselineNoneNoneNone8.8694522024-10-18T16:08:21.396951+00:001.514079e+062016006.1251.881695e+061.946438e+06159266.187983None0.25Alert
15NoneNoneassays from date baselineNoneNoneNone8.8694522024-10-18T16:09:21.396951+00:001.514079e+062016006.1251.884403e+061.946438e+06156081.344812None0.25Alert
16NoneNoneassays from date baselineNoneNoneNone8.8694522024-10-18T16:10:21.396951+00:001.514079e+062016006.1251.877560e+061.946438e+06160930.722136None0.25Alert
17NoneNoneassays from date baselineNoneNoneNone8.8694522024-10-18T16:11:21.396951+00:001.514079e+062016006.1251.879128e+061.946438e+06162368.666688None0.25Alert
18NoneNoneassays from date baselineNoneNoneNone8.8694522024-10-18T16:12:21.396951+00:001.514079e+062016006.1251.887236e+061.946438e+06153937.005271None0.25Alert
19NoneNoneassays from date baselineNoneNoneNone8.8694522024-10-18T16:13:21.396951+00:001.514079e+062016006.1251.880186e+061.946438e+06161706.985040None0.25Alert

Analysis List Full DataFrame

wallaroo.assay.AssayAnalysisList.to_full_dataframe() returns a DataFrame showing all values, including the inputs and outputs from the assay results for each window aka individual analysis. This DataFrame contains the following fields:

pipeline_id	warning_threshold	bin_index	created_at
FieldTypeDescription
window_startDateTimeThe date and time when the window period began.
analyzed_atDateTimeThe date and time when the assay analysis was performed.
elapsed_millisIntegerHow long the analysis took to perform in milliseconds.
baseline_summary_countIntegerThe number of data elements from the baseline.
baseline_summary_minFloatThe minimum value from the baseline summary.
baseline_summary_maxFloatThe maximum value from the baseline summary.
baseline_summary_meanFloatThe mean value of the baseline summary.
baseline_summary_medianFloatThe median value of the baseline summary.
baseline_summary_stdFloatThe standard deviation value of the baseline summary.
baseline_summary_edges_{0…n}FloatThe baseline summary edges for each baseline edge from 0 to number of edges.
summarizer_typeStringThe type of summarizer used for the baseline. See wallaroo.assay_config for other summarizer types.
summarizer_bin_weightsList / NoneIf baseline bin weights were provided, the list of those weights. Otherwise, None.
summarizer_provided_edgesList / NoneIf baseline bin edges were provided, the list of those edges. Otherwise, None.
statusStringThe assay window status. Values are:
  • OK: The score is within accepted thresholds.
  • Warning: The score has triggered the warning_threshold if exists, but not the alert_threshold.
  • Alert: The score has triggered the the alert_threshold.
idInteger/NoneThe id for the window aka analysis. Only provided from uploaded and executed assays.
assay_idInteger/NoneThe assay id. Only provided from uploaded and executed assays.
pipeline_idInteger/NoneThe pipeline id. Only provided from uploaded and executed assays.
warning_thresholdFloatThe warning threshold set for the assay.
warning_thresholdFloatThe warning threshold set for the assay.
bin_indexInteger/NoneThe bin index for the window aka analysis.
created_atDatetime/NoneThe date and time the window aka analysis was generated. Only provided from uploaded and executed assays.

For this example, full DataFrame from an assay preview is generated.

From this tutorial, we should have 2 windows of dta to look at, each one minute apart. The first window should show status: OK, with the second window with the very large house prices will show status: alert

# Create the assay baseline
assay_baseline = wl.build_assay(assay_name="assays from date baseline", 
                                          pipeline=mainpipeline, 
                                          iopath="output variable 0",
                                          baseline_start=assay_baseline_start, 
                                          baseline_end=assay_baseline_end)

# Set the assay parameters

# The end date to gather inference results
assay_baseline.add_run_until(datetime.datetime.now())

# Set the interval and window to one minute each, set the start date for gathering inference results
assay_baseline.window_builder().add_width(minutes=1).add_interval(minutes=1).add_start(assay_window_start)

# build the assay configuration
assay_config = assay_baseline.build()

# perform an interactive run and collect inference data
assay_results = assay_config.interactive_run()

# display the full dataframe from the analyses
assay_results.to_full_dataframe()
window_startanalyzed_atelapsed_millisbaseline_summary_countbaseline_summary_minbaseline_summary_maxbaseline_summary_meanbaseline_summary_medianbaseline_summary_stdbaseline_summary_edges_0baseline_summary_edges_1baseline_summary_edges_2baseline_summary_edges_3baseline_summary_edges_4baseline_summary_edges_5baseline_summary_edges_6baseline_summary_edge_names_0baseline_summary_edge_names_1baseline_summary_edge_names_2baseline_summary_edge_names_3baseline_summary_edge_names_4baseline_summary_edge_names_5baseline_summary_edge_names_6baseline_summary_aggregated_values_0baseline_summary_aggregated_values_1baseline_summary_aggregated_values_2baseline_summary_aggregated_values_3baseline_summary_aggregated_values_4baseline_summary_aggregated_values_5baseline_summary_aggregated_values_6baseline_summary_aggregationbaseline_summary_startbaseline_summary_endwindow_summary_countwindow_summary_minwindow_summary_maxwindow_summary_meanwindow_summary_medianwindow_summary_stdwindow_summary_edges_0window_summary_edges_1window_summary_edges_2window_summary_edges_3window_summary_edges_4window_summary_edges_5window_summary_edges_6window_summary_edge_names_0window_summary_edge_names_1window_summary_edge_names_2window_summary_edge_names_3window_summary_edge_names_4window_summary_edge_names_5window_summary_edge_names_6window_summary_aggregated_values_0window_summary_aggregated_values_1window_summary_aggregated_values_2window_summary_aggregated_values_3window_summary_aggregated_values_4window_summary_aggregated_values_5window_summary_aggregated_values_6window_summary_aggregationwindow_summary_startwindow_summary_endalert_thresholdscorescores_0scores_1scores_2scores_3scores_4scores_5scores_6summarizer_bin_modesummarizer_aggregationsummarizer_metricsummarizer_num_binssummarizer_typesummarizer_bin_weightssummarizer_provided_edgesstatusidassay_idpipeline_idworkspace_idworkspace_namewarning_thresholdbin_indexcreated_at
02024-10-18T15:52:21.396951+00:002024-10-18T16:16:51.372362+00:00118500236238.6718751489624.25539895.63075450283.78125252708.493978236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outlierq_20q_40q_60q_80q_100right_outlier0.00.2020.2120.1860.2040.1960.0Density2024-10-18T15:50:21.296181+00:002024-10-18T15:51:21.377181+00:0010002.362387e+051489624.2505.205297e+054.508677e+05226843.358512236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outliere_3.38e5e_4.37e5e_5.24e5e_7.18e5e_1.49e6right_outlier0.00.2100.2040.1640.2650.1570.0Density2024-10-18T15:52:21.396951+00:002024-10-18T15:53:21.396951+00:000.250.0279990.00.0003110.0003080.0027690.0159580.0086530.000000QuantileDensityPSI5UnivariateContinuousNoneNoneOkNoneNoneNoneNoneNoneNoneNoneNone
12024-10-18T15:53:21.396951+00:002024-10-18T16:16:51.372433+00:00174500236238.6718751489624.25539895.63075450283.78125252708.493978236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outlierq_20q_40q_60q_80q_100right_outlier0.00.2020.2120.1860.2040.1960.0Density2024-10-18T15:50:21.296181+00:002024-10-18T15:51:21.377181+00:0010002.362387e+051489624.2505.231229e+054.508677e+05226845.586466236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outliere_3.38e5e_4.37e5e_5.24e5e_7.18e5e_1.49e6right_outlier0.00.2000.2190.1720.2480.1610.0Density2024-10-18T15:53:21.396951+00:002024-10-18T15:54:21.396951+00:000.250.0168210.00.0000200.0002270.0010960.0085940.0068850.000000QuantileDensityPSI5UnivariateContinuousNoneNoneOkNoneNoneNoneNoneNoneNoneNoneNone
22024-10-18T15:54:21.396951+00:002024-10-18T16:16:51.372476+00:00186500236238.6718751489624.25539895.63075450283.78125252708.493978236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outlierq_20q_40q_60q_80q_100right_outlier0.00.2020.2120.1860.2040.1960.0Density2024-10-18T15:50:21.296181+00:002024-10-18T15:51:21.377181+00:0010002.362387e+051489624.2505.183006e+054.486278e+05227582.307451236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outliere_3.38e5e_4.37e5e_5.24e5e_7.18e5e_1.49e6right_outlier0.00.2180.2200.1620.2270.1730.0Density2024-10-18T15:54:21.396951+00:002024-10-18T15:55:21.396951+00:000.250.0101600.00.0012200.0002960.0033160.0024570.0028710.000000QuantileDensityPSI5UnivariateContinuousNoneNoneOkNoneNoneNoneNoneNoneNoneNoneNone
32024-10-18T15:55:21.396951+00:002024-10-18T16:16:51.372528+00:00195500236238.6718751489624.25539895.63075450283.78125252708.493978236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outlierq_20q_40q_60q_80q_100right_outlier0.00.2020.2120.1860.2040.1960.0Density2024-10-18T15:50:21.296181+00:002024-10-18T15:51:21.377181+00:0010002.362387e+051489624.2505.178753e+054.486278e+05228060.575593236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outliere_3.38e5e_4.37e5e_5.24e5e_7.18e5e_1.49e6right_outlier0.00.2350.1990.1560.2460.1640.0Density2024-10-18T15:55:21.396951+00:002024-10-18T15:56:21.396951+00:000.250.0246600.00.0049930.0008230.0052770.0078630.0057040.000000QuantileDensityPSI5UnivariateContinuousNoneNoneOkNoneNoneNoneNoneNoneNoneNoneNone
42024-10-18T15:56:21.396951+00:002024-10-18T16:16:51.372569+00:00182500236238.6718751489624.25539895.63075450283.78125252708.493978236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outlierq_20q_40q_60q_80q_100right_outlier0.00.2020.2120.1860.2040.1960.0Density2024-10-18T15:50:21.296181+00:002024-10-18T15:51:21.377181+00:0010002.362387e+051489624.2505.120811e+054.486278e+05218875.510587236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outliere_3.38e5e_4.37e5e_5.24e5e_7.18e5e_1.49e6right_outlier0.00.2190.2060.1800.2500.1450.0Density2024-10-18T15:56:21.396951+00:002024-10-18T15:57:21.396951+00:000.250.0264670.00.0013740.0001720.0001970.0093540.0153700.000000QuantileDensityPSI5UnivariateContinuousNoneNoneOkNoneNoneNoneNoneNoneNoneNoneNone
52024-10-18T15:57:21.396951+00:002024-10-18T16:16:51.372633+00:00200500236238.6718751489624.25539895.63075450283.78125252708.493978236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outlierq_20q_40q_60q_80q_100right_outlier0.00.2020.2120.1860.2040.1960.0Density2024-10-18T15:50:21.296181+00:002024-10-18T15:51:21.377181+00:0010002.362387e+051489624.2505.246340e+054.500488e+05233440.321856236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outliere_3.38e5e_4.37e5e_5.24e5e_7.18e5e_1.49e6right_outlier0.00.2090.2160.1620.2410.1720.0Density2024-10-18T15:57:21.396951+00:002024-10-18T15:58:21.396951+00:000.250.0129310.00.0002380.0000750.0033160.0061670.0031350.000000QuantileDensityPSI5UnivariateContinuousNoneNoneOkNoneNoneNoneNoneNoneNoneNoneNone
62024-10-18T15:58:21.396951+00:002024-10-18T16:16:51.372689+00:00223500236238.6718751489624.25539895.63075450283.78125252708.493978236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outlierq_20q_40q_60q_80q_100right_outlier0.00.2020.2120.1860.2040.1960.0Density2024-10-18T15:50:21.296181+00:002024-10-18T15:51:21.377181+00:0010002.362387e+051489624.2505.024677e+054.486278e+05214154.238483236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outliere_3.38e5e_4.37e5e_5.24e5e_7.18e5e_1.49e6right_outlier0.00.2280.2380.1610.2230.1500.0Density2024-10-18T15:58:21.396951+00:002024-10-18T15:59:21.396951+00:000.250.0237600.00.0031480.0030080.0036090.0016920.0123040.000000QuantileDensityPSI5UnivariateContinuousNoneNoneOkNoneNoneNoneNoneNoneNoneNoneNone
72024-10-18T15:59:21.396951+00:002024-10-18T16:16:51.372769+00:00204500236238.6718751489624.25539895.63075450283.78125252708.493978236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outlierq_20q_40q_60q_80q_100right_outlier0.00.2020.2120.1860.2040.1960.0Density2024-10-18T15:50:21.296181+00:002024-10-18T15:51:21.377181+00:0010002.362387e+051489624.2505.240553e+054.508677e+05243061.741658236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outliere_3.38e5e_4.37e5e_5.24e5e_7.18e5e_1.49e6right_outlier0.00.2270.2050.1600.2360.1720.0Density2024-10-18T15:59:21.396951+00:002024-10-18T16:00:21.396951+00:000.250.0148650.00.0029170.0002350.0039150.0046630.0031350.000000QuantileDensityPSI5UnivariateContinuousNoneNoneOkNoneNoneNoneNoneNoneNoneNoneNone
82024-10-18T16:00:21.396951+00:002024-10-18T16:16:51.372832+00:00209500236238.6718751489624.25539895.63075450283.78125252708.493978236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outlierq_20q_40q_60q_80q_100right_outlier0.00.2020.2120.1860.2040.1960.0Density2024-10-18T15:50:21.296181+00:002024-10-18T15:51:21.377181+00:0010002.362387e+051489624.2505.184981e+054.508677e+05228599.592756236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outliere_3.38e5e_4.37e5e_5.24e5e_7.18e5e_1.49e6right_outlier0.00.2280.2070.1400.2730.1520.0Density2024-10-18T16:00:21.396951+00:002024-10-18T16:01:21.396951+00:000.250.0476260.00.0031480.0001190.0130690.0201030.0111860.000000QuantileDensityPSI5UnivariateContinuousNoneNoneOkNoneNoneNoneNoneNoneNoneNoneNone
92024-10-18T16:01:21.396951+00:002024-10-18T16:16:51.372884+00:00213500236238.6718751489624.25539895.63075450283.78125252708.493978236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outlierq_20q_40q_60q_80q_100right_outlier0.00.2020.2120.1860.2040.1960.0Density2024-10-18T15:50:21.296181+00:002024-10-18T15:51:21.377181+00:0010002.362387e+051489624.2505.219783e+054.508677e+05234342.656919236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outliere_3.38e5e_4.37e5e_5.24e5e_7.18e5e_1.49e6right_outlier0.00.2180.2050.1690.2420.1660.0Density2024-10-18T16:01:21.396951+00:002024-10-18T16:02:21.396951+00:000.250.0145590.00.0012200.0002350.0016290.0064910.0049840.000000QuantileDensityPSI5UnivariateContinuousNoneNoneOkNoneNoneNoneNoneNoneNoneNoneNone
102024-10-18T16:04:21.396951+00:002024-10-18T16:16:51.373043+00:00217500236238.6718751489624.25539895.63075450283.78125252708.493978236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outlierq_20q_40q_60q_80q_100right_outlier0.00.2020.2120.1860.2040.1960.0Density2024-10-18T15:50:21.296181+00:002024-10-18T15:51:21.377181+00:0010001.514079e+062016006.1251.878114e+061.946438e+06165762.752603236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outliere_3.38e5e_4.37e5e_5.24e5e_7.18e5e_1.49e6right_outlier0.00.0000.0000.0000.0000.0001.0Density2024-10-18T16:04:21.396951+00:002024-10-18T16:05:21.396951+00:000.258.8694520.00.7286690.7756600.6545520.7380280.7007175.271826QuantileDensityPSI5UnivariateContinuousNoneNoneAlertNoneNoneNoneNoneNoneNoneNoneNone
112024-10-18T16:05:21.396951+00:002024-10-18T16:16:51.373090+00:00227500236238.6718751489624.25539895.63075450283.78125252708.493978236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outlierq_20q_40q_60q_80q_100right_outlier0.00.2020.2120.1860.2040.1960.0Density2024-10-18T15:50:21.296181+00:002024-10-18T15:51:21.377181+00:0010001.514079e+062016006.1251.869432e+061.946438e+06169654.651904236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outliere_3.38e5e_4.37e5e_5.24e5e_7.18e5e_1.49e6right_outlier0.00.0000.0000.0000.0000.0001.0Density2024-10-18T16:05:21.396951+00:002024-10-18T16:06:21.396951+00:000.258.8694520.00.7286690.7756600.6545520.7380280.7007175.271826QuantileDensityPSI5UnivariateContinuousNoneNoneAlertNoneNoneNoneNoneNoneNoneNoneNone
122024-10-18T16:06:21.396951+00:002024-10-18T16:16:51.373140+00:00237500236238.6718751489624.25539895.63075450283.78125252708.493978236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outlierq_20q_40q_60q_80q_100right_outlier0.00.2020.2120.1860.2040.1960.0Density2024-10-18T15:50:21.296181+00:002024-10-18T15:51:21.377181+00:0010001.514079e+062016006.1251.881715e+061.946438e+06162160.610713236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outliere_3.38e5e_4.37e5e_5.24e5e_7.18e5e_1.49e6right_outlier0.00.0000.0000.0000.0000.0001.0Density2024-10-18T16:06:21.396951+00:002024-10-18T16:07:21.396951+00:000.258.8694520.00.7286690.7756600.6545520.7380280.7007175.271826QuantileDensityPSI5UnivariateContinuousNoneNoneAlertNoneNoneNoneNoneNoneNoneNoneNone
132024-10-18T16:07:21.396951+00:002024-10-18T16:16:51.373182+00:00232500236238.6718751489624.25539895.63075450283.78125252708.493978236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outlierq_20q_40q_60q_80q_100right_outlier0.00.2020.2120.1860.2040.1960.0Density2024-10-18T15:50:21.296181+00:002024-10-18T15:51:21.377181+00:0010001.514079e+062016006.1251.883215e+061.946438e+06160483.084939236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outliere_3.38e5e_4.37e5e_5.24e5e_7.18e5e_1.49e6right_outlier0.00.0000.0000.0000.0000.0001.0Density2024-10-18T16:07:21.396951+00:002024-10-18T16:08:21.396951+00:000.258.8694520.00.7286690.7756600.6545520.7380280.7007175.271826QuantileDensityPSI5UnivariateContinuousNoneNoneAlertNoneNoneNoneNoneNoneNoneNoneNone
142024-10-18T16:08:21.396951+00:002024-10-18T16:16:51.373237+00:00242500236238.6718751489624.25539895.63075450283.78125252708.493978236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outlierq_20q_40q_60q_80q_100right_outlier0.00.2020.2120.1860.2040.1960.0Density2024-10-18T15:50:21.296181+00:002024-10-18T15:51:21.377181+00:0010001.514079e+062016006.1251.881695e+061.946438e+06159266.187983236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outliere_3.38e5e_4.37e5e_5.24e5e_7.18e5e_1.49e6right_outlier0.00.0000.0000.0000.0000.0001.0Density2024-10-18T16:08:21.396951+00:002024-10-18T16:09:21.396951+00:000.258.8694520.00.7286690.7756600.6545520.7380280.7007175.271826QuantileDensityPSI5UnivariateContinuousNoneNoneAlertNoneNoneNoneNoneNoneNoneNoneNone
152024-10-18T16:09:21.396951+00:002024-10-18T16:16:51.373288+00:00251500236238.6718751489624.25539895.63075450283.78125252708.493978236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outlierq_20q_40q_60q_80q_100right_outlier0.00.2020.2120.1860.2040.1960.0Density2024-10-18T15:50:21.296181+00:002024-10-18T15:51:21.377181+00:0010001.514079e+062016006.1251.884403e+061.946438e+06156081.344812236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outliere_3.38e5e_4.37e5e_5.24e5e_7.18e5e_1.49e6right_outlier0.00.0000.0000.0000.0000.0001.0Density2024-10-18T16:09:21.396951+00:002024-10-18T16:10:21.396951+00:000.258.8694520.00.7286690.7756600.6545520.7380280.7007175.271826QuantileDensityPSI5UnivariateContinuousNoneNoneAlertNoneNoneNoneNoneNoneNoneNoneNone
162024-10-18T16:10:21.396951+00:002024-10-18T16:16:51.373330+00:00163500236238.6718751489624.25539895.63075450283.78125252708.493978236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outlierq_20q_40q_60q_80q_100right_outlier0.00.2020.2120.1860.2040.1960.0Density2024-10-18T15:50:21.296181+00:002024-10-18T15:51:21.377181+00:0010001.514079e+062016006.1251.877560e+061.946438e+06160930.722136236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outliere_3.38e5e_4.37e5e_5.24e5e_7.18e5e_1.49e6right_outlier0.00.0000.0000.0000.0000.0001.0Density2024-10-18T16:10:21.396951+00:002024-10-18T16:11:21.396951+00:000.258.8694520.00.7286690.7756600.6545520.7380280.7007175.271826QuantileDensityPSI5UnivariateContinuousNoneNoneAlertNoneNoneNoneNoneNoneNoneNoneNone
172024-10-18T16:11:21.396951+00:002024-10-18T16:16:51.373376+00:00256500236238.6718751489624.25539895.63075450283.78125252708.493978236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outlierq_20q_40q_60q_80q_100right_outlier0.00.2020.2120.1860.2040.1960.0Density2024-10-18T15:50:21.296181+00:002024-10-18T15:51:21.377181+00:0010001.514079e+062016006.1251.879128e+061.946438e+06162368.666688236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outliere_3.38e5e_4.37e5e_5.24e5e_7.18e5e_1.49e6right_outlier0.00.0000.0000.0000.0000.0001.0Density2024-10-18T16:11:21.396951+00:002024-10-18T16:12:21.396951+00:000.258.8694520.00.7286690.7756600.6545520.7380280.7007175.271826QuantileDensityPSI5UnivariateContinuousNoneNoneAlertNoneNoneNoneNoneNoneNoneNoneNone
182024-10-18T16:12:21.396951+00:002024-10-18T16:16:51.373421+00:00261500236238.6718751489624.25539895.63075450283.78125252708.493978236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outlierq_20q_40q_60q_80q_100right_outlier0.00.2020.2120.1860.2040.1960.0Density2024-10-18T15:50:21.296181+00:002024-10-18T15:51:21.377181+00:0010001.514079e+062016006.1251.887236e+061.946438e+06153937.005271236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outliere_3.38e5e_4.37e5e_5.24e5e_7.18e5e_1.49e6right_outlier0.00.0000.0000.0000.0000.0001.0Density2024-10-18T16:12:21.396951+00:002024-10-18T16:13:21.396951+00:000.258.8694520.00.7286690.7756600.6545520.7380280.7007175.271826QuantileDensityPSI5UnivariateContinuousNoneNoneAlertNoneNoneNoneNoneNoneNoneNoneNone
192024-10-18T16:13:21.396951+00:002024-10-18T16:16:51.373471+00:00246500236238.6718751489624.25539895.63075450283.78125252708.493978236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outlierq_20q_40q_60q_80q_100right_outlier0.00.2020.2120.1860.2040.1960.0Density2024-10-18T15:50:21.296181+00:002024-10-18T15:51:21.377181+00:0010001.514079e+062016006.1251.880186e+061.946438e+06161706.985040236238.671875338357.875437177.96875523576.1875718445.68751489624.25Noneleft_outliere_3.38e5e_4.37e5e_5.24e5e_7.18e5e_1.49e6right_outlier0.00.0000.0000.0000.0000.0001.0Density2024-10-18T16:13:21.396951+00:002024-10-18T16:14:21.396951+00:000.258.8694520.00.7286690.7756600.6545520.7380280.7007175.271826QuantileDensityPSI5UnivariateContinuousNoneNoneAlertNoneNoneNoneNoneNoneNoneNoneNone

Analysis Compare Basic Stats

The method wallaroo.assay.AssayAnalysis.compare_basic_stats returns a DataFrame comparing one set of inference data against the baseline.

This is compared to the Analysis List DataFrame, which is a list of all of the inference data split into intervals, while the Analysis Compare Basic Stats shows the breakdown of one set of inference data against the baseline.

# Create the assay baseline
assay_baseline = wl.build_assay(assay_name="assays from date baseline", 
                                          pipeline=mainpipeline, 
                                          iopath="output variable 0",
                                          baseline_start=assay_baseline_start, 
                                          baseline_end=assay_baseline_end)

# Set the assay parameters

# The end date to gather inference results
assay_baseline.add_run_until(datetime.datetime.now())

# Set the interval and window to one minute each, set the start date for gathering inference results
assay_baseline.window_builder().add_width(minutes=1).add_interval(minutes=1).add_start(assay_window_start)

# build the assay configuration
assay_config = assay_baseline.build()

# perform an interactive run and collect inference data
assay_results = assay_config.interactive_run()

# display one analysis against the baseline
assay_results[0].compare_basic_stats()
BaselineWindowdiffpct_diff
count500.01000.0500.000000100.000000
min236238.671875236238.6718750.0000000.000000
max1489624.251489624.250.0000000.000000
mean539895.63075520529.742266-19365.888484-3.586969
median450283.78125450867.6875583.9062500.129675
std252708.493978226843.358512-25865.135466-10.235167
start2024-10-18T15:50:21.296181+00:002024-10-18T15:52:21.396951+00:00NaNNaN
end2024-10-18T15:51:21.377181+00:002024-10-18T15:53:21.396951+00:00NaNNaN

Configure Assays

Before creating the assay, configure the assay and continue to preview it until the best method for detecting drift is set. The following options are available.

Inference Interval and Inference Width

The inference interval aka window interval sets how often to run the assay analysis. This is set from the wallaroo.assay_config.AssayBuilder.window_builder.add_interval method to collect data expressed in time units: “hours=24”, “minutes=1”, etc.

For example, with an interval of 1 minute, the assay collects data every minute. Within an hour, 60 intervals of data is collected.

We can adjust the interval and see how the assays change based on how frequently they are run.

The width sets the time period from the wallaroo.assay_config.AssayBuilder.window_builder.add_width method to collect data expressed in time units: “hours=24”, “minutes=1”, etc.

For example, an interval of 1 minute and a width of 1 minute collects 1 minutes worth of data every minute. An interval of 1 minute with a width of 5 minutes collects 5 minute of inference data every minute.

By default, the interval and width is 24 hours.

For this example, we’ll adjust the width and interval from 1 minute to 5 minutes and see how the number of analyses and their score changes.

# Create the assay baseline
assay_baseline = wl.build_assay(assay_name="assays from date baseline", 
                                          pipeline=mainpipeline, 
                                          iopath="output variable 0",
                                          baseline_start=assay_baseline_start, 
                                          baseline_end=assay_baseline_end)

# Set the assay parameters

# The end date to gather inference results
assay_baseline.add_run_until(datetime.datetime.now())

# Set the interval and window to one minute each, set the start date for gathering inference results
assay_baseline.window_builder().add_width(minutes=1).add_interval(minutes=1).add_start(assay_window_start)

# build the assay configuration
assay_config = assay_baseline.build()

# perform an interactive run and collect inference data
assay_results = assay_config.interactive_run()

# show the analyses chart
assay_results.chart_scores()
wl.get_current_workspace()
{'name': 'assay-demonstration-tutorial-2', 'id': 11, 'archived': False, 'created_by': '3eeab554-fc2e-41ac-8b4e-0d778e8a471b', 'created_at': '2024-10-09T19:50:23.231562+00:00', 'models': [{'name': 'house-price-estimator', 'versions': 3, 'owner_id': '""', 'last_update_time': datetime.datetime(2024, 10, 18, 15, 50, 20, 532959, tzinfo=tzutc()), 'created_at': datetime.datetime(2024, 10, 9, 19, 50, 24, 679975, tzinfo=tzutc())}], 'pipelines': [{'name': 'assay-demonstration-tutorial', 'create_time': datetime.datetime(2024, 10, 9, 19, 50, 25, 224073, tzinfo=tzutc()), 'definition': '[]'}]}
# Create the assay baseline
assay_baseline = wl.build_assay(assay_name="assays from date baseline", 
                                          pipeline=mainpipeline, 
                                          iopath="output variable 0",
                                          baseline_start=assay_baseline_start, 
                                          baseline_end=assay_baseline_end)

# Set the assay parameters

# The end date to gather inference results
assay_baseline.add_run_until(datetime.datetime.now())

# Set the interval and window to five minutes each, set the start date for gathering inference results
assay_baseline.window_builder().add_width(minutes=1).add_interval(minutes=1).add_start(assay_window_start)

# build the assay configuration
assay_config = assay_baseline.build()

# perform an interactive run and collect inference data
assay_results = assay_config.interactive_run()

# show the analyses chart
assay_results.chart_scores()
Add Run Until and Add Inference Start

For previewing assays, setting wallaroo.assay_config.AssayBuilder.add_run_until sets the end date and time for collecting inference data. When an assay is uploaded, this setting is no longer valid - assays run at the Inference Interval until the assay is paused.

Setting the wallaroo.assay_config.WindowBuilder.add_start sets the start date and time to collect inference data. When an assay is uploaded, this setting is included, and assay results will be displayed starting from that start date at the Inference Interval until the assay is paused. By default, add_start begins 24 hours after the assay is uploaded unless set in the assay configuration manually.

For the following example, the add_run_until setting is set to datetime.datetime.now() to collect all inference data from assay_window_start up until now, and the second example limits that example to only two minutes of data.

# Create the assay baseline
assay_baseline = wl.build_assay(assay_name="assays from date baseline", 
                                          pipeline=mainpipeline, 
                                          iopath="output variable 0",
                                          baseline_start=assay_baseline_start, 
                                          baseline_end=assay_baseline_end)

# Set the assay parameters

# The end date to gather inference results
assay_baseline.add_run_until(datetime.datetime.now())

# Set the interval and window to one minute each, set the start date for gathering inference results, minus 2 minutes for the period to start gathering analyses
assay_baseline.window_builder().add_width(minutes=1).add_interval(minutes=1).add_start(assay_window_start+datetime.timedelta(seconds=-120))

# build the assay configuration
assay_config = assay_baseline.build()

# perform an interactive run and collect inference data
assay_results = assay_config.interactive_run()

# show the analyses chart
assay_results.chart_scores()
# Create the assay baseline
assay_baseline = wl.build_assay(assay_name="assays from date baseline", 
                                          pipeline=mainpipeline, 
                                          iopath="output variable 0",
                                          baseline_start=assay_baseline_start, 
                                          baseline_end=assay_baseline_end)

# Set the assay parameters

# The end date to gather inference results plus 2 minutes 
assay_baseline_from_dates.add_run_until(assay_window_start+datetime.timedelta(seconds=120))

# Set the interval and window to one minute each
assay_baseline.window_builder().add_width(minutes=1).add_interval(minutes=1).add_start(assay_window_start)

# build the assay configuration
assay_config = assay_baseline.build()

# perform an interactive run and collect inference data
assay_results = assay_config.interactive_run()

# show the analyses chart
assay_results.chart_scores()
Score Metric

The score is a distance between the baseline and the analysis window. The larger the score, the greater the difference between the baseline and the analysis window. The following methods are provided determining the score:

  • PSI (Default) - Population Stability Index (PSI).
  • MAXDIFF: Maximum difference between corresponding bins.
  • SUMDIFF: Mum of differences between corresponding bins.

The metric type used is updated with the wallaroo.assay_config.AssayBuilder.add_metric(metric: wallaroo.assay_config.Metric) method.

The following three charts use each of the metrics. Note how the scores change based on the score type used.

# Create the assay baseline
assay_baseline = wl.build_assay(assay_name="assays from date baseline", 
                                          pipeline=mainpipeline, 
                                          iopath="output variable 0",
                                          baseline_start=assay_baseline_start, 
                                          baseline_end=assay_baseline_end)

# Set the assay parameters

# The end date to gather inference results
assay_baseline.add_run_until(datetime.datetime.now())

# Set the interval and window to one minute each, set the start date for gathering inference results
assay_baseline.window_builder().add_width(minutes=1).add_interval(minutes=1).add_start(assay_window_start)

# set metric PSI mode
assay_baseline.summarizer_builder.add_metric(wallaroo.assay_config.Metric.PSI)

# build the assay configuration
assay_config = assay_baseline.build()

# perform an interactive run and collect inference data
assay_results = assay_config.interactive_run()

# display one analysis from the results
assay_results[0].chart()
baseline mean = 539895.63075
window mean = 520529.742265625
baseline median = 450283.78125
window median = 450867.6875
bin_mode = Quantile
aggregation = Density
metric = PSI
weighted = False
score = 0.027998899384779063
scores = [0.0, 0.00031071866653010913, 0.00030773024662236867, 0.002769365409558061, 0.015958199760662362, 0.008652885301406161, 0.0]
index = None
# Create the assay baseline
assay_baseline = wl.build_assay(assay_name="assays from date baseline", 
                                          pipeline=mainpipeline, 
                                          iopath="output variable 0",
                                          baseline_start=assay_baseline_start, 
                                          baseline_end=assay_baseline_end)

# Set the assay parameters

# The end date to gather inference results
assay_baseline.add_run_until(datetime.datetime.now())

# Set the interval and window to one minute each, set the start date for gathering inference results
assay_baseline.window_builder().add_width(minutes=1).add_interval(minutes=1).add_start(assay_window_start)

# set metric MAXDIFF mode
assay_baseline.summarizer_builder.add_metric(wallaroo.assay_config.Metric.MAXDIFF)

# build the assay configuration
assay_config = assay_baseline.build()

# perform an interactive run and collect inference data
assay_results = assay_config.interactive_run()

# display one analysis from the results
assay_results[0].chart()
baseline mean = 539895.63075
window mean = 520529.742265625
baseline median = 450283.78125
window median = 450867.6875
bin_mode = Quantile
aggregation = Density
metric = MaxDiff
weighted = False
score = 0.061000000000000026
scores = [0.0, 0.00799999999999998, 0.008000000000000007, 0.021999999999999992, 0.061000000000000026, 0.03900000000000001, 0.0]
index = 4
# Create the assay baseline
assay_baseline = wl.build_assay(assay_name="assays from date baseline", 
                                          pipeline=mainpipeline, 
                                          iopath="output variable 0",
                                          baseline_start=assay_baseline_start, 
                                          baseline_end=assay_baseline_end)

# Set the assay parameters

# The end date to gather inference results
assay_baseline.add_run_until(datetime.datetime.now())

# Set the interval and window to one minute each, set the start date for gathering inference results
assay_baseline.window_builder().add_width(minutes=1).add_interval(minutes=1).add_start(assay_window_start)

# set metric SUMDIFF mode
assay_baseline.summarizer_builder.add_metric(wallaroo.assay_config.Metric.SUMDIFF)

# build the assay configuration
assay_config = assay_baseline.build()

# perform an interactive run and collect inference data
assay_results = assay_config.interactive_run()

# display one analysis from the results
assay_results[0].chart()
baseline mean = 539895.63075
window mean = 520529.742265625
baseline median = 450283.78125
window median = 450867.6875
bin_mode = Quantile
aggregation = Density
metric = SumDiff
weighted = False
score = 0.069
scores = [0.0, 0.00799999999999998, 0.008000000000000007, 0.021999999999999992, 0.061000000000000026, 0.03900000000000001, 0.0]
index = None
Alert Threshold

Assay alert thresholds are modified with the wallaroo.assay_config.AssayBuilder.add_alert_threshold(alert_threshold: float) method. By default alert thresholds are 0.1.

The following example updates the alert threshold to 0.5.

# Create the assay baseline
assay_baseline = wl.build_assay(assay_name="assays from date baseline", 
                                          pipeline=mainpipeline, 
                                          iopath="output variable 0",
                                          baseline_start=assay_baseline_start, 
                                          baseline_end=assay_baseline_end)

# Set the assay parameters

# The end date to gather inference results
assay_baseline.add_run_until(datetime.datetime.now())

# Set the interval and window to one minute each, set the start date for gathering inference results
assay_baseline.window_builder().add_width(minutes=1).add_interval(minutes=1).add_start(assay_window_start)

# set the alert threshold
assay_baseline.add_alert_threshold(0.5)

# build the assay configuration
assay_config = assay_baseline.build()

# perform an interactive run and collect inference data
assay_results = assay_config.interactive_run()

# show the analyses with the alert threshold
assay_results.to_dataframe()
idassay_idassay_nameiopathpipeline_idpipeline_nameworkspace_idworkspace_namescorestartminmaxmeanmedianstdwarning_thresholdalert_thresholdstatus
0NoneNoneassays from date baselineNoneNoneNone0.0279992024-10-18T15:52:21.396951+00:002.362387e+051489624.2505.205297e+054.508677e+05226843.358512None0.5Ok
1NoneNoneassays from date baselineNoneNoneNone0.0168212024-10-18T15:53:21.396951+00:002.362387e+051489624.2505.231229e+054.508677e+05226845.586466None0.5Ok
2NoneNoneassays from date baselineNoneNoneNone0.0101602024-10-18T15:54:21.396951+00:002.362387e+051489624.2505.183006e+054.486278e+05227582.307451None0.5Ok
3NoneNoneassays from date baselineNoneNoneNone0.0246602024-10-18T15:55:21.396951+00:002.362387e+051489624.2505.178753e+054.486278e+05228060.575593None0.5Ok
4NoneNoneassays from date baselineNoneNoneNone0.0264672024-10-18T15:56:21.396951+00:002.362387e+051489624.2505.120811e+054.486278e+05218875.510587None0.5Ok
5NoneNoneassays from date baselineNoneNoneNone0.0129312024-10-18T15:57:21.396951+00:002.362387e+051489624.2505.246340e+054.500488e+05233440.321856None0.5Ok
6NoneNoneassays from date baselineNoneNoneNone0.0237602024-10-18T15:58:21.396951+00:002.362387e+051489624.2505.024677e+054.486278e+05214154.238483None0.5Ok
7NoneNoneassays from date baselineNoneNoneNone0.0148652024-10-18T15:59:21.396951+00:002.362387e+051489624.2505.240553e+054.508677e+05243061.741658None0.5Ok
8NoneNoneassays from date baselineNoneNoneNone0.0476262024-10-18T16:00:21.396951+00:002.362387e+051489624.2505.184981e+054.508677e+05228599.592756None0.5Ok
9NoneNoneassays from date baselineNoneNoneNone0.0145592024-10-18T16:01:21.396951+00:002.362387e+051489624.2505.219783e+054.508677e+05234342.656919None0.5Ok
10NoneNoneassays from date baselineNoneNoneNone8.8694522024-10-18T16:04:21.396951+00:001.514079e+062016006.1251.878114e+061.946438e+06165762.752603None0.5Alert
11NoneNoneassays from date baselineNoneNoneNone8.8694522024-10-18T16:05:21.396951+00:001.514079e+062016006.1251.869432e+061.946438e+06169654.651904None0.5Alert
12NoneNoneassays from date baselineNoneNoneNone8.8694522024-10-18T16:06:21.396951+00:001.514079e+062016006.1251.881715e+061.946438e+06162160.610713None0.5Alert
13NoneNoneassays from date baselineNoneNoneNone8.8694522024-10-18T16:07:21.396951+00:001.514079e+062016006.1251.883215e+061.946438e+06160483.084939None0.5Alert
14NoneNoneassays from date baselineNoneNoneNone8.8694522024-10-18T16:08:21.396951+00:001.514079e+062016006.1251.881695e+061.946438e+06159266.187983None0.5Alert
15NoneNoneassays from date baselineNoneNoneNone8.8694522024-10-18T16:09:21.396951+00:001.514079e+062016006.1251.884403e+061.946438e+06156081.344812None0.5Alert
16NoneNoneassays from date baselineNoneNoneNone8.8694522024-10-18T16:10:21.396951+00:001.514079e+062016006.1251.877560e+061.946438e+06160930.722136None0.5Alert
17NoneNoneassays from date baselineNoneNoneNone8.8694522024-10-18T16:11:21.396951+00:001.514079e+062016006.1251.879128e+061.946438e+06162368.666688None0.5Alert
18NoneNoneassays from date baselineNoneNoneNone8.8694522024-10-18T16:12:21.396951+00:001.514079e+062016006.1251.887236e+061.946438e+06153937.005271None0.5Alert
19NoneNoneassays from date baselineNoneNoneNone8.8694522024-10-18T16:13:21.396951+00:001.514079e+062016006.1251.880186e+061.946438e+06161706.985040None0.5Alert
Number of Bins

Number of bins sets how the baseline data is partitioned. The total number of bins includes the set number plus the left_outlier and the right_outlier, so the total number of bins will be the total set + 2.

The number of bins is set with the wallaroo.assay_config.UnivariateContinousSummarizerBuilder.add_num_bins(num_bins: int) method.

# Create the assay baseline
assay_baseline = wl.build_assay(assay_name="assays from date baseline", 
                                          pipeline=mainpipeline, 
                                          iopath="output variable 0",
                                          baseline_start=assay_baseline_start, 
                                          baseline_end=assay_baseline_end)

# Set the assay parameters

# The end date to gather inference results
assay_baseline.add_run_until(datetime.datetime.now())

# Set the interval and window to one minute each, set the start date for gathering inference results
assay_baseline.window_builder().add_width(minutes=1).add_interval(minutes=1).add_start(assay_window_start)

# update number of bins here
assay_baseline.summarizer_builder.add_num_bins(10)

# build the assay configuration
assay_config = assay_baseline.build()

# perform an interactive run and collect inference data
assay_results = assay_config.interactive_run()

# show one analysis with the updated bins
assay_results[0].chart()
baseline mean = 539895.63075
window mean = 520529.742265625
baseline median = 450283.78125
window median = 450867.6875
bin_mode = Quantile
aggregation = Density
metric = PSI
weighted = False
score = 0.05908866707776886
scores = [0.0, 0.005162673110806691, 0.0027300082724922136, 0.001619315394342909, 0.0042755780600660315, 0.0015054510098891697, 0.0012818719788154692, 0.006791725840796723, 0.009249964850087234, 0.0002488075477953185, 0.026223271012677105, 0.0]
index = None
Binning Mode

Binning Mode defines how the bins are separated. Binning modes are modified through the wallaroo.assay_config.UnivariateContinousSummarizerBuilder.add_bin_mode(bin_mode: bin_mode: wallaroo.assay_config.BinMode, edges: Optional[List[float]] = None).

Available bin_mode values from wallaroo.assay_config.Binmode are the following:

  • QUANTILE (Default): Based on percentages. If num_bins is 5 then quintiles so bins are created at the 20%, 40%, 60%, 80% and 100% points.
  • EQUAL: Evenly spaced bins where each bin is set with the formula min - max / num_bins
  • PROVIDED: The user provides the edge points for the bins.

If PROVIDED is supplied, then a List of float values must be provided for the edges parameter that matches the number of bins.

The following examples are used to show how each of the binning modes effects the bins.

# Create the assay baseline
assay_baseline = wl.build_assay(assay_name="assays from date baseline", 
                                          pipeline=mainpipeline, 
                                          iopath="output variable 0",
                                          baseline_start=assay_baseline_start, 
                                          baseline_end=assay_baseline_end)

# Set the assay parameters

# The end date to gather inference results
assay_baseline.add_run_until(datetime.datetime.now())

# Set the interval and window to one minute each, set the start date for gathering inference results
assay_baseline.window_builder().add_width(minutes=1).add_interval(minutes=1).add_start(assay_window_start)

# update binning mode here
assay_baseline.summarizer_builder.add_bin_mode(wallaroo.assay_config.BinMode.QUANTILE)

# build the assay configuration
assay_config = assay_baseline.build()

# perform an interactive run and collect inference data
assay_results = assay_config.interactive_run()

# show one analysis with the updated bins
assay_results[0].chart()
baseline mean = 539895.63075
window mean = 520529.742265625
baseline median = 450283.78125
window median = 450867.6875
bin_mode = Quantile
aggregation = Density
metric = PSI
weighted = False
score = 0.027998899384779063
scores = [0.0, 0.00031071866653010913, 0.00030773024662236867, 0.002769365409558061, 0.015958199760662362, 0.008652885301406161, 0.0]
index = None
# Create the assay baseline
assay_baseline = wl.build_assay(assay_name="assays from date baseline", 
                                          pipeline=mainpipeline, 
                                          iopath="output variable 0",
                                          baseline_start=assay_baseline_start, 
                                          baseline_end=assay_baseline_end)

# Set the assay parameters

# The end date to gather inference results
assay_baseline.add_run_until(datetime.datetime.now())

# Set the interval and window to one minute each, set the start date for gathering inference results
assay_baseline.window_builder().add_width(minutes=1).add_interval(minutes=1).add_start(assay_window_start)

# update binning mode here
assay_baseline.summarizer_builder.add_bin_mode(wallaroo.assay_config.BinMode.EQUAL)

# build the assay configuration
assay_config = assay_baseline.build()

# perform an interactive run and collect inference data
assay_results = assay_config.interactive_run()

# show one analysis with the updated bins
assay_results[0].chart()
baseline mean = 539895.63075
window mean = 520529.742265625
baseline median = 450283.78125
window median = 450867.6875
bin_mode = Equal
aggregation = Density
metric = PSI
weighted = False
score = 0.024337608548999315
scores = [0.0, 0.0004539311540674428, 0.0102623545559447, 0.0015340004581186216, 0.00863998698518399, 0.003447335395684558, 0.0]
index = None

The following example manually sets the bin values.

The values in this dataset run from 200000 to 1500000. We can specify the bins with the BinMode.PROVIDED and specifying a list of floats with the right hand / upper edge of each bin and optionally the lower edge of the smallest bin. If the lowest edge is not specified the threshold for left outliers is taken from the smallest value in the baseline dataset.

# Create the assay baseline
assay_baseline = wl.build_assay(assay_name="assays from date baseline", 
                                          pipeline=mainpipeline, 
                                          iopath="output variable 0",
                                          baseline_start=assay_baseline_start, 
                                          baseline_end=assay_baseline_end)

# Set the assay parameters

# The end date to gather inference results
assay_baseline.add_run_until(datetime.datetime.now())

# Set the interval and window to one minute each, set the start date for gathering inference results
assay_baseline.window_builder().add_width(minutes=1).add_interval(minutes=1).add_start(assay_window_start)

edges = [200000.0, 400000.0, 600000.0, 800000.0, 1500000.0, 2000000.0]

# update binning mode here
assay_baseline.summarizer_builder.add_bin_mode(wallaroo.assay_config.BinMode.PROVIDED, edges)

# build the assay configuration
assay_config = assay_baseline.build()

# perform an interactive run and collect inference data
assay_results = assay_config.interactive_run()

# show one analysis with the updated bins
assay_results[0].chart()
baseline mean = 539895.63075
window mean = 520529.742265625
baseline median = 450283.78125
window median = 450867.6875
bin_mode = Provided
aggregation = Density
metric = PSI
weighted = False
score = 0.022475023501744996
scores = [0.0, 0.0012824905633907766, 0.0004230661205221289, 0.007031010052631133, 0.013738456765200958, 0.0, 0.0]
index = None
Aggregation Options

Assay aggregation options are modified with the wallaroo.assay_config.AssayBuilder.add_aggregation(aggregation: wallaroo.assay_config.Aggregation) method. The following options are provided:

  • Aggregation.DENSITY (Default): Count the number/percentage of values that fall in each bin.
  • Aggregation.CUMULATIVE: Empirical Cumulative Density Function style, which keeps a cumulative count of the values/percentages that fall in each bin.

The following example demonstrate the different results between the two.

# Create the assay baseline
assay_baseline = wl.build_assay(assay_name="assays from date baseline", 
                                          pipeline=mainpipeline, 
                                          iopath="output variable 0",
                                          baseline_start=assay_baseline_start, 
                                          baseline_end=assay_baseline_end)

# Set the assay parameters

# The end date to gather inference results
assay_baseline.add_run_until(datetime.datetime.now())

# Set the interval and window to one minute each, set the start date for gathering inference results
assay_baseline.window_builder().add_width(minutes=1).add_interval(minutes=1).add_start(assay_window_start)

#Aggregation.DENSITY - the default
assay_baseline.summarizer_builder.add_aggregation(wallaroo.assay_config.Aggregation.DENSITY)

# build the assay configuration
assay_config = assay_baseline.build()

# perform an interactive run and collect inference data
assay_results = assay_config.interactive_run()

# show one analysis with the updated bins
assay_results[0].chart()
baseline mean = 539895.63075
window mean = 520529.742265625
baseline median = 450283.78125
window median = 450867.6875
bin_mode = Quantile
aggregation = Density
metric = PSI
weighted = False
score = 0.027998899384779063
scores = [0.0, 0.00031071866653010913, 0.00030773024662236867, 0.002769365409558061, 0.015958199760662362, 0.008652885301406161, 0.0]
index = None
# Create the assay baseline
assay_baseline = wl.build_assay(assay_name="assays from date baseline", 
                                          pipeline=mainpipeline, 
                                          iopath="output variable 0",
                                          baseline_start=assay_baseline_start, 
                                          baseline_end=assay_baseline_end)

# Set the assay parameters

# The end date to gather inference results
assay_baseline.add_run_until(datetime.datetime.now())

# Set the interval and window to one minute each, set the start date for gathering inference results
assay_baseline.window_builder().add_width(minutes=1).add_interval(minutes=1).add_start(assay_window_start)

#Aggregation.CUMULATIVE
assay_baseline.summarizer_builder.add_aggregation(wallaroo.assay_config.Aggregation.CUMULATIVE)

# build the assay configuration
assay_config = assay_baseline.build()

# perform an interactive run and collect inference data
assay_results = assay_config.interactive_run()

# show one analysis with the updated bins
assay_results[0].chart()
baseline mean = 539895.63075
window mean = 520529.742265625
baseline median = 450283.78125
window median = 450867.6875
bin_mode = Quantile
aggregation = Cumulative
metric = PSI
weighted = False
score = 0.06899999999999992
scores = [0.0, 0.00799999999999998, 0.0, 0.02200000000000002, 0.03899999999999992, 0.0, 0.0]
index = None

Create Assay

With the assay previewed and configuration options determined, we officially create it by uploading it to the Wallaroo instance.

Once it is uploaded, the assay runs an analysis based on the window width, interval, and the other settings configured.

Assays are uploaded with the wallaroo.assay_config.upload() method. This uploads the assay into the Wallaroo database with the configurations applied and returns the assay id. Note that assay names must be unique across the Wallaroo instance; attempting to upload an assay with the same name as an existing one will return an error.

wallaroo.assay_config.upload() returns the assay id for the assay.

Typically we would just call wallaroo.assay_config.upload() after configuring the assay. For the example below, we will perform the complete configuration in one window to show all of the configuration steps at once before creating the assay.

# Build the assay, based on the start and end of our baseline time, 
# and tracking the output variable index 0
assay_baseline = wl.build_assay(assay_name="assays from date baseline tutorial samples", 
                                          pipeline=mainpipeline, 
                                          iopath="output variable 0",
                                          baseline_start=assay_baseline_start, 
                                          baseline_end=assay_baseline_end)

# set the width, interval, and assay start date and time
assay_baseline.window_builder().add_width(minutes=1).add_interval(minutes=1).add_start(assay_window_start)

# add other options
assay_baseline.summarizer_builder.add_aggregation(wallaroo.assay_config.Aggregation.CUMULATIVE)
assay_baseline.summarizer_builder.add_metric(wallaroo.assay_config.Metric.MAXDIFF)
assay_baseline.add_alert_threshold(0.5)

assay_id = assay_baseline.upload()

# wait 65 seconds for the first analysis run performed
time.sleep(65)

The assay is now visible through the Wallaroo UI by selecting the workspace, then the pipeline, then Insights.

Get Assay Info

Assay information is retrieved with the wallaroo.client.get_assay_info() which takes the following parameters.

ParameterTypeDescription
assay_idInteger (Required)The numerical id of the assay.
workspace_id(Int) (Optional)The numerical identifier of the workspace to filter by.
workspace_name(String) (Optional)The name of the workspace to filter by.

This returns the following:

ParameterTypeDescription
idIntegerThe numerical id of the assay.
nameStringThe name of the assay.
activeBooleanTrue: The assay is active and generates analyses based on its configuration. False: The assay is disabled and will not generate new analyses.
pipeline_nameStringThe name of the pipeline the assay references.
last_runDateTimeThe date and time the assay last ran.
next_runDateTimeTHe date and time the assay analysis will next run.
alert_thresholdFloatThe alert threshold setting for the assay.
baselineDictThe baseline and settings as set from the assay configuration.
iopathStringThe iopath setting for the assay.
metricStringThe metric setting for the assay.
num_binsIntegerThe number of bins for the assay.
bin_weightsList/NoneThe bin weights used if any.
bin_modeStringThe binning mode used.
workspace_id(Int)The numerical identifier of the workspace the assay is associated with.
workspace_name(String)The name of the workspace the assay is associated with.
display(wl.get_assay_info(assay_id))
idnameactivestatuspipeline_namelast_runnext_runalert_thresholdworkspace_idworkspace_namebaselineiopathmetricnum_binsbin_weightsbin_mode
05assays from date baseline tutorial samplesTrue{"run_at": "2024-10-18T16:36:35.344528612+00:00", "num_ok": 0, "num_warnings": 0, "num_alerts": 0}assay-demonstration-tutorial2024-10-18T16:36:35.344529+00:002024-10-18T16:36:21.396951+00:000.511assay-demonstration-tutorial-2Start:2024-10-18T15:50:21.296181+00:00, End:2024-10-18T15:51:21.377181+00:00output variable 0MaxDiff5NoneQuantile

Get Assay Results

Once an assay is created the assay runs an analysis based on the window width, interval, and the other settings configured.

Assay results are retrieved with the wallaroo.client.get_assay_results method which takes the following parameters:

ParameterTypeDescription
assay_idInteger (Required)The numerical id of the assay.
startDatetime.Datetime (Required)The start date and time of historical data from the pipeline to start analyses from.
endDatetime.Datetime (Required)The end date and time of historical data from the pipeline to limit analyses to.
workspace_id(Int) (Optional)The numerical identifier of the workspace to filter by.
workspace_name(String) (Optional)The name of the workspace to filter by.
  • IMPORTANT NOTE: This process requires that additional historical data is generated from the time the assay is created to when the results are available. To add additional inference data, use the Assay Test Data section above.
assay_results = wl.get_assay_results(assay_id=assay_id,
                     start=(datetime.datetime.now()-datetime.timedelta(days=2)),
                     end=datetime.datetime.now())

# Preview the assay analyses
assay_results.chart_scores()
assay_results[0].chart()
baseline mean = 519725.40603168664
window mean = 1116046.53125
baseline median = 448627.8125
window median = 1116046.53125
bin_mode = Quantile
aggregation = Cumulative
metric = MaxDiff
weighted = False
score = 0.8043912
scores = [0.0, 0.20159680638722555, 0.42115768463073855, 0.6027944111776448, 0.8043912175648703, 0.0, 0.0]
index = 4

List Assays

A list of assays is retrieved with the wallaroo.client.list_assays() method and takes the following parameters:

ParameterTypeDescription
workspace_id(Int) (Optional)The numerical identifier of the workspace to filter by.
workspace_name(String) (Optional)The name of the workspace to filter by.

This returns a list of assays as filtered in reverse chronological order.

ParameterTypeDescription
Assay IdIntegerThe numerical id of the assay.
Assay NameStringThe name of the assay.
ActiveBooleanTrue: The assay is active and generates analyses based on its configuration. False: The assay is disabled and will not generate new analyses.
StatusDictThe status of the assay including the
Warning ThresholdFloat/NoneThe warning threshold if set.
Alert ThresholdFloatThe alert threshold for the assay.
workspace_id(Int)The numerical identifier of the workspace the assay is associated with.
workspace_name(String)The name of the workspace the assay is associated with.

The errors for this method include:

  • If the parameter workspace_id is not an integer.
  • If the parameter workspace_name is not a String.
wl.list_assays()
Assay IDAssay NameActiveStatusWarning ThresholdAlert ThresholdPipeline IDPipeline NameWorkspace IDWorkspace Name
5assays from date baseline tutorial samplesTrue{"run_at": "2024-10-18T16:36:35.344528612+00:00", "num_ok": 0, "num_warnings": 0, "num_alerts": 0}None0.57assay-demonstration-tutorial11assay-demonstration-tutorial-2
3assays from date baseline tutorial sampleTrue{"run_at": "2024-10-17T15:21:19.691968096+00:00", "num_ok": 10, "num_warnings": 0, "num_alerts": 10}None0.516assay-demonstration14assay-demonstration-tutorial
1assays from date baseline tutorial 2True{"run_at": "2024-10-18T16:36:11.506948857+00:00", "num_ok": 0, "num_warnings": 0, "num_alerts": 0}None0.57assay-demonstration-tutorial11assay-demonstration-tutorial-2

Set Assay Active Status

Assays active status is either:

  • True: The assay generates analyses based on the assay configuration.
  • False: The assay will not generate new analyses.

Assays are set to active or not active with the wallaroo.client.set_assay_active which takes the following parameters.

ParameterTypeDescription
assay_idIntegerThe numerical id of the assay.
activeBooleanTrue: The assay status is set to Active. False: The assay status is Not Active.

First we will show the current active status.

In the following, set the assay status to False, then set the assay active status back to True.

display(wl.get_assay_info(assay_id))
idnameactivestatuspipeline_namelast_runnext_runalert_thresholdworkspace_idworkspace_namebaselineiopathmetricnum_binsbin_weightsbin_mode
05assays from date baseline tutorial samplesTrue{"run_at": "2024-10-18T16:36:35.344528612+00:00", "num_ok": 0, "num_warnings": 0, "num_alerts": 0}assay-demonstration-tutorial2024-10-18T16:36:35.344529+00:002024-10-18T16:36:21.396951+00:000.511assay-demonstration-tutorial-2Start:2024-10-18T15:50:21.296181+00:00, End:2024-10-18T15:51:21.377181+00:00output variable 0MaxDiff5NoneQuantile

Now we set the active status to False, and show the assay list to verify it is no longer active.

wl.set_assay_active(assay_id, False)
display(wl.get_assay_info(assay_id))
idnameactivestatuspipeline_namelast_runnext_runalert_thresholdworkspace_idworkspace_namebaselineiopathmetricnum_binsbin_weightsbin_mode
05assays from date baseline tutorial samplesFalse{"run_at": "2024-10-18T16:36:35.344528612+00:00", "num_ok": 0, "num_warnings": 0, "num_alerts": 0}assay-demonstration-tutorial2024-10-18T16:36:35.344529+00:002024-10-18T16:36:21.396951+00:000.511assay-demonstration-tutorial-2Start:2024-10-18T15:50:21.296181+00:00, End:2024-10-18T15:51:21.377181+00:00output variable 0MaxDiff5NoneQuantile

We resume the assay by setting it’s active status to True.

wl.set_assay_active(assay_id, True)
display(wl.get_assay_info(assay_id))
idnameactivestatuspipeline_namelast_runnext_runalert_thresholdworkspace_idworkspace_namebaselineiopathmetricnum_binsbin_weightsbin_mode
05assays from date baseline tutorial samplesTrue{"run_at": "2024-10-18T16:36:35.344528612+00:00", "num_ok": 0, "num_warnings": 0, "num_alerts": 0}assay-demonstration-tutorial2024-10-18T16:36:35.344529+00:002024-10-18T16:36:21.396951+00:000.511assay-demonstration-tutorial-2Start:2024-10-18T15:50:21.296181+00:00, End:2024-10-18T15:51:21.377181+00:00output variable 0MaxDiff5NoneQuantile

Undeploy Main Pipeline

With the examples and tutorial complete, we will undeploy the main pipeline and return the resources back to the Wallaroo instance.

mainpipeline.undeploy()
Waiting for undeployment - this will take up to 45s .................................... ok
nameassay-demonstration-tutorial
created2024-10-09 19:50:25.224073+00:00
last_updated2024-10-18 15:50:20.759830+00:00
deployedFalse
workspace_id11
workspace_nameassay-demonstration-tutorial-2
archx86
accelnone
tags
versionsba6b344c-83a0-4308-bc62-f198f8af8a5d, 0740ad84-a770-4cf9-b1ce-1f45dbe9c1c4, a2494de7-4d3a-428f-a241-9ddff1ae6772, 6ff08bf3-9be8-484c-b35f-cfde42854ad7, 54380aa2-8722-4b80-b511-b494c6f42c4b, b7a878c6-4f62-4e57-843c-23604c38704b
stepshouse-price-estimator
publishedFalse

View Assay Filters

The following examples demonstrate various ways of listing assays and retrieving assay details, with filtering options.

List Assays with Filters

List all assays for workspaces the user is a member of.

wl.list_assays()
Assay IDAssay NameActiveStatusWarning ThresholdAlert ThresholdPipeline IDPipeline NameWorkspace IDWorkspace Name
5assays from date baseline tutorial samplesTrue{"run_at": "2024-10-18T16:36:35.344528612+00:00", "num_ok": 0, "num_warnings": 0, "num_alerts": 0}None0.57assay-demonstration-tutorial11assay-demonstration-tutorial-2
3assays from date baseline tutorial sampleTrue{"run_at": "2024-10-17T15:21:19.691968096+00:00", "num_ok": 10, "num_warnings": 0, "num_alerts": 10}None0.516assay-demonstration14assay-demonstration-tutorial
1assays from date baseline tutorial 2True{"run_at": "2024-10-18T16:36:11.506948857+00:00", "num_ok": 0, "num_warnings": 0, "num_alerts": 0}None0.57assay-demonstration-tutorial11assay-demonstration-tutorial-2

List all assays filtered by workspace id.

wl.list_assays(workspace_id=workspace_id)
Assay IDAssay NameActiveStatusWarning ThresholdAlert ThresholdPipeline IDPipeline NameWorkspace IDWorkspace Name
5assays from date baseline tutorial samplesTrue{"run_at": "2024-10-18T16:36:35.344528612+00:00", "num_ok": 0, "num_warnings": 0, "num_alerts": 0}None0.57assay-demonstration-tutorial11assay-demonstration-tutorial-2
1assays from date baseline tutorial 2True{"run_at": "2024-10-18T16:36:11.506948857+00:00", "num_ok": 0, "num_warnings": 0, "num_alerts": 0}None0.57assay-demonstration-tutorial11assay-demonstration-tutorial-2

List assays filtered by workspace name.

wl.list_assays(workspace_name=workspace_name)
Assay IDAssay NameActiveStatusWarning ThresholdAlert ThresholdPipeline IDPipeline NameWorkspace IDWorkspace Name
5assays from date baseline tutorial samplesTrue{"run_at": "2024-10-18T16:36:35.344528612+00:00", "num_ok": 0, "num_warnings": 0, "num_alerts": 0}None0.57assay-demonstration-tutorial11assay-demonstration-tutorial-2
1assays from date baseline tutorial 2True{"run_at": "2024-10-18T16:36:11.506948857+00:00", "num_ok": 0, "num_warnings": 0, "num_alerts": 0}None0.57assay-demonstration-tutorial11assay-demonstration-tutorial-2

Get Assay Results by Filter

Get assay results.

assay_results = wl.get_assay_results(assay_id=assay_id,
                     start=assay_window_start,
                     end=datetime.datetime.now())

assay_results.chart_scores()

Get assay results filtered by workspace id.

assay_results = wl.get_assay_results(assay_id=assay_id,
                                     workspace_id=workspace_id,
                     start=assay_window_start,
                     end=datetime.datetime.now())

assay_results.chart_scores()

Get assay results filtered by workspace name.

assay_results = wl.get_assay_results(assay_id=assay_id,
                                     workspace_name=workspace_name,
                     start=assay_window_start,
                     end=datetime.datetime.now())

assay_results.chart_scores()

Get Assay Info with Filter

Get assay info.

wl.get_assay_info(assay_id=assay_id)
idnameactivestatuspipeline_namelast_runnext_runalert_thresholdworkspace_idworkspace_namebaselineiopathmetricnum_binsbin_weightsbin_mode
05assays from date baseline tutorial samplesTrue{"run_at": "2024-10-18T16:36:35.344528612+00:00", "num_ok": 0, "num_warnings": 0, "num_alerts": 0}assay-demonstration-tutorial2024-10-18T16:36:35.344529+00:002024-10-18T16:36:21.396951+00:000.511assay-demonstration-tutorial-2Start:2024-10-18T15:50:21.296181+00:00, End:2024-10-18T15:51:21.377181+00:00output variable 0MaxDiff5NoneQuantile

Get assay info filtered by workspace id.

wl.get_assay_info(assay_id=assay_id, 
                 workspace_id=workspace_id)
idnameactivestatuspipeline_namelast_runnext_runalert_thresholdworkspace_idworkspace_namebaselineiopathmetricnum_binsbin_weightsbin_mode
05assays from date baseline tutorial samplesTrue{"run_at": "2024-10-18T16:36:35.344528612+00:00", "num_ok": 0, "num_warnings": 0, "num_alerts": 0}assay-demonstration-tutorial2024-10-18T16:36:35.344529+00:002024-10-18T16:36:21.396951+00:000.511assay-demonstration-tutorial-2Start:2024-10-18T15:50:21.296181+00:00, End:2024-10-18T15:51:21.377181+00:00output variable 0MaxDiff5NoneQuantile

Get assay info filtered by workspace name.

wl.get_assay_info(assay_id=assay_id, 
                 workspace_name=workspace_name)
idnameactivestatuspipeline_namelast_runnext_runalert_thresholdworkspace_idworkspace_namebaselineiopathmetricnum_binsbin_weightsbin_mode
05assays from date baseline tutorial samplesTrue{"run_at": "2024-10-18T16:36:35.344528612+00:00", "num_ok": 0, "num_warnings": 0, "num_alerts": 0}assay-demonstration-tutorial2024-10-18T16:36:35.344529+00:002024-10-18T16:36:21.396951+00:000.511assay-demonstration-tutorial-2Start:2024-10-18T15:50:21.296181+00:00, End:2024-10-18T15:51:21.377181+00:00output variable 0MaxDiff5NoneQuantile