Clone this repo:
  1. 1823eeb Merge pull request #5 from apache/draw-line-per-algorithm by Henrik Ingo · 2 days ago main
  2. f5fb8d4 Draw change-point lines for each algorithm at the same index by Alex Sorokoumov · 3 days ago draw-line-per-algorithm
  3. 65182fc Merge pull request #4 from apache/custom-datasets by Alex Sorokoumov · 4 days ago
  4. cea07c3 Add Dataset mode for comparing algorithms on real series by Alex Sorokoumov · 5 days ago custom-datasets
  5. 3dfa7e4 Use Otava 0.8.0 and lots of fixes by Henrik Ingo · 4 weeks ago

Otava Test Data

Test data generators and Visualization for Apache Otava change point detection.

Web Visualizer

The package includes an interactive web visualizer for exploring test patterns and comparing change point detection results against ground truth.

Step Function Detection

Features:

  • Generate and visualize 17 different test patterns
  • Compare three analysis methods: Otava (statistical), Moving Average, and Boundary detection
  • View accuracy metrics (precision, recall, F1 score)
  • Adjust parameters in real-time and see results instantly

Multiple Change Points

Detect multiple successive changes in your data:

Multiple Changes Detection

Variance Changes

Detect changes in data volatility even when the mean stays constant:

Variance Change Detection

Starting the Visualizer

pip install otava-test-data[web]

# Start the web server
otava-web
# Or with invoke tasks
inv web-start

Then open http://127.0.0.1:8100 in your browser.

Compare algorithms on a real dataset

A third mode, Dataset, lets you load a bundled or pasted time series and see which change points each Otava algorithm variant (compute_change_points, compute_change_points_orig, compute_change_points_deterministic) detects on the same data. The TigerBeetle benchmark dataset ships as the default preset. The Otava analysis panel now exposes the same algorithm checkboxes in all three modes. See docs/visualizer.md for details.

Installation

pip install otava-test-data

Or with all optional dependencies:

pip install otava-test-data[all]

Quick Start

from otava_test_data import step_function, noise_normal, combine

# Generate a step function (single change point) with realistic noise
step = step_function(length=500, value_before=100, value_after=120)
noise = noise_normal(length=500, mean=0, sigma=5)
combined = combine(step, noise)

# Export to CSV for Otava analysis
combined.to_csv("test_data.csv")

# Access ground truth change point information
for cp in combined.change_points:
    print(f"Change at index {cp.index}: {cp.description}")

Available Generators

Basic Building Blocks

GeneratorDescription
constantConstant value: S = x, x, x, x...
noise_normalNormal distribution: S ~ N(mean, sigma)
noise_uniformUniform distribution: S ~ U(min, max)
outlierSingle anomaly: S = x, x, x', x, x...
step_functionSingle change point: S = x1, x1, x2, x2...
regression_fixTemporary regression: S = x1, x2, x1...

Advanced Patterns

GeneratorDescription
bandingOscillation between two values
variance_changeConstant mean, changing variance
phase_changePhase shift in periodic signal
multiple_changesMultiple consecutive step changes

CLI Tool

# Generate test suite
otava-gen generate --output-dir ./test_data --lengths 50 500 --seed 42

# List available generators
otava-gen list

# Get info about a generator
otava-gen info step_function

Documentation

Full documentation available at Read the Docs.

License

Apache License 2.0