moon-change-point

Production-oriented MoonBit change-point detection, streaming windows, multivariate monitoring, replay, SLO and alert routing

change-point
anomaly-detection
time-series
cusum
moon add Zy789kl/moon-change-point@0.2.0
Download zip
Author
Version
0.2.0
License
Apache-2.0
Last updated
9 hours ago
Downloads
2
README

#moon-change-point

面向生产指标的 MoonBit 变点检测库:在线检测、离线分段、迟到数据重排、多变量监控、回放复现、SLO 与告警路由均可组合使用。

#安装与最小用法

moon add Zy789kl/moon-change-point

///|
import {
"Zy789kl/moon-change-point" @cp,
}

///|
fn main {
let detector = @cp.Cusum::new(target_mean=0.0, control_limit=5.0, drift=0.5)
println(detector.update_result(2.0, index=1).summary())
}

#验收验证

固定种子基准可通过 moon run cmd/main 重现;项目包含 410 个边界、回归和集成测试,实现源码超过 8,000 行,并在稳定版 MoonBit 的多平台 CI 中执行格式、检查、构建、接口和测试验证。

#
AdaptiveBaseline

pub struct AdaptiveBaseline {
moments : OnlineMoments
value : Double
learning_rate : Double
initialized : Bool
}

A slowly adapting baseline for streams whose normal level changes over time.

#
AdaptiveBaseline::new

fn AdaptiveBaseline::new(learning_rate? : Double) -> AdaptiveBaseline

#
AdaptiveBaseline::sample_count

fn AdaptiveBaseline::sample_count(self : AdaptiveBaseline) -> Int

#
AdaptiveBaseline::summary

#
AdaptiveBaseline::update

fn AdaptiveBaseline::update(self : AdaptiveBaseline, observation : Double) -> Double

#
AdaptiveBaseline::value

fn AdaptiveBaseline::value(self : AdaptiveBaseline) -> Double

#
AdaptiveThreshold

pub struct AdaptiveThreshold {
threshold : Double
rate : Double
minimum : Double
maximum : Double
count : Int
}

#
AdaptiveThreshold::count

fn AdaptiveThreshold::count(self : AdaptiveThreshold) -> Int

#
AdaptiveThreshold::new

fn AdaptiveThreshold::new(initial? : Double, rate? : Double, minimum? : Double, maximum? : Double) -> AdaptiveThreshold

#
AdaptiveThreshold::observe

fn AdaptiveThreshold::observe(self : AdaptiveThreshold, score : Double, positive : Bool) -> Double

#
AdaptiveThreshold::value

fn AdaptiveThreshold::value(self : AdaptiveThreshold) -> Double

#
AggregationKind

pub(all) enum AggregationKind {
MeanAggregate
SumAggregate
MinimumAggregate
MaximumAggregate
StandardDeviationAggregate
}

Aggregation choices for a fixed streaming window.

#
AlertBudget

pub struct AlertBudget {
capacity : Double
refill : Double
tokens : Double
suppressed : Int
}

#
AlertBudget::allow

fn AlertBudget::allow(self : AlertBudget) -> Bool

#
AlertBudget::new

fn AlertBudget::new(capacity? : Int, refill? : Double) -> AlertBudget

#
AlertBudget::suppressed

fn AlertBudget::suppressed(self : AlertBudget) -> Int

#
AlertBudget::tick

fn AlertBudget::tick(self : AlertBudget) -> Unit

#
AlertEvent

pub struct AlertEvent {
metric : String
point : ChangePoint
suppressed : Bool
ordinal : Int
}

A named alert emitted by a multi-series pipeline.

#
AlertEvent::new

fn AlertEvent::new(metric : String, point : ChangePoint, suppressed? : Bool, ordinal? : Int) -> AlertEvent

Constructs an alert event.

#
AlertPolicy

pub struct AlertPolicy {
minimum_score : Double
minimum_confidence : Double
minimum_gap : Int
recovery_points : Int
quiet_points : Int
healthy_points : Int
}

Controls deduplication, minimum severity, and recovery for one metric.

#
AlertPolicy::accept

fn AlertPolicy::accept(self : AlertPolicy, result : DetectionResult) -> Bool

#
AlertPolicy::minimum_score

fn AlertPolicy::minimum_score(self : AlertPolicy) -> Double

#
AlertPolicy::new

fn AlertPolicy::new(minimum_score? : Double, minimum_confidence? : Double, minimum_gap? : Int, recovery_points? : Int) -> AlertPolicy

#
AlertPolicy::reset

fn AlertPolicy::reset(self : AlertPolicy) -> Unit

#
AlertSeverity

pub(all) enum AlertSeverity {
Informational
Warning
Critical
}

The severity used by alerting integrations.

#
Ar1Forecaster

pub struct Ar1Forecaster {
mean : Double
covariance : Double
variance : Double
previous : Double
count : Int
forgetting : Double
}

#
Ar1Forecaster::new

fn Ar1Forecaster::new(forgetting? : Double) -> Ar1Forecaster

#
Ar1Forecaster::update

fn Ar1Forecaster::update(self : Ar1Forecaster, value : Double) -> ForecastPoint

#
Bayesian

pub struct Bayesian {
hazard_rate : Double
run_length_probs : Array[Double]
mu_t : Array[Double]
kappa_t : Array[Double]
alpha_t : Array[Double]
beta_t : Array[Double]
mu0 : Double
kappa0 : Double
alpha0 : Double
beta0 : Double
max_run_length : Int
}

Bayesian implements a simplified Bayesian Online Change Point Detection using a Normal-Gamma conjugate prior.

#
Bayesian::new

fn Bayesian::new(hazard_rate? : Double, mu0? : Double, kappa0? : Double, alpha0? : Double, beta0? : Double, max_run_length? : Int) -> Bayesian

Creates a new Bayesian Online Change Point Detector.

#
Bayesian::update

fn Bayesian::update(self : Bayesian, value : Double) -> Double

Updates the detector and returns the probability of a change point at the current step.

#
Bayesian::update_result

fn Bayesian::update_result(self : Bayesian, value : Double, index? : Int) -> DetectionResult

Rich result form of the Bayesian update.

#
BenchmarkResult

pub struct BenchmarkResult {
name : String
samples : Int
passes : Int
detections : Int
first_detection : Int
checksum : Double
truth_count : Int
metrics : ChangePointMetrics
}

Results of a deterministic detector benchmark.

#
BenchmarkResult::empty

fn BenchmarkResult::empty(name : String) -> BenchmarkResult

#
BenchmarkResult::summary

fn BenchmarkResult::summary(self : BenchmarkResult) -> String

#
BootstrapEstimate

pub struct BootstrapEstimate {
mean : Double
lower : Double
upper : Double
standard_error : Double
replicates : Int
}

#
ChangeDirection

pub(all) enum ChangeDirection {
Increase
Decrease
VarianceIncrease
VarianceDecrease
DistributionShift
Unknown
}

The direction of a distributional change.

#
ChangePoint

pub struct ChangePoint {
timestamp : Int64
index : Int
score : Double
confidence : Double
severity : AlertSeverity
direction : ChangeDirection
detector : String
baseline : Double
observed : Double
}

A detected change with enough context for a downstream alert or dashboard.

#
ChangePoint::from_result

fn ChangePoint::from_result(point : SignalPoint, result : DetectionResult, detector : String, baseline : Double) -> ChangePoint

Creates a change point from an online result.

#
ChangePoint::summary

fn ChangePoint::summary(self : ChangePoint) -> String

Returns a stable log line for a change point.

#
ChangePointMetrics

pub struct ChangePointMetrics {
true_positives : Int
false_positives : Int
false_negatives : Int
precision : Double
recall : Double
f1 : Double
mean_detection_delay : Double
}

Quality metrics for a set of predicted change indices.

#
ChangePointMetrics::empty

#
ConsecutiveRule

pub struct ConsecutiveRule {
required : Int
hits : Int
misses : Int
}

A debouncer that requires several consecutive positive observations.

#
ConsecutiveRule::hits

fn ConsecutiveRule::hits(self : ConsecutiveRule) -> Int

#
ConsecutiveRule::new

fn ConsecutiveRule::new(required? : Int) -> ConsecutiveRule

#
ConsecutiveRule::push

fn ConsecutiveRule::push(self : ConsecutiveRule, positive : Bool) -> Bool

#
Cusum

pub struct Cusum {
target_mean : Double
control_limit : Double
drift : Double
g_positive : Double
g_negative : Double
t : Int
}

Cusum implements the Cumulative Sum algorithm for detecting shifts in the mean.

#
Cusum::new

fn Cusum::new(target_mean? : Double, control_limit? : Double, drift? : Double) -> Cusum

Creates a new CUSUM detector.

#
Cusum::reset

fn Cusum::reset(self : Cusum) -> Unit

Resets the internal accumulators.

#
Cusum::update

fn Cusum::update(self : Cusum, value : Double) -> Bool

Updates the CUSUM detector with a new value and returns true if a change is detected.

#
Cusum::update_result

fn Cusum::update_result(self : Cusum, value : Double, index? : Int) -> DetectionResult

Rich result form of update, retaining the direction and evidence.

#
DataQualityGate

pub struct DataQualityGate {
minimum_ratio : Double
reject_non_monotonic : Bool
reject_dimension_mismatch : Bool
}

#
DataQualityGate::accept

fn DataQualityGate::accept(self : DataQualityGate, report : QualityReport) -> Bool

#
DataQualityGate::new

fn DataQualityGate::new(minimum_ratio? : Double, reject_non_monotonic? : Bool, reject_dimension_mismatch? : Bool) -> DataQualityGate

#
DetectionExplanation

pub struct DetectionExplanation {
result : DetectionResult
baseline : Double
observed : Double
deviation : Double
relative_change : Double
contributions : Array[EvidenceContribution]
recommendation : String
}

#
DetectionExplanation::empty

fn DetectionExplanation::empty(index? : Int) -> DetectionExplanation

#
DetectionResult

pub struct DetectionResult {
changed : Bool
score : Double
confidence : Double
direction : ChangeDirection
index : Int
evidence : Double
}

A normalized result returned by online and offline detectors.

#
DetectionResult::new

