Wallaroo Run Anywhere Model Drift Observability with Assays

How to detect model drift in Wallaroo Run Anywhere deployments.

Run Anywhere Model Insights via the Wallaroo 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 Model Drift Detection with Model Insights 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.
    • For this tutorial, we focus on limiting the locations included in the assay analyses.
  • 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 (Required)The name of the model to monitor.
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.

Baselines are created in one of two ways:

  • 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.
  • Numpy Values: The baseline_data sets the baseline from a provided numpy array.

Define the Baseline Example

This example shows the assay defined from the date ranges from the inferences performed earlier.

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.
model_name"houseprice-predictor" - the model name set during model upload.
iopathThese assays monitor the model’s output field variable at index 0. From this, the iopath setting is "output variable 0".
baseline_startThe start date for inference requests and results to gather for the baseline.
baseline_endThe end date for for inference requests and results to gather for the baseline.

For each of our assays, we will set the time period of inference data to compare against the baseline data.

# Build the assay, based on the start and end of our baseline time, 
# and tracking the output variable index 0
assay_builder_from_dates = wl.build_assay(assay_name="run anywhere from dates", 
                                          pipeline=mainpipeline, 
                                          model_name="house-price-estimator", 
                                          iopath="output variable 0",
                                          baseline_start=assay_baseline_start, 
                                          baseline_end=assay_baseline_end)

# set the width, interval, and time period 
assay_builder_from_dates.add_run_until(datetime.datetime.now())
assay_builder_from_dates.window_builder().add_width(minutes=1).add_interval(minutes=1).add_start(assay_window_start)
assay_config_from_dates = assay_builder_from_dates.build()
assay_results_from_dates = assay_config_from_dates.interactive_run()

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.

display(assay_builder_from_dates.baseline_dataframe())
timemetadatainput_tensor_0input_tensor_1input_tensor_2input_tensor_3input_tensor_4input_tensor_5input_tensor_6input_tensor_7...input_tensor_9input_tensor_10input_tensor_11input_tensor_12input_tensor_13input_tensor_14input_tensor_15input_tensor_16input_tensor_17output_variable_0
01708618266893{'last_model': '{"model_name":"house-price-estimator","model_sha":"e22a0831aafd9917f3cc87a15ed267797f80e2afa12ad7d8810ca58f173b8cc6"}', 'pipeline_version': '', 'elapsed': [75799, 482567], 'dropped': [], 'partition': 'engine-666cd7bdf9-4fsbj'}4.03.003710.020000.02.00.02.05.0...2760.0950.047.669600-122.2610003970.020000.079.00.00.01.514079e+06
11708618327651{'last_model': '{"model_name":"house-price-estimator","model_sha":"e22a0831aafd9917f3cc87a15ed267797f80e2afa12ad7d8810ca58f173b8cc6"}', 'pipeline_version': '', 'elapsed': [4267763, 4778330], 'dropped': [], 'partition': 'engine-666cd7bdf9-4fsbj'}2.01.752770.019700.02.00.00.03.0...1780.0990.047.758099-122.3649982360.09700.031.00.00.05.363712e+05
21708618327651{'last_model': '{"model_name":"house-price-estimator","model_sha":"e22a0831aafd9917f3cc87a15ed267797f80e2afa12ad7d8810ca58f173b8cc6"}', 'pipeline_version': '', 'elapsed': [4267763, 4778330], 'dropped': [], 'partition': 'engine-666cd7bdf9-4fsbj'}2.01.001290.03140.02.00.00.03.0...1290.00.047.697102-122.0260011290.02628.06.00.00.04.005612e+05
31708618327651{'last_model': '{"model_name":"house-price-estimator","model_sha":"e22a0831aafd9917f3cc87a15ed267797f80e2afa12ad7d8810ca58f173b8cc6"}', 'pipeline_version': '', 'elapsed': [4267763, 4778330], 'dropped': [], 'partition': 'engine-666cd7bdf9-4fsbj'}3.01.751540.09154.01.00.00.03.0...1540.00.047.620701-122.0420001990.010273.031.00.00.05.552319e+05
41708618327651{'last_model': '{"model_name":"house-price-estimator","model_sha":"e22a0831aafd9917f3cc87a15ed267797f80e2afa12ad7d8810ca58f173b8cc6"}', 'pipeline_version': '', 'elapsed': [4267763, 4778330], 'dropped': [], 'partition': 'engine-666cd7bdf9-4fsbj'}4.03.255180.019850.02.00.03.03.0...3540.01640.047.562000-122.1620033160.09750.09.00.00.01.295532e+06
..................................................................
4961708618327651{'last_model': '{"model_name":"house-price-estimator","model_sha":"e22a0831aafd9917f3cc87a15ed267797f80e2afa12ad7d8810ca58f173b8cc6"}', 'pipeline_version': '', 'elapsed': [4267763, 4778330], 'dropped': [], 'partition': 'engine-666cd7bdf9-4fsbj'}3.02.752600.012860.01.00.00.03.0...1350.01250.047.695000-121.9179992260.012954.049.00.00.07.032827e+05
4971708618327651{'last_model': '{"model_name":"house-price-estimator","model_sha":"e22a0831aafd9917f3cc87a15ed267797f80e2afa12ad7d8810ca58f173b8cc6"}', 'pipeline_version': '', 'elapsed': [4267763, 4778330], 'dropped': [], 'partition': 'engine-666cd7bdf9-4fsbj'}3.02.502370.04200.02.00.00.03.0...2370.00.047.369900-122.0189972370.04370.01.00.00.03.491028e+05
4981708618327651{'last_model': '{"model_name":"house-price-estimator","model_sha":"e22a0831aafd9917f3cc87a15ed267797f80e2afa12ad7d8810ca58f173b8cc6"}', 'pipeline_version': '', 'elapsed': [4267763, 4778330], 'dropped': [], 'partition': 'engine-666cd7bdf9-4fsbj'}4.01.001750.068841.01.00.00.03.0...1750.00.047.444199-122.0810011550.032799.072.00.00.03.030022e+05
4991708618327651{'last_model': '{"model_name":"house-price-estimator","model_sha":"e22a0831aafd9917f3cc87a15ed267797f80e2afa12ad7d8810ca58f173b8cc6"}', 'pipeline_version': '', 'elapsed': [4267763, 4778330], 'dropped': [], 'partition': 'engine-666cd7bdf9-4fsbj'}2.01.001080.04000.01.00.00.03.0...1080.00.047.690201-122.3870011530.04240.075.00.00.04.486278e+05
5001708618327651{'last_model': '{"model_name":"house-price-estimator","model_sha":"e22a0831aafd9917f3cc87a15ed267797f80e2afa12ad7d8810ca58f173b8cc6"}', 'pipeline_version': '', 'elapsed': [4267763, 4778330], 'dropped': [], 'partition': 'engine-666cd7bdf9-4fsbj'}4.02.001780.019843.01.00.00.03.0...1780.00.047.441399-122.1539992210.013500.052.00.00.03.130960e+05

