Quick Start

Quick Start

Installation

You may install OpenMOA library by pip

pip install openmoa

The First Example

Run an end-to-end streaming-anomaly detection experiment on a synthetically drifting feature space.

Python

import openmoa as om
from openmoa.dataset import stream_loader
from openmoa.preprocess import adaptive_standardize
from openmoa.model import SparseActiveOL  # IJCAI'25
from openmoa.eval import run
  1. create a streaming loader whose feature space grows/shrinks on-the-fly
ds = stream_loader(name='synthetic_open',
                   n_samples=1_000_000,
                   feature_pace=500,   # new feature appears every 500 steps
                   anomaly_ratio=0.05)
  1. plug in the online learner
learner = SparseActiveOL(
    alpha=0.01,           # sparsity regularizer (ℓ1,∞ mixed norm, SDM'24)
    budget=50,            # active query budget
    window=1000           # sliding window size
)
  1. run & collect results
run(
    stream=ds,
    preprocess=adaptive_standardize,
    learner=learner,
    metrics=['AUC', 'F1', 'N_features'],
    output=['csv', 'fig', 'animation'],
    checkpoint_every=10000
)