fn DetectionResult::new(changed : Bool, score : Double, confidence : Double, direction : ChangeDirection, index : Int, evidence? : Double) -> DetectionResult

Builds a result while keeping confidence and evidence in a safe range.

#
DetectionResult::quiet

fn DetectionResult::quiet(index? : Int) -> DetectionResult

Returns a result that represents an ordinary observation.

#
DetectionResult::summary

fn DetectionResult::summary(self : DetectionResult) -> String

Produces a compact representation suitable for logs.

#
Detector

pub struct Detector {
detector : DetectorType
suppression_count : Int
suppression_limit : Int
}

Detector wraps a specific algorithm and supports multi-metric alert suppression.

#
Detector::new

fn Detector::new(detector : DetectorType, suppression_limit? : Int) -> Detector

Creates a new multi-metric detector wrapper.

#
Detector::update

fn Detector::update(self : Detector, value : Double) -> Bool

Updates the detector and handles alert suppression. Returns true if an unsuppressed alert is triggered.

#
Detector::update_result

fn Detector::update_result(self : Detector, value : Double, index? : Int) -> DetectionResult

Rich result form of the detector wrapper. Suppression is applied to the change flag only.

#
DetectorSpec

pub struct DetectorSpec {
name : String
family : String
online : Bool
multivariate : Bool
robust : Bool
default_threshold : Double
description : String
}

Public algorithm metadata for dashboards and configuration UIs.

#
DetectorSpec::new

fn DetectorSpec::new(name : String, family : String, online : Bool, multivariate : Bool, robust : Bool, default_threshold : Double, description : String) -> DetectorSpec

#
DetectorSpec::summary

fn DetectorSpec::summary(self : DetectorSpec) -> String

#
DetectorType

pub(all) enum DetectorType {
CusumDetector(Cusum)
PageHinkleyDetector(PageHinkley)
BayesianDetector(Bayesian)
}

DetectorType represents the type of change point detector to use.

#
DeterministicRng

pub struct DeterministicRng {
state : Int64
}

A deterministic pseudo-random source used by benchmarks and reproducible tests.

#
DeterministicRng::new

fn DeterministicRng::new(seed? : Int64) -> DeterministicRng

#
DeterministicRng::next

fn DeterministicRng::next(self : DeterministicRng) -> Int64

#
DeterministicRng::normalish

fn DeterministicRng::normalish(self : DeterministicRng, amplitude? : Double) -> Double

#
DeterministicRng::symmetric

fn DeterministicRng::symmetric(self : DeterministicRng) -> Double

#
DeterministicRng::unit

fn DeterministicRng::unit(self : DeterministicRng) -> Double

#
DistributionShiftDetector

pub struct DistributionShiftDetector {
reference : DoubleWindow
current : DoubleWindow
threshold : Double
index : Int
}

Compares adjacent windows and emits a distribution-shift result.

#
DistributionShiftDetector::new

fn DistributionShiftDetector::new(window_size? : Int, threshold? : Double) -> DistributionShiftDetector

#
DistributionShiftDetector::update

#
DoubleWindow

pub struct DoubleWindow {
capacity : Int
values : Array[Double]
start : Int
length : Int
}

A bounded ring buffer for numeric streaming windows.

#
DoubleWindow::capacity

fn DoubleWindow::capacity(self : DoubleWindow) -> Int

#
DoubleWindow::clear

fn DoubleWindow::clear(self : DoubleWindow) -> Unit

#
DoubleWindow::first

fn DoubleWindow::first(self : DoubleWindow) -> Double?

#
DoubleWindow::get

fn DoubleWindow::get(self : DoubleWindow, index : Int) -> Double?

#
DoubleWindow::is_empty

fn DoubleWindow::is_empty(self : DoubleWindow) -> Bool

#
DoubleWindow::is_full

fn DoubleWindow::is_full(self : DoubleWindow) -> Bool

#
DoubleWindow::last

fn DoubleWindow::last(self : DoubleWindow) -> Double?

#
DoubleWindow::length

fn DoubleWindow::length(self : DoubleWindow) -> Int

#
DoubleWindow::mean

fn DoubleWindow::mean(self : DoubleWindow) -> Double

#
DoubleWindow::median

fn DoubleWindow::median(self : DoubleWindow) -> Double

#
DoubleWindow::new

fn DoubleWindow::new(capacity : Int) -> DoubleWindow

Creates a fixed-capacity window. Non-positive capacities are normalized to one.

#
DoubleWindow::push

fn DoubleWindow::push(self : DoubleWindow, value : Double) -> Double?

Adds a value and returns the value evicted from a full window, if any.

#
DoubleWindow::quantile

fn DoubleWindow::quantile(self : DoubleWindow, probability : Double) -> Double

#
DoubleWindow::slope

fn DoubleWindow::slope(self : DoubleWindow) -> Double

#
DoubleWindow::snapshot

fn DoubleWindow::snapshot(self : DoubleWindow) -> StatsSummary

#
DoubleWindow::standard_deviation

fn DoubleWindow::standard_deviation(self : DoubleWindow) -> Double

#
DoubleWindow::sum

fn DoubleWindow::sum(self : DoubleWindow) -> Double

#
DoubleWindow::to_array

fn DoubleWindow::to_array(self : DoubleWindow) -> Array[Double]

#
DoubleWindow::variance

fn DoubleWindow::variance(self : DoubleWindow) -> Double

#
DualSidedDetector

pub struct DualSidedDetector {
positive : Cusum
negative : Cusum
index : Int
}

#
DualSidedDetector::new

fn DualSidedDetector::new(target? : Double, limit? : Double, drift? : Double) -> DualSidedDetector

#
DualSidedDetector::update

fn DualSidedDetector::update(self : DualSidedDetector, value : Double) -> DetectionResult

#
EnsembleResult

pub struct EnsembleResult {
result : DetectionResult
votes : Int
detector_count : Int
agreement : Double
}

#
EventHistory

pub struct EventHistory {
capacity : Int
events : Array[AlertEvent]
total : Int
}

#
EventHistory::critical_count

fn EventHistory::critical_count(self : EventHistory) -> Int

#
EventHistory::events

fn EventHistory::events(self : EventHistory) -> Array[AlertEvent]

#
EventHistory::latest

fn EventHistory::latest(self : EventHistory) -> AlertEvent?

#
EventHistory::length

fn EventHistory::length(self : EventHistory) -> Int

#
EventHistory::new

fn EventHistory::new(capacity? : Int) -> EventHistory

#
EventHistory::push

fn EventHistory::push(self : EventHistory, event : AlertEvent) -> Unit

#
EventHistory::total

fn EventHistory::total(self : EventHistory) -> Int

#
EventHistory::unsuppressed_count

fn EventHistory::unsuppressed_count(self : EventHistory) -> Int

#
EvidenceContribution

pub struct EvidenceContribution {
name : String
value : Double
weight : Double
contribution : Double
}

Structured evidence for explaining why a detector emitted an alert.

#
EvidenceContribution::new

fn EvidenceContribution::new(name : String, value : Double, weight? : Double) -> EvidenceContribution

#
EwmaDetector

pub struct EwmaDetector {
baseline : Double
variance : Double
alpha : Double
threshold : Double
warmup : Int
count : Int
index : Int
initialized : Bool
}

EWMA residual detector. It is useful for low-latency monitoring of a service metric.

#
EwmaDetector::baseline

fn EwmaDetector::baseline(self : EwmaDetector) -> Double

#
EwmaDetector::new

fn EwmaDetector::new(alpha? : Double, threshold? : Double, warmup? : Int, initial_mean? : Double, initial_variance? : Double) -> EwmaDetector

#
EwmaDetector::reset

fn EwmaDetector::reset(self : EwmaDetector) -> Unit

#
EwmaDetector::scale

fn EwmaDetector::scale(self : EwmaDetector) -> Double

#
EwmaDetector::update

fn EwmaDetector::update(self : EwmaDetector, value : Double) -> DetectionResult

#
FeatureExtractor

pub struct FeatureExtractor {
left : DoubleWindow
right : DoubleWindow
threshold : Double
index : Int
}

#
FeatureExtractor::new

fn FeatureExtractor::new(window_size? : Int, threshold? : Double) -> FeatureExtractor

#
FeatureExtractor::update

fn FeatureExtractor::update(self : FeatureExtractor, value : Double) -> DetectionResult

#
ForecastPoint

pub struct ForecastPoint {
prediction : Double
lower : Double
upper : Double
residual : Double
}

#
ForecastPoint::new

fn ForecastPoint::new(prediction : Double, residual : Double, uncertainty? : Double) -> ForecastPoint

#
Histogram

pub struct Histogram {
minimum : Double
maximum : Double
bins : Int
counts : Array[Int]
total : Int
}

A fixed-edge histogram for monitoring changes in value distribution.

#
Histogram::bins

fn Histogram::bins(self : Histogram) -> Int

#
Histogram::counts

fn Histogram::counts(self : Histogram) -> Array[Int]

#
Histogram::new

fn Histogram::new(minimum : Double, maximum : Double, bins : Int) -> Histogram

#
Histogram::probabilities

fn Histogram::probabilities(self : Histogram) -> Array[Double]

#
Histogram::push

fn Histogram::push(self : Histogram, value : Double) -> Unit

#
Histogram::reset

fn Histogram::reset(self : Histogram) -> Unit

#
Histogram::total

fn Histogram::total(self : Histogram) -> Int

#
HoltForecaster

pub struct HoltForecaster {
level : Double
trend : Double
alpha : Double
beta : Double
count : Int
}

#
HoltForecaster::new

fn HoltForecaster::new(alpha? : Double, beta? : Double) -> HoltForecaster

#
HoltForecaster::update

fn HoltForecaster::update(self : HoltForecaster, value : Double, horizon? : Int) -> ForecastPoint

#
HysteresisRule

pub struct HysteresisRule {
enter_threshold : Double
exit_threshold : Double
active : Bool
}

Hysteresis prevents alert flapping around a single threshold.

#
HysteresisRule::active

fn HysteresisRule::active(self : HysteresisRule) -> Bool

#
HysteresisRule::new