501 rows × 21 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.

assay_results_from_dates[0].baseline_stats()
Baseline
count501
min236238.671875
max1514079.375
mean513088.885697
median444408.0
std240525.528326
startNone
endNone

Baseline Bins

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

assay_results_from_dates[0].baseline_bins()
b_edgesb_edge_namesb_aggregated_valuesb_aggregation
02.362387e+05left_outlier0.000000Density
13.115368e+05q_200.199601Density
24.213066e+05q_400.199601Density
34.801514e+05q_600.203593Density
47.155301e+05q_800.199601Density
51.514079e+06q_1000.197605Density
6infright_outlier0.000000Density

Baseline Histogram Chart

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

assay_builder_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.

assay_builder_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.

assay_builder_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(title: Optional[str] = None), with ability to display an optional title with the chart.

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.

# Build the assay, based on the start and end of our baseline time, 
# and tracking the output variable index 0
assay_builder_from_dates = wl.build_assay(assay_name="run anywhere from dates", 
                                          pipeline=mainpipeline, 
                                          model_name="house-price-estimator", 
                                          iopath="output variable 0",
                                          baseline_start=assay_baseline_start, 
                                          baseline_end=assay_baseline_end)

# set the width, interval, and time period 
assay_builder_from_dates.add_run_until(datetime.datetime.now())
assay_builder_from_dates.window_builder().add_width(minutes=1).add_interval(minutes=1).add_start(assay_window_start)
assay_config_from_dates = assay_builder_from_dates.build()
assay_results_from_dates = assay_config_from_dates.interactive_run()

assay_results_from_dates.chart_scores()

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.
# Build the assay, based on the start and end of our baseline time, 
# and tracking the output variable index 0
assay_builder_from_dates = wl.build_assay(assay_name="run anywhere from dates", 
                                          pipeline=mainpipeline, 
                                          model_name="house-price-estimator", 
                                          iopath="output variable 0",
                                          baseline_start=assay_baseline_start, 
                                          baseline_end=assay_baseline_end)

# set the width, interval, and time period 
assay_builder_from_dates.add_run_until(datetime.datetime.now())
assay_builder_from_dates.window_builder().add_width(minutes=1).add_interval(minutes=1).add_start(assay_window_start)
assay_config_from_dates = assay_builder_from_dates.build()
assay_results_from_dates = assay_config_from_dates.interactive_run()

