Skip to content

bmel:outlier-count-of

Category: Array & Statistics · Returns: bmel:integer

Signature
bmel:outlier-count-of(array: bmel:array<number>, threshold: bmel:number)

Description

Returns the number of elements in an array that deviate from the mean by more than (threshold x stddev). Uses the z-score method: an element x is an outlier when |x - mean| > threshold x stddev. Typical threshold values: 2.0 (95% range), 2.5 (98.8%), 3.0 (three-sigma rule, 99.7%).

Arguments

Parameter Type Required Description
array bmel:array<number> The array of numeric values to scan for outliers.
threshold bmel:number Number of standard deviations from the mean beyond which a value is considered an outlier (e.g. 2.0, 2.5, or 3.0).

Examples

LLM calls more than 2 standard deviations from the mean latency
bmel:outlier-count-of({createChatCompletion:Response Payload[]}.$.latency_ms, 2)
Runs with any outlier
bmel:outlier-count-of({createChatCompletion:Response Payload[]}.$.latency_ms, 3) > 0

← Back to BMEL Reference