fn HysteresisRule::new(enter_threshold? : Double, exit_threshold? : Double) -> HysteresisRule

#
HysteresisRule::push

fn HysteresisRule::push(self : HysteresisRule, score : Double) -> Bool

#
Incident

pub struct Incident {
metric : String
first_timestamp : Int64
last_timestamp : Int64
alerts : Int
critical : Int
maximum_score : Double
direction : ChangeDirection
}

Groups nearby alert events into incidents for operators.

#
Incident::add

fn Incident::add(self : Incident, event : AlertEvent) -> Unit

#
Incident::duration

fn Incident::duration(self : Incident) -> Int64

#
Incident::empty

fn Incident::empty(metric : String) -> Incident

#
Incident::is_critical

fn Incident::is_critical(self : Incident) -> Bool

#
Incident::summary

fn Incident::summary(self : Incident) -> String

#
IqrSpikeDetector

pub struct IqrSpikeDetector {
window : DoubleWindow
multiplier : Double
warmup : Int
index : Int
}

A lightweight detector for isolated spikes using a rolling interquartile fence.

#
IqrSpikeDetector::new

fn IqrSpikeDetector::new(window_size? : Int, multiplier? : Double) -> IqrSpikeDetector

#
IqrSpikeDetector::update

fn IqrSpikeDetector::update(self : IqrSpikeDetector, value : Double) -> DetectionResult

#
LateDataPolicy

pub(all) enum LateDataPolicy {
Drop
KeepForCorrection
ReplaceSameTimestamp
}

The policy applied when a timestamp is older than the accepted watermark.

#
LinearForecaster

pub struct LinearForecaster {
window : DoubleWindow
horizon : Int
uncertainty_multiplier : Double
}

#
LinearForecaster::fit

fn LinearForecaster::fit(self : LinearForecaster, value : Double) -> ForecastPoint

#
LinearForecaster::new

fn LinearForecaster::new(window_size? : Int, horizon? : Int, uncertainty_multiplier? : Double) -> LinearForecaster

#
MahalanobisDetector

pub struct MahalanobisDetector {
stats : OnlineVectorStats
threshold : Double
warmup : Int
index : Int
}

Diagonal Mahalanobis detector. It remains usable when a full covariance matrix is unavailable.

#
MahalanobisDetector::count

fn MahalanobisDetector::count(self : MahalanobisDetector) -> Int

#
MahalanobisDetector::dimension

fn MahalanobisDetector::dimension(self : MahalanobisDetector) -> Int

#
MahalanobisDetector::new

fn MahalanobisDetector::new(dimension : Int, threshold? : Double, warmup? : Int) -> MahalanobisDetector

#
MahalanobisDetector::update

fn MahalanobisDetector::update(self : MahalanobisDetector, values : Array[Double]) -> DetectionResult

#
MeanVarianceDetector

pub struct MeanVarianceDetector {
baseline : DoubleWindow
current : DoubleWindow
mean_threshold : Double
variance_threshold : Double
index : Int
}

#
MeanVarianceDetector::new

fn MeanVarianceDetector::new(window_size? : Int, mean_threshold? : Double, variance_threshold? : Double) -> MeanVarianceDetector

#
MeanVarianceDetector::update

fn MeanVarianceDetector::update(self : MeanVarianceDetector, value : Double) -> DetectionResult

#
MetricPipeline

pub struct MetricPipeline {
name : String
detector : PipelineDetector
policy : AlertPolicy
index : Int
ordinal : Int
baseline : Double
}

One named metric with a detector and an alert policy.

#
MetricPipeline::index

fn MetricPipeline::index(self : MetricPipeline) -> Int

#
MetricPipeline::new

fn MetricPipeline::new(name : String, detector : PipelineDetector, policy? : AlertPolicy, baseline? : Double) -> MetricPipeline

#
MetricPipeline::process

fn MetricPipeline::process(self : MetricPipeline, timestamp : Int64, value : Double) -> AlertEvent?

#
MetricPipeline::reset

fn MetricPipeline::reset(self : MetricPipeline) -> Unit

#
MultiMetricMonitor

pub struct MultiMetricMonitor {
pipelines : Array[MetricPipeline]
processed : Int
emitted : Int
suppressed : Int
}

A deterministic multi-metric monitor. It is intentionally array-backed for WASM portability.

#
MultiMetricMonitor::emitted_count

fn MultiMetricMonitor::emitted_count(self : MultiMetricMonitor) -> Int

#
MultiMetricMonitor::metric_count

fn MultiMetricMonitor::metric_count(self : MultiMetricMonitor) -> Int

#
MultiMetricMonitor::new

#
MultiMetricMonitor::process

fn MultiMetricMonitor::process(self : MultiMetricMonitor, metric_index : Int, timestamp : Int64, value : Double) -> AlertEvent?

#
MultiMetricMonitor::process_batch

fn MultiMetricMonitor::process_batch(self : MultiMetricMonitor, metric_index : Int, points : Array[SignalPoint]) -> Array[AlertEvent]

#
MultiMetricMonitor::processed_count

fn MultiMetricMonitor::processed_count(self : MultiMetricMonitor) -> Int

#
MultiMetricMonitor::suppressed_count

fn MultiMetricMonitor::suppressed_count(self : MultiMetricMonitor) -> Int

#
MultiScaleDetector

pub struct MultiScaleDetector {
short : RobustZDetector
medium : RobustZDetector
long : TrendShiftDetector
minimum_consensus : Double
index : Int
}

#
MultiScaleDetector::new

fn MultiScaleDetector::new(short? : Int, medium? : Int, long? : Int, minimum_consensus? : Double) -> MultiScaleDetector

#
MultiScaleDetector::update

fn MultiScaleDetector::update(self : MultiScaleDetector, value : Double) -> DetectionResult

#
MultivariateEnsemble

pub struct MultivariateEnsemble {
detectors : Array[ProjectionDetector]
quorum : Int
index : Int
}

An ensemble that combines several multivariate views with a quorum rule.

#
MultivariateEnsemble::detector_count

fn MultivariateEnsemble::detector_count(self : MultivariateEnsemble) -> Int

#
MultivariateEnsemble::new

fn MultivariateEnsemble::new(detectors : Array[ProjectionDetector], quorum? : Int) -> MultivariateEnsemble

#
MultivariateEnsemble::update

fn MultivariateEnsemble::update(self : MultivariateEnsemble, values : Array[Double]) -> DetectionResult

#
OfflineChange

pub struct OfflineChange {
index : Int
score : Double
left_mean : Double
right_mean : Double
left_variance : Double
right_variance : Double
direction : ChangeDirection
}

A candidate change point returned by offline analysis.

#
OnlineEnsemble

pub struct OnlineEnsemble {
detectors : Array[PipelineDetector]
quorum : Int
index : Int
}

#
OnlineEnsemble::count

fn OnlineEnsemble::count(self : OnlineEnsemble) -> Int

#
OnlineEnsemble::new

fn OnlineEnsemble::new(detectors : Array[PipelineDetector], quorum? : Int) -> OnlineEnsemble

#
OnlineEnsemble::update

fn OnlineEnsemble::update(self : OnlineEnsemble, value : Double) -> EnsembleResult

#
OnlineMoments

pub struct OnlineMoments {
count : Int
mean : Double
m2 : Double
minimum : Double
maximum : Double
}

Numerically stable online moments using Welford's recurrence.

#
OnlineMoments::count

fn OnlineMoments::count(self : OnlineMoments) -> Int

#
OnlineMoments::maximum

fn OnlineMoments::maximum(self : OnlineMoments) -> Double

#
OnlineMoments::mean

fn OnlineMoments::mean(self : OnlineMoments) -> Double

#
OnlineMoments::merge

fn OnlineMoments::merge(self : OnlineMoments, other : OnlineMoments) -> Unit

#
OnlineMoments::minimum

fn OnlineMoments::minimum(self : OnlineMoments) -> Double

#
OnlineMoments::new

Creates an empty accumulator.

#
OnlineMoments::population_variance

fn OnlineMoments::population_variance(self : OnlineMoments) -> Double

#
OnlineMoments::push

fn OnlineMoments::push(self : OnlineMoments, value : Double) -> Unit

Adds one observation.

#
OnlineMoments::standard_deviation

fn OnlineMoments::standard_deviation(self : OnlineMoments) -> Double

#
OnlineMoments::summary

fn OnlineMoments::summary(self : OnlineMoments, median? : Double) -> StatsSummary

#
OnlineMoments::variance

fn OnlineMoments::variance(self : OnlineMoments) -> Double

#
OnlineMoments::with_prior

fn OnlineMoments::with_prior(mean : Double, variance : Double, weight : Int) -> OnlineMoments

Creates an accumulator with a prior mean and effective sample size.

#
OnlineVectorStats

pub struct OnlineVectorStats {
dimension : Int
count : Int
means : Array[Double]
m2 : Array[Double]
minima : Array[Double]
maxima : Array[Double]
}

Per-dimension Welford statistics for a vector stream.

#
OnlineVectorStats::count

fn OnlineVectorStats::count(self : OnlineVectorStats) -> Int

#
OnlineVectorStats::dimension

fn OnlineVectorStats::dimension(self : OnlineVectorStats) -> Int

#
OnlineVectorStats::maximums

fn OnlineVectorStats::maximums(self : OnlineVectorStats) -> Array[Double]

#
OnlineVectorStats::means

fn OnlineVectorStats::means(self : OnlineVectorStats) -> Array[Double]

#
OnlineVectorStats::minimums

fn OnlineVectorStats::minimums(self : OnlineVectorStats) -> Array[Double]

#
OnlineVectorStats::new

fn OnlineVectorStats::new(dimension : Int) -> OnlineVectorStats

#
OnlineVectorStats::push

fn OnlineVectorStats::push(self : OnlineVectorStats, values : Array[Double]) -> Bool

#
OnlineVectorStats::standard_deviations

fn OnlineVectorStats::standard_deviations(self : OnlineVectorStats) -> Array[Double]

#
OnlineVectorStats::standardized

fn OnlineVectorStats::standardized(self : OnlineVectorStats, values : Array[Double]) -> Array[Double]

#
OnlineVectorStats::variances