assay_results_from_dates[0].chart()
baseline mean = 513088.88569735526
window mean = 523401.741328125
baseline median = 444408.0
window median = 448627.8125
bin_mode = Quantile
aggregation = Density
metric = PSI
weighted = False
score = 0.036723431597836184
scores = [0.0, 0.0054465677587239095, 0.00351406964764097, 0.0011239501647170409, 0.021833837078132627, 0.004805006948621639, 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

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

# set the width, interval, and time period 
assay_builder_from_dates.add_run_until(datetime.datetime.now())
assay_builder_from_dates.window_builder().add_width(minutes=1).add_interval(minutes=1).add_start(assay_window_start)
assay_config_from_dates = assay_builder_from_dates.build()
assay_results_from_dates = assay_config_from_dates.interactive_run()

assay_results_from_dates.to_dataframe()
assay_idnameiopathscorestartminmaxmeanmedianstdwarning_thresholdalert_thresholdstatus
0None0.0367232024-02-22T16:13:07.781924+00:002.362387e+051489624.2505.234017e+054.486278e+05230914.012105None0.25Ok
1None0.0828772024-02-22T16:15:07.781924+00:002.362387e+052016006.1255.473354e+054.815304e+05260871.745557None0.25Ok
2None0.0690162024-02-22T16:20:07.781924+00:002.362387e+052016006.0005.394895e+054.510469e+05264051.044244None0.25Ok
3None8.8685322024-02-22T16:21:07.781924+00:001.514079e+062016006.1251.882197e+061.946438e+06160686.049379None0.25Alert

Configure Assays

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

Location Filter

This tutorial focuses on the assay configuration method wallaroo.assay_config.WindowBuilder.add_location_filter which takes the following parameters.

ParameterTypeDescription
locationsList(String)The list of model deployment locations for the assay.

By default, the locations parameter includes all locations as part of the pipeline. This is seen in the default where no location filter is set, and of the inference data is shown.

# Build the assay, based on the start and end of our baseline time, 
# and tracking the output variable index 0
assay_builder_from_dates = wl.build_assay(assay_name="run anywhere from dates", 
                                          pipeline=mainpipeline, 
                                          model_name="house-price-estimator", 
                                          iopath="output variable 0",
                                          baseline_start=assay_baseline_start, 
                                          baseline_end=assay_baseline_end)

# set the width, interval, and time period
assay_builder_from_dates.add_run_until(datetime.datetime.now())
assay_builder_from_dates.window_builder().add_width(minutes=1).add_interval(minutes=1).add_start(assay_window_start)
assay_config_from_dates = assay_builder_from_dates.build()
assay_results_from_dates = assay_config_from_dates.interactive_run()

assay_results_from_dates.chart_scores()
assay_results_from_dates.to_dataframe()
assay_idnameiopathscorestartminmaxmeanmedianstdwarning_thresholdalert_thresholdstatus
0None0.0367232024-02-22T16:13:07.781924+00:002.362387e+051489624.2505.234017e+054.486278e+05230914.012105None0.25Ok
1None0.0828772024-02-22T16:15:07.781924+00:002.362387e+052016006.1255.473354e+054.815304e+05260871.745557None0.25Ok
2None0.0690162024-02-22T16:20:07.781924+00:002.362387e+052016006.0005.394895e+054.510469e+05264051.044244None0.25Ok
3None8.8685322024-02-22T16:21:07.781924+00:001.514079e+062016006.1251.882197e+061.946438e+06160686.049379None0.25Alert

Now we will set the location to the ops center only pipeline and display the results.

# Build the assay, based on the start and end of our baseline time, 
# and tracking the output variable index 0
assay_builder_from_dates = wl.build_assay(assay_name="run anywhere from dates", 
                                          pipeline=mainpipeline, 
                                          model_name="house-price-estimator", 
                                          iopath="output variable 0",
                                          baseline_start=assay_baseline_start, 
                                          baseline_end=assay_baseline_end)

# set the location to the ops center
assay_builder_from_dates.window_builder().add_location_filter([ops_location])

# set the width, interval, and time period
assay_builder_from_dates.add_run_until(datetime.datetime.now())
assay_builder_from_dates.window_builder().add_width(minutes=1).add_interval(minutes=1).add_start(assay_window_start)
assay_config_from_dates = assay_builder_from_dates.build()
assay_results_from_dates = assay_config_from_dates.interactive_run()

assay_results_from_dates.chart_scores()
assay_results_from_dates.to_dataframe()
assay_idnameiopathscorestartminmaxmeanmedianstdwarning_thresholdalert_thresholdstatus
0None0.0367232024-02-22T16:13:07.781924+00:00236238.6718751489624.250523401.741328448627.812500230914.012105None0.25Ok
1None0.0828772024-02-22T16:15:07.781924+00:00236238.6718752016006.125547335.355203481530.359375260871.745557None0.25Ok

Now we specify only our edge deployment location.

# Build the assay, based on the start and end of our baseline time, 
# and tracking the output variable index 0
assay_builder_from_dates = wl.build_assay(assay_name="run anywhere from dates", 
                                          pipeline=mainpipeline, 
                                          model_name="house-price-estimator", 
                                          iopath="output variable 0",
                                          baseline_start=assay_baseline_start, 
                                          baseline_end=assay_baseline_end)

# set the location to the the edge location
assay_builder_from_dates.window_builder().add_location_filter([edge_name])

# set the width, interval, and time period
assay_builder_from_dates.add_run_until(datetime.datetime.now())
assay_builder_from_dates.window_builder().add_width(minutes=1).add_interval(minutes=1).add_start(assay_window_start)
assay_config_from_dates = assay_builder_from_dates.build()
assay_results_from_dates = assay_config_from_dates.interactive_run()

assay_results_from_dates.chart_scores()
assay_results_from_dates.to_dataframe()
assay_idnameiopathscorestartminmaxmeanmedianstdwarning_thresholdalert_thresholdstatus
0None0.0690162024-02-22T16:20:07.781924+00:002.362387e+052016006.0005.394895e+054.510469e+05264051.044244None0.25Ok
1None8.8685322024-02-22T16:21:07.781924+00:001.514079e+062016006.1251.882197e+061.946438e+06160686.049379None0.25Alert

Now we specify both the Wallaroo Ops deployed pipeline and the edge pipeline.

# Build the assay, based on the start and end of our baseline time, 
# and tracking the output variable index 0
assay_builder_from_dates = wl.build_assay(assay_name="run anywhere from dates", 
                                          pipeline=mainpipeline, 
                                          model_name="house-price-estimator", 
                                          iopath="output variable 0",
                                          baseline_start=assay_baseline_start, 
                                          baseline_end=assay_baseline_end)

# set the location to both the edge location and ops pipeline
assay_builder_from_dates.window_builder().add_location_filter([ops_location, edge_name])

# set the width, interval, and time period
assay_builder_from_dates.add_run_until(datetime.datetime.now())
assay_builder_from_dates.window_builder().add_width(minutes=1).add_interval(minutes=1).add_start(assay_window_start)
assay_config_from_dates = assay_builder_from_dates.build()
assay_results_from_dates = assay_config_from_dates.interactive_run()

assay_results_from_dates.chart_scores()
assay_results_from_dates.to_dataframe()
assay_idnameiopathscorestartminmaxmeanmedianstdwarning_thresholdalert_thresholdstatus
0None0.0367232024-02-22T16:13:07.781924+00:002.362387e+051489624.2505.234017e+054.486278e+05230914.012105None0.25Ok
1None0.0828772024-02-22T16:15:07.781924+00:002.362387e+052016006.1255.473354e+054.815304e+05260871.745557None0.25Ok
2None0.0690162024-02-22T16:20:07.781924+00:002.362387e+052016006.0005.394895e+054.510469e+05264051.044244None0.25Ok
3None8.8685322024-02-22T16:21:07.781924+00:001.514079e+062016006.1251.882197e+061.946438e+06160686.049379None0.25Alert

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, and narrow the locations to only the Wallaroo Ops deployed pipeline and the single edge.

# Build the assay, based on the start and end of our baseline time, 
# and tracking the output variable index 0
assay_builder_from_dates = wl.build_assay(assay_name="run anywhere from dates", 
                                          pipeline=mainpipeline, 
                                          model_name="house-price-estimator", 
                                          iopath="output variable 0",
                                          baseline_start=assay_baseline_start, 
                                          baseline_end=assay_baseline_end)

# set the location to both the edge location and ops pipeline
assay_builder_from_dates.window_builder().add_location_filter([ops_location, edge_name])

# set the width, interval, and time period
assay_builder_from_dates.add_run_until(datetime.datetime.now())
assay_builder_from_dates.window_builder().add_width(minutes=1).add_interval(minutes=1).add_start(assay_window_start)

assay_id = assay_builder_from_dates.upload()

The assay is now visible through the Wallaroo UI by selecting the workspace, then the pipeline, then Insights. The following is an example of another assay in the Wallaroo Dashboard.

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.
  • 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=assay_window_start,
                     end=datetime.datetime.now())

assay_results.chart_scores()
assay_results[0].chart()
baseline mean = 513088.88569735526
window mean = 523401.741328125
baseline median = 444408.0
window median = 448627.8125
bin_mode = Quantile
aggregation = Density
metric = PSI
weighted = False
score = 0.03672343
scores = [0.0, 0.0054465677587239095, 0.00351406964764097, 0.0011239501647170409, 0.021833837078132627, 0.004805006948621639, 0.0]
index = None