fn OnlineVectorStats::variances(self : OnlineVectorStats) -> Array[Double]

#
OrderedPoint

pub struct OrderedPoint {
point : SignalPoint
late : Bool
arrival_order : Int
}

A timestamped sample that has passed through a reorder buffer.

#
PageHinkley

pub struct PageHinkley {
target_mean : Double
control_limit : Double
delta : Double
alpha : Double
sum : Double
min_sum : Double
n : Int
}

PageHinkley implements the Page-Hinkley test for online change point detection.

#
PageHinkley::new

fn PageHinkley::new(target_mean? : Double, control_limit? : Double, delta? : Double, alpha? : Double) -> PageHinkley

Creates a new Page-Hinkley detector.

#
PageHinkley::reset

fn PageHinkley::reset(self : PageHinkley) -> Unit

Resets the internal accumulators.

#
PageHinkley::update

fn PageHinkley::update(self : PageHinkley, value : Double) -> Bool

Updates the Page-Hinkley detector with a new value and returns true if a change is detected.

#
PageHinkley::update_result

fn PageHinkley::update_result(self : PageHinkley, value : Double, index? : Int) -> DetectionResult

Rich result form of update, retaining direction and cumulative evidence.

#
PersistenceDetector

pub struct PersistenceDetector {
detector : EwmaDetector
rule : ConsecutiveRule
index : Int
}

#
PersistenceDetector::new

fn PersistenceDetector::new(warmup? : Int, persistence? : Int) -> PersistenceDetector

#
PersistenceDetector::update

fn PersistenceDetector::update(self : PersistenceDetector, value : Double) -> DetectionResult

#
PipelineDetector

pub(all) enum PipelineDetector {
LegacyDetector(Detector)
Ewma(EwmaDetector)
RobustZ(RobustZDetector)
VarianceShift(VarianceShiftDetector)
TrendShift(TrendShiftDetector)
IqrSpike(IqrSpikeDetector)
}

A detector that can be selected for a production metric pipeline.

#
PipelineDetector::update

fn PipelineDetector::update(self : PipelineDetector, value : Double, index : Int) -> DetectionResult

#
ProjectionDetector

pub struct ProjectionDetector {
weights : Array[Double]
baseline : Double
variance : Double
alpha : Double
threshold : Double
count : Int
index : Int
}

Tracks a weighted projection of a vector and detects changes in both projection and energy.

#
ProjectionDetector::dimension

fn ProjectionDetector::dimension(self : ProjectionDetector) -> Int

#
ProjectionDetector::new

fn ProjectionDetector::new(weights : Array[Double], alpha? : Double, threshold? : Double) -> ProjectionDetector

#
ProjectionDetector::update

fn ProjectionDetector::update(self : ProjectionDetector, values : Array[Double]) -> DetectionResult

#
QualityIssue

pub(all) enum QualityIssue {
MissingValue
NonFiniteValue
OutOfRange
NonMonotonicTimestamp
ExcessiveGap
DimensionMismatch
}

#
QualityReport

pub struct QualityReport {
count : Int
valid : Int
missing : Int
non_finite : Int
out_of_range : Int
non_monotonic : Int
excessive_gaps : Int
issues : Array[QualityIssue]
}

#
QualityReport::empty

#
QualityReport::is_healthy

fn QualityReport::is_healthy(self : QualityReport) -> Bool

#
QualityReport::valid_ratio

fn QualityReport::valid_ratio(self : QualityReport) -> Double

#
RankShiftDetector

pub struct RankShiftDetector {
left : DoubleWindow
right : DoubleWindow
threshold : Double
index : Int
}

#
RankShiftDetector::new

fn RankShiftDetector::new(window_size? : Int, threshold? : Double) -> RankShiftDetector

#
RankShiftDetector::update

fn RankShiftDetector::update(self : RankShiftDetector, value : Double) -> DetectionResult

#
RecoveryPlan

pub struct RecoveryPlan {
severity : AlertSeverity
immediate_action : String
verification_window : Int
cooldown : Int
escalation_score : Double
}

Recovery guidance and cooldown state for alert consumers.

#
RecoveryPlan::for_result

fn RecoveryPlan::for_result(result : DetectionResult) -> RecoveryPlan

#
RecoveryTracker

pub struct RecoveryTracker {
plan : RecoveryPlan
attempts : Int
acknowledged : Bool
recovered : Bool
}

#
RecoveryTracker::acknowledge

fn RecoveryTracker::acknowledge(self : RecoveryTracker) -> Unit

#
RecoveryTracker::attempt

fn RecoveryTracker::attempt(self : RecoveryTracker) -> Int

#
RecoveryTracker::attempts

fn RecoveryTracker::attempts(self : RecoveryTracker) -> Int

#
RecoveryTracker::is_closed

fn RecoveryTracker::is_closed(self : RecoveryTracker) -> Bool

#
RecoveryTracker::mark_recovered

fn RecoveryTracker::mark_recovered(self : RecoveryTracker) -> Unit

#
RecoveryTracker::new

#
ReorderBuffer

pub struct ReorderBuffer {
capacity : Int
policy : LateDataPolicy
pending : Array[OrderedPoint]
watermark : Int64
arrival_order : Int
dropped : Int
late_count : Int
}

A small bounded reorder buffer for streams with late data.

#
ReorderBuffer::dropped_count

fn ReorderBuffer::dropped_count(self : ReorderBuffer) -> Int

#
ReorderBuffer::flush

Flushes every pending item at the end of a stream.

#
ReorderBuffer::late_count

fn ReorderBuffer::late_count(self : ReorderBuffer) -> Int

#
ReorderBuffer::new

fn ReorderBuffer::new(capacity? : Int, policy? : LateDataPolicy) -> ReorderBuffer

#
ReorderBuffer::peek

Returns a copy of the buffered points without changing the buffer.

#
ReorderBuffer::pending_count

fn ReorderBuffer::pending_count(self : ReorderBuffer) -> Int

#
ReorderBuffer::push

Inserts a point. Returned points are safe to process in timestamp order.

#
ReorderBuffer::watermark

fn ReorderBuffer::watermark(self : ReorderBuffer) -> Int64

#
ReplayComparator

pub struct ReplayComparator {
score_tolerance : Double
confidence_tolerance : Double
compared : Int
mismatches : Int
}

#
ReplayComparator::compare

fn ReplayComparator::compare(self : ReplayComparator, expected : DetectionResult, actual : DetectionResult) -> Bool

#
ReplayComparator::compared

fn ReplayComparator::compared(self : ReplayComparator) -> Int

#
ReplayComparator::mismatches

fn ReplayComparator::mismatches(self : ReplayComparator) -> Int

#
ReplayComparator::new

fn ReplayComparator::new(score_tolerance? : Double, confidence_tolerance? : Double) -> ReplayComparator

#
ReplayRecord

pub struct ReplayRecord {
point : SignalPoint
result : DetectionResult
elapsed : Int64
}

Deterministic replay utilities for incident investigation and regression tests.

#
ReplayRecord::new

fn ReplayRecord::new(point : SignalPoint, result : DetectionResult, elapsed : Int64) -> ReplayRecord

#
ReplaySummary

pub struct ReplaySummary {
total : Int
changed : Int
first_change : Int
last_change : Int
mean_score : Double
max_score : Double
elapsed : Int64
}

#
ReplaySummary::empty

#
ReservoirSample

pub struct ReservoirSample {
capacity : Int
values : Array[Double]
seen : Int
rng : DeterministicRng
}

#
ReservoirSample::new

fn ReservoirSample::new(capacity : Int, seed? : Int64) -> ReservoirSample

#
ReservoirSample::push

fn ReservoirSample::push(self : ReservoirSample, value : Double) -> Unit

#
ReservoirSample::seen

fn ReservoirSample::seen(self : ReservoirSample) -> Int

#
ReservoirSample::values

fn ReservoirSample::values(self : ReservoirSample) -> Array[Double]

#
RobustZDetector

pub struct RobustZDetector {
window : DoubleWindow
threshold : Double
warmup : Int
index : Int
}

A robust detector based on the rolling median and MAD.

#
RobustZDetector::new

fn RobustZDetector::new(window_size? : Int, threshold? : Double) -> RobustZDetector

#
RobustZDetector::reset

fn RobustZDetector::reset(self : RobustZDetector) -> Unit

#
RobustZDetector::update

fn RobustZDetector::update(self : RobustZDetector, value : Double) -> DetectionResult

#
RoutingBudget

pub struct RoutingBudget {
capacity : Int
used : Int
}

#
RoutingBudget::allow

fn RoutingBudget::allow(self : RoutingBudget, decision : RoutingDecision) -> Bool

#
RoutingBudget::new

fn RoutingBudget::new(capacity? : Int) -> RoutingBudget

#
RoutingBudget::remaining

fn RoutingBudget::remaining(self : RoutingBudget) -> Int

#
RoutingBudget::used

fn RoutingBudget::used(self : RoutingBudget) -> Int

#
RoutingDecision

pub struct RoutingDecision {
metric : String
channel : String
priority : Int
acknowledged : Bool
reason : String
}

Converts alert severity into deterministic notification channels.

#
RoutingDecision::acknowledge

fn RoutingDecision::acknowledge(self : RoutingDecision) -> Unit

#
RoutingDecision::is_page

fn RoutingDecision::is_page(self : RoutingDecision) -> Bool

#
RoutingDecision::new

fn RoutingDecision::new(metric : String, channel : String, priority : Int, reason : String) -> RoutingDecision

#
RoutingDecision::summary

fn RoutingDecision::summary(self : RoutingDecision) -> String

#
ScaleEvidence

pub struct ScaleEvidence {
short_score : Double
medium_score : Double
long_score : Double
consensus : Double
changed : Bool
}

Evidence at multiple temporal scales.

#
ScaleEvidence::empty

#
ScoreCalibrator

pub struct ScoreCalibrator {
observations : Array[ScoreObservation]
max_observations : Int
positive_weight : Double
negative_weight : Double
}

#
ScoreCalibrator::best

fn ScoreCalibrator::best(self : ScoreCalibrator, candidates : Array[Double]) -> ThresholdReport

#
ScoreCalibrator::count

fn ScoreCalibrator::count(self : ScoreCalibrator) -> Int

#
ScoreCalibrator::negative_weight

fn ScoreCalibrator::negative_weight(self : ScoreCalibrator) -> Double

#
ScoreCalibrator::new

fn ScoreCalibrator::new(max_observations? : Int) -> ScoreCalibrator

#
ScoreCalibrator::positive_weight

fn ScoreCalibrator::positive_weight(self : ScoreCalibrator) -> Double

#
ScoreCalibrator::push

fn ScoreCalibrator::push(self : ScoreCalibrator, score : Double, changed : Bool, weight? : Double) -> Unit

#
ScoreCalibrator::report

fn ScoreCalibrator::report(self : ScoreCalibrator, threshold : Double) -> ThresholdReport

#
ScoreObservation

pub struct ScoreObservation {
score : Double
changed : Bool
weight : Double
}

Stores labeled detector scores for threshold selection.

#
ScoreObservation::new

fn ScoreObservation::new(score : Double, changed : Bool, weight? : Double) -> ScoreObservation

#
SeasonalAnomalyDetector

pub struct SeasonalAnomalyDetector {
profile : SeasonalProfile
threshold : Double
index : Int
}

#
SeasonalAnomalyDetector::new

fn SeasonalAnomalyDetector::new(period : Int, threshold? : Double, alpha? : Double) -> SeasonalAnomalyDetector

#
SeasonalAnomalyDetector::update

#
SeasonalProfile

pub struct SeasonalProfile {
period : Int
levels : Array[Double]
counts : Array[Int]
alpha : Double
index : Int
}

A lightweight seasonal profile updated online with exponential forgetting.

#
SeasonalProfile::baseline

fn SeasonalProfile::baseline(self : SeasonalProfile, index : Int) -> Double

#
SeasonalProfile::count

fn SeasonalProfile::count(self : SeasonalProfile, index : Int) -> Int

#
SeasonalProfile::levels

fn SeasonalProfile::levels(self : SeasonalProfile) -> Array[Double]

#
SeasonalProfile::new

fn SeasonalProfile::new(period : Int, alpha? : Double) -> SeasonalProfile

#
SeasonalProfile::period

fn SeasonalProfile::period(self : SeasonalProfile) -> Int

#
SeasonalProfile::update

fn SeasonalProfile::update(self : SeasonalProfile, value : Double) -> Double

#
SegmentQuality

pub struct SegmentQuality {
count : Int
mean : Double
deviation : Double
stability : Double
completeness : Double
score : Double
}

Segment-level diagnostics used to decide whether a change is actionable.

#
SegmentQuality::empty

#
SegmentRange

pub struct SegmentRange {
start : Int
end : Int
}

A half-open segment used by dynamic programming and binary segmentation.

#
SegmentRange::length

fn SegmentRange::length(self : SegmentRange) -> Int

#
SegmentRange::new

fn SegmentRange::new(start : Int, end : Int) -> SegmentRange

#
SignalPattern

pub(all) enum SignalPattern {
Stable
MeanShift
VarianceShift
Trend
Spike
MeanAndVarianceShift
}

#
SignalPoint

pub struct SignalPoint {
timestamp : Int64
value : Double
sequence : Int
}

A point in a time series. Timestamps are integer ticks supplied by the caller.

#
SignalPoint::new

fn SignalPoint::new(timestamp : Int64, value : Double, sequence? : Int) -> SignalPoint

Creates a signal point.

#
SignalScenario

pub struct SignalScenario {
name : String
length : Int
change_at : Int
baseline : Double
shift : Double
noise : Double
post_noise : Double
trend : Double
pattern : SignalPattern
seed : Int64
}

A scenario definition shared by tests, examples, and benchmarks.

#
SignalScenario::mean_and_variance

fn SignalScenario::mean_and_variance(length? : Int, change_at? : Int, baseline? : Double, shift? : Double, noise? : Double, post_noise? : Double, seed? : Int64) -> SignalScenario

#
SignalScenario::mean_shift

fn SignalScenario::mean_shift(length? : Int, change_at? : Int, baseline? : Double, shift? : Double, noise? : Double, seed? : Int64) -> SignalScenario

#
SignalScenario::spike

fn SignalScenario::spike(length? : Int, spike_at? : Int, baseline? : Double, spike? : Double, noise? : Double, seed? : Int64) -> SignalScenario

#
SignalScenario::stable

fn SignalScenario::stable(length? : Int, baseline? : Double, noise? : Double, seed? : Int64) -> SignalScenario

#
SignalScenario::trend

fn SignalScenario::trend(length? : Int, change_at? : Int, baseline? : Double, trend? : Double, noise? : Double, seed? : Int64) -> SignalScenario

#
SignalScenario::variance_shift

fn SignalScenario::variance_shift(length? : Int, change_at? : Int, baseline? : Double, noise? : Double, post_noise? : Double, seed? : Int64) -> SignalScenario

#
SloReport

pub struct SloReport {
window : SloWindow
target : Double
budget : Double
burn : Double
breached : Bool
recommendation : String
}

#
SloReport::availability

fn SloReport::availability(self : SloReport) -> Double

#
SloReport::breached

fn SloReport::breached(self : SloReport) -> Bool

#
SloReport::budget

fn SloReport::budget(self : SloReport) -> Double

#
SloReport::burn

fn SloReport::burn(self : SloReport) -> Double

#
SloReport::summary

fn SloReport::summary(self : SloReport) -> String

#
SloTracker

pub struct SloTracker {
window : SloWindow
target : Double
burn_limit : Double
periods : Int
}

#
SloTracker::close_period

fn SloTracker::close_period(self : SloTracker) -> SloReport

#
SloTracker::new

fn SloTracker::new(target? : Double, burn_limit? : Double) -> SloTracker

#
SloTracker::observe

fn SloTracker::observe(self : SloTracker, result : DetectionResult) -> Unit

#
SloTracker::periods

fn SloTracker::periods(self : SloTracker) -> Int

#
SloTracker::window

fn SloTracker::window(self : SloTracker) -> SloWindow

#
SloWindow

pub struct SloWindow {
total : Int
bad : Int
changed : Int
severe : Int
}

Service-level indicators derived from change-point evidence.

#
SloWindow::availability

fn SloWindow::availability(self : SloWindow) -> Double

#
SloWindow::bad

fn SloWindow::bad(self : SloWindow) -> Int

#
SloWindow::change_rate

fn SloWindow::change_rate(self : SloWindow) -> Double

#
SloWindow::changed

fn SloWindow::changed(self : SloWindow) -> Int

#
SloWindow::new

fn SloWindow::new() -> SloWindow

#
SloWindow::observe

fn SloWindow::observe(self : SloWindow, result : DetectionResult) -> Unit

#
SloWindow::severe

fn SloWindow::severe(self : SloWindow) -> Int

#
SloWindow::total

fn SloWindow::total(self : SloWindow) -> Int

#
SquareMatrix

pub struct SquareMatrix {
size : Int
data : Array[Double]
}

Small dense matrix type used for low-dimensional covariance diagnostics.

#
SquareMatrix::add

#
SquareMatrix::determinant

fn SquareMatrix::determinant(self : SquareMatrix) -> Double

#
SquareMatrix::diagonal

fn SquareMatrix::diagonal(self : SquareMatrix) -> Array[Double]

#
SquareMatrix::get

fn SquareMatrix::get(self : SquareMatrix, row : Int, column : Int) -> Double

#
SquareMatrix::identity

fn SquareMatrix::identity(size : Int) -> SquareMatrix

#
SquareMatrix::multiply

fn SquareMatrix::multiply(self : SquareMatrix, other : SquareMatrix) -> SquareMatrix

#
SquareMatrix::new

fn SquareMatrix::new(size : Int, fill? : Double) -> SquareMatrix

#
SquareMatrix::quadratic_form

fn SquareMatrix::quadratic_form(self : SquareMatrix, vector : Array[Double]) -> Double

#
SquareMatrix::regularize

fn SquareMatrix::regularize(self : SquareMatrix, diagonal : Double) -> Unit

#
SquareMatrix::scale

fn SquareMatrix::scale(self : SquareMatrix, factor : Double) -> SquareMatrix

#
SquareMatrix::set

fn SquareMatrix::set(self : SquareMatrix, row : Int, column : Int, value : Double) -> Unit

#
SquareMatrix::size

fn SquareMatrix::size(self : SquareMatrix) -> Int

#
SquareMatrix::transpose

fn SquareMatrix::transpose(self : SquareMatrix) -> SquareMatrix

#
StatsSummary

pub struct StatsSummary {
count : Int
mean : Double
variance : Double
standard_deviation : Double
minimum : Double
maximum : Double
median : Double
first : Double
last : Double
}

A compact summary of a numeric sample.

#
StatsSummary::empty

fn StatsSummary::empty() -> StatsSummary

Creates an empty summary.

#
StepChangeDetector

pub struct StepChangeDetector {
reference : DoubleWindow
current : DoubleWindow
threshold : Double
index : Int
}

Detects a persistent step change by comparing a reference and a current block.

#
StepChangeDetector::new

fn StepChangeDetector::new(window_size? : Int, threshold? : Double) -> StepChangeDetector

#
StepChangeDetector::update

fn StepChangeDetector::update(self : StepChangeDetector, value : Double) -> DetectionResult

#
StreamEngine

pub struct StreamEngine {
reorder : ReorderBuffer
tracker : WatermarkTracker
aggregator : WindowAggregator
pipeline : MetricPipeline
processed : Int
aggregates : Int
alerts : Int
}

End-to-end stream state: reorder, aggregate, and detect.

#
StreamEngine::aggregate_count

fn StreamEngine::aggregate_count(self : StreamEngine) -> Int

#
StreamEngine::alert_count

fn StreamEngine::alert_count(self : StreamEngine) -> Int

#
StreamEngine::flush

#
StreamEngine::new

fn StreamEngine::new(metric : String, detector : PipelineDetector, window_size? : Int, lateness? : Int) -> StreamEngine

#
StreamEngine::process_point

fn StreamEngine::process_point(self : StreamEngine, point : SignalPoint) -> Array[AlertEvent]

#
StreamEngine::processed

fn StreamEngine::processed(self : StreamEngine) -> Int

#
ThresholdPoint

pub struct ThresholdPoint {
index : Int
threshold : Double
score : Double
accepted : Bool
}

Threshold schedules used when a service changes its noise profile over time.

#
ThresholdPoint::new

fn ThresholdPoint::new(index : Int, score : Double, threshold : Double) -> ThresholdPoint

#
ThresholdReport

pub struct ThresholdReport {
threshold : Double
true_positives : Int
false_positives : Int
true_negatives : Int
false_negatives : Int
precision : Double
recall : Double
f1 : Double
expected_cost : Double
}

#
ThresholdReport::empty

fn ThresholdReport::empty(threshold : Double) -> ThresholdReport

#
TimeWindow

pub struct TimeWindow {
start : Int64
end : Int64
ordinal : Int
}

Time-window planning utilities for batch and streaming consumers.

#
TimeWindow::contains

fn TimeWindow::contains(self : TimeWindow, timestamp : Int64) -> Bool

#
TimeWindow::duration

fn TimeWindow::duration(self : TimeWindow) -> Int64

#
TimeWindow::is_empty

fn TimeWindow::is_empty(self : TimeWindow) -> Bool

#
TimeWindow::new

fn TimeWindow::new(start : Int64, end : Int64, ordinal : Int) -> TimeWindow

#
TrendShiftDetector

pub struct TrendShiftDetector {
window : DoubleWindow
slope_threshold : Double
persistence : Int
consecutive : Int
index : Int
}

Detects a sustained slope rather than a one-point spike.

#
TrendShiftDetector::new

fn TrendShiftDetector::new(window_size? : Int, slope_threshold? : Double, persistence? : Int) -> TrendShiftDetector

#
TrendShiftDetector::reset

fn TrendShiftDetector::reset(self : TrendShiftDetector) -> Unit

#
TrendShiftDetector::update

fn TrendShiftDetector::update(self : TrendShiftDetector, value : Double) -> DetectionResult

#
VarianceShiftDetector

pub struct VarianceShiftDetector {
short_window : DoubleWindow
long_window : DoubleWindow
threshold : Double
warmup : Int
index : Int
}

Detects variance changes by comparing short and long rolling windows.

#
VarianceShiftDetector::new

fn VarianceShiftDetector::new(short_window? : Int, long_window? : Int, threshold? : Double) -> VarianceShiftDetector

#
VarianceShiftDetector::reset

#
VarianceShiftDetector::update

fn VarianceShiftDetector::update(self : VarianceShiftDetector, value : Double) -> DetectionResult

#
VectorPoint

pub struct VectorPoint {
timestamp : Int64
values : Array[Double]
sequence : Int
}

A validated vector observation for multivariate streams.

#
VectorPoint::dimension

fn VectorPoint::dimension(self : VectorPoint) -> Int

#
VectorPoint::is_valid

fn VectorPoint::is_valid(self : VectorPoint) -> Bool

#
VectorPoint::new

fn VectorPoint::new(timestamp : Int64, values : Array[Double], sequence? : Int) -> VectorPoint

#
VoteRule

pub struct VoteRule {
required : Int
window : Array[Bool]
size : Int
}

#
VoteRule::new

fn VoteRule::new(size? : Int, required? : Int) -> VoteRule

#
VoteRule::push

fn VoteRule::push(self : VoteRule, positive : Bool) -> Bool

#
VoteRule::votes

fn VoteRule::votes(self : VoteRule) -> Int

#
WatermarkTracker

pub struct WatermarkTracker {
allowed_lateness : Int64
maximum_seen : Int64
accepted : Int
dropped : Int
}

#
WatermarkTracker::accepted

fn WatermarkTracker::accepted(self : WatermarkTracker) -> Int

#
WatermarkTracker::dropped

fn WatermarkTracker::dropped(self : WatermarkTracker) -> Int

#
WatermarkTracker::new

fn WatermarkTracker::new(allowed_lateness? : Int64) -> WatermarkTracker

#
WatermarkTracker::observe

fn WatermarkTracker::observe(self : WatermarkTracker, timestamp : Int64) -> Bool

#
WatermarkTracker::watermark

fn WatermarkTracker::watermark(self : WatermarkTracker) -> Int64

#
WindowAggregate

pub struct WindowAggregate {
start_timestamp : Int64
end_timestamp : Int64
count : Int
value : Double
summary : StatsSummary
}

#
WindowAggregator

pub struct WindowAggregator {
size : Int
kind : AggregationKind
window : DoubleWindow
start_timestamp : Int64
end_timestamp : Int64
count : Int
}

#
WindowAggregator::flush

#
WindowAggregator::new

fn WindowAggregator::new(size : Int, kind? : AggregationKind) -> WindowAggregator

#
WindowAggregator::push

#
WindowDiagnostic

pub struct WindowDiagnostic {
before : StatsSummary
after : StatsSummary
mean_shift : Double
variance_ratio : Double
distribution_shift : Double
severity : AlertSeverity
actionable : Bool
}

Diagnostic comparison between two adjacent windows.

#
WindowDiagnostic::empty

#
WindowFeatures

pub struct WindowFeatures {
count : Int
mean : Double
standard_deviation : Double
median : Double
mad : Double
minimum : Double
maximum : Double
range : Double
slope : Double
autocorrelation : Double
change_rate : Double
}

Features extracted from a bounded window for dashboards and model input.

#
WindowFeatures::empty

#
absolute

fn absolute(value : Double) -> Double

Returns the absolute value without exposing math implementation details.

#
absolute_change

fn absolute_change(baseline : Double, observed : Double) -> Double

#
actionable_diagnostics

fn actionable_diagnostics(diagnostics : Array[WindowDiagnostic]) -> Int

#
adaptive_threshold

fn adaptive_threshold(scores : Array[Double], false_positive_rate? : Double) -> Double

#
alerts_markdown

fn alerts_markdown(alerts : Array[AlertEvent]) -> String

#
align_by_timestamp

fn align_by_timestamp(left : Array[SignalPoint], right : Array[SignalPoint]) -> (Array[Double], Array[Double])

#
array_maximum

fn array_maximum(values : Array[Double]) -> Double

#
array_minimum

fn array_minimum(values : Array[Double]) -> Double

#
autocorrelation

fn autocorrelation(values : Array[Double], lag : Int) -> Double

#
average_pairwise_correlation

fn average_pairwise_correlation(series : Array[Array[Double]]) -> Double

#
benchmark_cusum

fn benchmark_cusum(scenario : SignalScenario, rounds? : Int) -> BenchmarkResult

#
benchmark_ensemble

fn benchmark_ensemble(scenario : SignalScenario, rounds? : Int) -> BenchmarkResult

#
benchmark_markdown

fn benchmark_markdown(results : Array[BenchmarkResult]) -> String

#
benchmark_robust_z

fn benchmark_robust_z(scenario : SignalScenario, rounds? : Int) -> BenchmarkResult

#
benchmark_suite

fn benchmark_suite(rounds? : Int) -> Array[BenchmarkResult]

Runs the standard acceptance benchmark suite on a fixed synthetic scenario.

#
best_boundary

fn best_boundary(values : Array[Double], minimum_segment? : Int) -> Int

#
best_f1_threshold

fn best_f1_threshold(scores : Array[Double], labels : Array[Bool], candidates : Array[Double]) -> ThresholdPoint

#
best_lag

fn best_lag(left : Array[Double], right : Array[Double], maximum_lag : Int) -> Int

#
best_threshold

fn best_threshold(observations : Array[ScoreObservation], candidates : Array[Double], false_positive_cost? : Double, false_negative_cost? : Double) -> ThresholdReport

#
binary_segmentation

fn binary_segmentation(values : Array[Double], threshold? : Double, min_segment? : Int, max_changes? : Int) -> Array[OfflineChange]

Greedy binary segmentation for a small number of interpretable changes.

#
bootstrap_change_score

fn bootstrap_change_score(left : Array[Double], right : Array[Double], replicates? : Int, seed? : Int64) -> BootstrapEstimate

#
bootstrap_mean

fn bootstrap_mean(values : Array[Double], replicates? : Int, seed? : Int64) -> BootstrapEstimate

#
boundary_quality

fn boundary_quality(values : Array[Double], boundary : Int, minimum_segment? : Int) -> Double

#
bucket_timestamp

fn bucket_timestamp(timestamp : Int64, origin : Int64, width : Int64) -> Int64

#
burn_rate

fn burn_rate(window : SloWindow, target : Double) -> Double

#
calibration_bins

fn calibration_bins(observations : Array[ScoreObservation], bins? : Int) -> Array[Double]

#
catalog_markdown

fn catalog_markdown() -> String

#
change_direction_from_values

fn change_direction_from_values(baseline : Double, observed : Double) -> ChangeDirection

#
change_point_csv

fn change_point_csv(point : ChangePoint) -> String

#
change_point_csv_header

fn change_point_csv_header() -> String

#
changes_csv

fn changes_csv(points : Array[ChangePoint]) -> String

#
clamp_probability

fn clamp_probability(value : Double) -> Double

Clamps a probability-like number to the closed unit interval.

#
clip

fn clip(values : Array[Double], lower : Double, upper : Double) -> Array[Double]

#
clip_values

fn clip_values(values : Array[Double], minimum : Double, maximum : Double) -> Array[Double]

#
cluster_incidents

fn cluster_incidents(events : Array[AlertEvent], maximum_gap : Int64) -> Array[Incident]

#
combine_scores

fn combine_scores(scores : Array[Double], weights : Array[Double]) -> Double

#
compare_segment_quality

fn compare_segment_quality(left : Array[Double], right : Array[Double]) -> Double

#
consensus_score

fn consensus_score(results : Array[DetectionResult]) -> Double

#
contiguous_ranges

fn contiguous_ranges(points : Array[SignalPoint], maximum_gap : Int64) -> Array[SegmentRange]

#
cooldown_schedule

fn cooldown_schedule(plan : RecoveryPlan, attempts : Int) -> Array[Int]

#
correlated_change_score

fn correlated_change_score(before : Array[Array[Double]], after : Array[Array[Double]]) -> Double

#
correlation

fn correlation(left : Array[Double], right : Array[Double]) -> Double

#
correlation_alert

fn correlation_alert(before : Array[Array[Double]], after : Array[Array[Double]], threshold? : Double) -> DetectionResult

#
correlation_matrix

fn correlation_matrix(series : Array[Array[Double]]) -> SquareMatrix

#
cosine_similarity

fn cosine_similarity(left : Array[Double], right : Array[Double]) -> Double

#
covariance

fn covariance(left : Array[Double], right : Array[Double]) -> Double

#
covariance_matrix

fn covariance_matrix(series : Array[Array[Double]]) -> SquareMatrix

#
critical_incident_count

fn critical_incident_count(incidents : Array[Incident]) -> Int

#
cumulative_sum

fn cumulative_sum(values : Array[Double], initial? : Double) -> Array[Double]

#
cumulative_total

fn cumulative_total(values : Array[Double]) -> Array[Double]

#
deduplicate_events

fn deduplicate_events(events : Array[AlertEvent], minimum_gap : Int64) -> Array[AlertEvent]

#
deseasonalize

fn deseasonalize(values : Array[Double], period : Int) -> Array[Double]

#
detection_csv

fn detection_csv(result : DetectionResult) -> String

Converts a detection result to a stable CSV row.

#
detection_csv_header

fn detection_csv_header() -> String

#
detector_catalog

fn detector_catalog() -> Array[DetectorSpec]

#
detector_names

fn detector_names() -> Array[String]

#
detector_reliability

fn detector_reliability(results : Array[DetectionResult]) -> Double

#
diagnose_series

fn diagnose_series(values : Array[Double], split : Int, minimum_segment? : Int) -> WindowDiagnostic

#
diagnose_windows

fn diagnose_windows(before_values : Array[Double], after_values : Array[Double], shift_threshold? : Double, distribution_threshold? : Double) -> WindowDiagnostic

#
diagnostic_direction

fn diagnostic_direction(diagnostic : WindowDiagnostic) -> ChangeDirection

#
diagnostic_label

fn diagnostic_label(diagnostic : WindowDiagnostic) -> String

#
diagnostic_markdown

fn diagnostic_markdown(diagnostic : WindowDiagnostic) -> String

#
diagnostic_score

fn diagnostic_score(diagnostic : WindowDiagnostic) -> Double

#
diagnostics_batch

fn diagnostics_batch(values : Array[Double], splits : Array[Int]) -> Array[WindowDiagnostic]

#
diagonal_mahalanobis

fn diagonal_mahalanobis(vector : Array[Double], means : Array[Double], variances : Array[Double]) -> Double

#
difference

fn difference(values : Array[Double], lag? : Int) -> Array[Double]

#
direction_name

fn direction_name(direction : ChangeDirection) -> String

Returns a human-readable direction label.

#
distribution_change_score

fn distribution_change_score(left : Array[Double], right : Array[Double]) -> Double

#
distribution_overlap

fn distribution_overlap(left : Array[Double], right : Array[Double], bins? : Int) -> Double

#
downsample_mean

fn downsample_mean(values : Array[Double], factor : Int) -> Array[Double]

#
energy_distance

fn energy_distance(left : Array[Double], right : Array[Double]) -> Double

#
error_budget

fn error_budget(availability : Double, target : Double) -> Double

#
euclidean_distance

fn euclidean_distance(left : Array[Double], right : Array[Double]) -> Double

#
evaluate_change_points

fn evaluate_change_points(predicted : Array[Int], truth : Array[Int], tolerance? : Int) -> ChangePointMetrics

Matches a prediction to at most one truth within a tolerance window.

#
evaluate_slo

fn evaluate_slo(window : SloWindow, target? : Double, burn_limit? : Double) -> SloReport

#
evaluate_threshold

fn evaluate_threshold(observations : Array[ScoreObservation], threshold : Double, false_positive_cost? : Double, false_negative_cost? : Double) -> ThresholdReport

#
event_rate

fn event_rate(events : Array[AlertEvent], start : Int64, end : Int64) -> Double

#
evidence_strength

fn evidence_strength(score : Double, confidence : Double, deviation : Double) -> Double

#
expected_alert_cost

fn expected_alert_cost(false_positive_rate : Double, false_negative_rate : Double, false_positive_cost? : Double, false_negative_cost? : Double) -> Double

#
explain_batch

fn explain_batch(results : Array[DetectionResult], baseline : Double, values : Array[Double], detector : String) -> Array[DetectionExplanation]

#
explanation_alerts

fn explanation_alerts(explanations : Array[DetectionExplanation]) -> Int

#
explanation_csv

fn explanation_csv(explanation : DetectionExplanation) -> String

#
explanation_csv_header

fn explanation_csv_header() -> String

#
explanation_markdown

fn explanation_markdown(explanation : DetectionExplanation) -> String

#
explanation_strength

fn explanation_strength(explanation : DetectionExplanation) -> Double

#
exponential_smooth

fn exponential_smooth(values : Array[Double], alpha? : Double) -> Array[Double]

#
extract_features

fn extract_features(values : Array[Double]) -> WindowFeatures

#
feature_change_score

fn feature_change_score(left : Array[Double], right : Array[Double]) -> Double

#
feature_distance

fn feature_distance(left : WindowFeatures, right : WindowFeatures) -> Double

#
feature_names

fn feature_names() -> Array[String]

#
find_detector

fn find_detector(name : String) -> DetectorSpec?

#
first_difference

fn first_difference(values : Array[Double]) -> Array[Double]

#
forecast_mae

fn forecast_mae(actual : Array[Double], predicted : Array[Double]) -> Double

#
forecast_mape

fn forecast_mape(actual : Array[Double], predicted : Array[Double]) -> Double

#
forecast_rmse

fn forecast_rmse(actual : Array[Double], predicted : Array[Double]) -> Double

#
forward_fill

fn forward_fill(values : Array[Double], fallback? : Double) -> Array[Double]

#
generate_signal

fn generate_signal(scenario : SignalScenario) -> Array[Double]

Generates a deterministic signal and its known change indices.

#
hampel_filter

fn hampel_filter(values : Array[Double], window_size? : Int, threshold? : Double) -> Array[Double]

#
highest_priority

fn highest_priority(decisions : Array[RoutingDecision]) -> Int

#
histogram_distance

fn histogram_distance(left : Histogram, right : Histogram) -> Double

#
histogram_hellinger

fn histogram_hellinger(left : Histogram, right : Histogram) -> Double

#
incident_alert_count

fn incident_alert_count(incidents : Array[Incident]) -> Int

#
incident_rate

fn incident_rate(incidents : Array[Incident], start : Int64, end : Int64) -> Double

#
incidents_markdown

fn incidents_markdown(incidents : Array[Incident]) -> String

#
inspect_split

fn inspect_split(values : Array[Double], split : Int, min_segment? : Int) -> OfflineChange?

Returns a change record for a split, or None when the split is outside the valid range.

#
interpolate_missing

fn interpolate_missing(values : Array[Double]) -> Array[Double]

Linearly interpolates invalid observations while retaining valid endpoints.

#
interpolate_points

fn interpolate_points(points : Array[SignalPoint], step : Int64) -> Array[SignalPoint]

#
interquartile_range

fn interquartile_range(values : Array[Double]) -> Double

#
is_finite

fn is_finite(value : Double) -> Bool

Returns whether a value is finite enough for detector state.

#
ks_statistic

fn ks_statistic(left : Array[Double], right : Array[Double]) -> Double

Kolmogorov-Smirnov distance between two samples.

#
lag_points

fn lag_points(points : Array[SignalPoint], lag : Int64) -> Array[SignalPoint]

#
lag_values

fn lag_values(values : Array[Double], lag : Int) -> Array[Double]

#
lagged_correlation

fn lagged_correlation(left : Array[Double], right : Array[Double], lag : Int) -> Double

#
linear_slope

fn linear_slope(values : Array[Double]) -> Double

#
locate_time_window

fn locate_time_window(windows : Array[TimeWindow], timestamp : Int64) -> Int

#
make_explanation

fn make_explanation(result : DetectionResult, baseline : Double, observed : Double, detector : String) -> DetectionExplanation

#
make_time_windows

fn make_time_windows(start : Int64, end : Int64, width : Int64, step? : Int64) -> Array[TimeWindow]

#
mann_whitney_u

fn mann_whitney_u(left : Array[Double], right : Array[Double]) -> Double

#
mask_every

fn mask_every(values : Array[Double], period : Int, offset? : Int) -> Array[Double]

Applies deterministic missingness without changing the length of the sample.

#
mean

fn mean(values : Array[Double]) -> Double

#
mean_absolute_difference

fn mean_absolute_difference(values : Array[Double]) -> Double

#
mean_shift_score

fn mean_shift_score(values : Array[Double], split : Int, min_segment? : Int) -> Double

Standardized mean difference between two adjacent segments.

#
median

fn median(values : Array[Double]) -> Double

#
median_absolute_deviation

fn median_absolute_deviation(values : Array[Double]) -> Double

#
merge_nearby_changes

fn merge_nearby_changes(changes : Array[OfflineChange], minimum_distance : Int) -> Array[OfflineChange]

Removes candidates closer than minimum_distance, preserving the highest score.

#
metrics_markdown

fn metrics_markdown(metrics : ChangePointMetrics) -> String

#
moving_average

fn moving_average(values : Array[Double], window_size : Int) -> Array[Double]

#
moving_median

fn moving_median(values : Array[Double], window_size : Int) -> Array[Double]

#
normalize_minmax

fn normalize_minmax(values : Array[Double]) -> Array[Double]

#
normalize_range

fn normalize_range(values : Array[Double], minimum? : Double, maximum? : Double) -> Array[Double]

#
normalize_scores

fn normalize_scores(scores : Array[Double]) -> Array[Double]

#
normalize_zscore

fn normalize_zscore(values : Array[Double]) -> Array[Double]

#
online_detector_count

fn online_detector_count() -> Int

#
optimal_changepoints

fn optimal_changepoints(values : Array[Double], penalty? : Double, min_segment? : Int, max_changes? : Int) -> Array[Int]

Penalized dynamic programming for minimum-description-length style segmentation.

#
outlier_mask

fn outlier_mask(values : Array[Double], threshold? : Double) -> Array[Bool]

#
page_count

fn page_count(decisions : Array[RoutingDecision]) -> Int

#
percentile

fn percentile(values : Array[Double], percent : Double) -> Double

#
piecewise_constant_error

fn piecewise_constant_error(values : Array[Double], changes : Array[Int]) -> Double

Computes a reconstruction error when each segment is represented by its mean.

#
quality_gate

fn quality_gate(values : Array[Double], minimum_score? : Double) -> Bool

#
quality_score

fn quality_score(report : QualityReport) -> Double

#
quantile

fn quantile(values : Array[Double], probability : Double) -> Double

#
quantile_shift_score

fn quantile_shift_score(left : Array[Double], right : Array[Double]) -> Double

#
rank_biserial_effect

fn rank_biserial_effect(left : Array[Double], right : Array[Double]) -> Double

#
ranks

fn ranks(values : Array[Double]) -> Array[Double]

fn recommended_detector(multivariate : Bool, offline : Bool, robust : Bool) -> String

#
recovery_message

fn recovery_message(plan : RecoveryPlan) -> String

#
recovery_priority

fn recovery_priority(result : DetectionResult) -> Int

#
recovery_report

fn recovery_report(plans : Array[RecoveryPlan]) -> String

#
relative_change

fn relative_change(baseline : Double, observed : Double) -> Double

#
remove_invalid

fn remove_invalid(values : Array[Double]) -> Array[Double]

#
reorder_periodic

fn reorder_periodic(points : Array[SignalPoint], period : Int) -> Array[SignalPoint]

Reorders every period-th point to model a small late-data burst.

#
replace_invalid

fn replace_invalid(values : Array[Double], replacement? : Double) -> Array[Double]

#
replay_changed_indices

fn replay_changed_indices(records : Array[ReplayRecord]) -> Array[Int]

#
replay_checksum

fn replay_checksum(records : Array[ReplayRecord]) -> Double

#
replay_latency_percentile

fn replay_latency_percentile(records : Array[ReplayRecord], probability : Double) -> Int64

#
replay_summary_markdown

fn replay_summary_markdown(summary : ReplaySummary) -> String

#
replay_values

fn replay_values(records : Array[ReplayRecord]) -> Array[Double]

#
replay_window

fn replay_window(records : Array[ReplayRecord], start : Int, end : Int) -> Array[ReplayRecord]

#
resample_linear

fn resample_linear(points : Array[SignalPoint], step : Int64) -> Array[SignalPoint]

#
results_csv

fn results_csv(results : Array[DetectionResult]) -> String

#
robust_detector_count

fn robust_detector_count() -> Int

#
robust_scale

fn robust_scale(values : Array[Double]) -> Double

#
robust_z_score

fn robust_z_score(value : Double, center : Double, scale : Double) -> Double

#
robust_z_scores

fn robust_z_scores(values : Array[Double]) -> Array[Double]

#
rolling_correlation

fn rolling_correlation(left : Array[Double], right : Array[Double], window_size : Int) -> Array[Double]

#
rolling_mean

fn rolling_mean(values : Array[Double], window_size : Int) -> Array[Double]

#
rolling_origins

fn rolling_origins(length : Int, train_size : Int, horizon : Int, step? : Int) -> Array[SegmentRange]

#
rolling_quantile

fn rolling_quantile(values : Array[Double], window_size : Int, probability : Double) -> Array[Double]

#
rolling_slope

fn rolling_slope(values : Array[Double], window_size : Int) -> Array[Double]

#
rolling_standard_deviation

fn rolling_standard_deviation(values : Array[Double], window_size : Int) -> Array[Double]

#
route_alert

fn route_alert(alert : AlertEvent) -> RoutingDecision

#
route_alerts

fn route_alerts(alerts : Array[AlertEvent]) -> Array[RoutingDecision]

#
routing_summary

fn routing_summary(decisions : Array[RoutingDecision]) -> String

#
runs_test_score

fn runs_test_score(values : Array[Double]) -> Double

#
safe_correlation

fn safe_correlation(left : Array[Double], right : Array[Double]) -> Double

Cross-series relationship helpers for multivariate monitoring.

#
scale_profile

fn scale_profile(values : Array[Double], sizes : Array[Int]) -> Array[ScaleEvidence]

#
scenario_truth

fn scenario_truth(scenario : SignalScenario) -> Array[Int]

#
score_f1

fn score_f1(scores : Array[Double], labels : Array[Bool], threshold : Double) -> Double

#
score_margin

fn score_margin(score : Double, threshold : Double) -> Double

#
score_precision

fn score_precision(scores : Array[Double], labels : Array[Bool], threshold : Double) -> Double

#
score_recall

fn score_recall(scores : Array[Double], labels : Array[Bool], threshold : Double) -> Double

#
score_to_confidence

fn score_to_confidence(score : Double, threshold : Double) -> Double

#
seasonal_naive_forecast

fn seasonal_naive_forecast(values : Array[Double], period : Int, horizon : Int) -> Array[Double]

#
seasonal_strength

fn seasonal_strength(values : Array[Double], period : Int) -> Double

#
second_difference

fn second_difference(values : Array[Double]) -> Array[Double]

#
segment_means

fn segment_means(values : Array[Double], boundaries : Array[Int]) -> Array[Double]

#
segment_profile

fn segment_profile(values : Array[Double], boundaries : Array[Int]) -> Array[StatsSummary]

#
segment_quality

fn segment_quality(values : Array[Double]) -> SegmentQuality

#
segment_variances

fn segment_variances(values : Array[Double], boundaries : Array[Int]) -> Array[Double]

#
severity_from_score

fn severity_from_score(score : Double) -> AlertSeverity

Converts a score into a stable three-level severity.

#
severity_name

fn severity_name(severity : AlertSeverity) -> String

Returns a human-readable severity label.

#
should_escalate

fn should_escalate(plan : RecoveryPlan, score : Double) -> Bool

#
sigmoid_score

fn sigmoid_score(value : Double) -> Double

#
sign

fn sign(value : Double) -> Int

Returns the sign of a number.

#
sign_change_rate

fn sign_change_rate(values : Array[Double]) -> Double

#
signal_checksum

fn signal_checksum(values : Array[Double]) -> Double

Returns a deterministic checksum useful for detecting accidental benchmark dead-code elimination.

#
slope_confidence

fn slope_confidence(values : Array[Double]) -> Double

#
sorted_copy

fn sorted_copy(values : Array[Double]) -> Array[Double]

Returns a sorted copy using insertion sort. It is stable and allocation-bounded for small windows.

#
spearman_correlation

fn spearman_correlation(left : Array[Double], right : Array[Double]) -> Double

#
split_train_test

fn split_train_test(values : Array[Double], train_fraction? : Double) -> (Array[Double], Array[Double])

#
standard_deviation

fn standard_deviation(values : Array[Double]) -> Double

#
stratified_counts

fn stratified_counts(values : Array[Double], bins : Int) -> Array[Int]

#
strongest_contribution

fn strongest_contribution(explanation : DetectionExplanation) -> EvidenceContribution?

#
sum

fn sum(values : Array[Double]) -> Double

#
summarize_replay

fn summarize_replay(records : Array[ReplayRecord]) -> ReplaySummary

#
summary_markdown

fn summary_markdown(summary : StatsSummary) -> String

#
tail_confidence

fn tail_confidence(score : Double, scale? : Double) -> Double

#
threshold_for_false_positive

fn threshold_for_false_positive(scores : Array[Double], target_rate : Double) -> Double

#
threshold_from_mad

fn threshold_from_mad(scores : Array[Double], multiplier? : Double) -> Double

#
threshold_from_mean

fn threshold_from_mean(scores : Array[Double], standard_deviations? : Double) -> Double

#
threshold_from_quantile

fn threshold_from_quantile(scores : Array[Double], false_positive_rate : Double) -> Double

#
threshold_grid

fn threshold_grid(minimum : Double, maximum : Double, steps : Int) -> Array[Double]

#
threshold_points

fn threshold_points(scores : Array[Double], threshold : Double) -> Array[ThresholdPoint]

#
time_window_csv

fn time_window_csv(windows : Array[TimeWindow], counts : Array[Int]) -> String

#
timestamped_signal

fn timestamped_signal(values : Array[Double], start? : Int64, step? : Int64) -> Array[SignalPoint]

Converts a signal to timestamped points.

#
trimmed_mean

fn trimmed_mean(values : Array[Double], trim_fraction : Double) -> Double

#
validate_points

fn validate_points(points : Array[SignalPoint], maximum_gap? : Int64?) -> QualityReport

#
validate_values

fn validate_values(values : Array[Double], lower? : Double?, upper? : Double?) -> QualityReport

#
variance

fn variance(values : Array[Double]) -> Double

#
vector_dot

fn vector_dot(left : Array[Double], right : Array[Double]) -> Double

#
vector_norm

fn vector_norm(values : Array[Double]) -> Double

Computes the Euclidean norm of a vector.

#
weighted_consensus

fn weighted_consensus(results : Array[DetectionResult], weights : Array[Double], quorum : Double) -> DetectionResult

#
weighted_mean

fn weighted_mean(values : Array[Double], weights : Array[Double]) -> Double

#
window_change_scores

fn window_change_scores(values : Array[Double], min_segment? : Int) -> Array[Double]

Scans every valid split and returns a score for each index.

#
window_counts

fn window_counts(points : Array[SignalPoint], windows : Array[TimeWindow]) -> Array[Int]

#
window_means

fn window_means(points : Array[SignalPoint], windows : Array[TimeWindow]) -> Array[Double]

#
window_summaries

fn window_summaries(points : Array[SignalPoint], windows : Array[TimeWindow]) -> Array[StatsSummary]

#
winsorize

fn winsorize(values : Array[Double], lower_probability? : Double, upper_probability? : Double) -> Array[Double]

#
winsorize_robust

fn winsorize_robust(values : Array[Double], lower_probability : Double, upper_probability : Double) -> Array[Double]

Robust preprocessing helpers for production telemetry.