RCF3
rcf3 provides streaming anomaly detectors in Rust with Python bindings.
What it provides
- Random Cut Forest for online anomaly detection, feature attribution, neighborhood search, missing-value imputation, and time-series forecasting
- Online Isolation Forest for numerical streams with sliding-window updates
- mStream for mixed numerical/categorical streaming anomaly detection with feature-level score decomposition
- FeatureSketch for sparse feature-name streams whose schema can grow or shrink over time
- Rust and Python APIs over the same core implementation
Documentation
- Documentation index
- Forest API guide
- OnlineIForest API guide
- MStream API guide
- FeatureSketch API guide
Quick orientation
Use Forest when your stream is represented as numerical observations and you want the broader RCF feature set:
use Forest;
let mut forest = builder.build?;
forest.update?;
Use OnlineIForest when you want a compact numerical detector with sliding-window updates:
use OnlineIForest;
let mut detector = builder.build?;
let score = detector.update_and_score?;
Use MStream when each event has separate numerical and categorical aspects:
use MStream;
let mut detector = builder.build?;
let score = detector.update_and_score?;
Use FeatureSketch when each event is a sparse set of named features and the feature universe is not fixed:
use FeatureSketch;
let mut detector = builder.build?;
let score = detector.update_and_score?;
Features
The crate supports several compile-time features:
std (enabled by default)
Enables use of the Rust standard library. Disable this for no_std environments:
[]
= { = "0.4", = false }
serde (enabled by default)
Provides JSON serialization and deserialization support for persisted detector state:
[]
= { = "0.4", = ["serde", "std"] }
python (optional)
Builds Python bindings using PyO3, enabling use from Python. Automatically enables serde and std:
[]
= { = "0.4", = ["python"] }
To use just the core algorithm without serialization:
[]
= { = "0.4", = false, = ["std"] }
License
Licensed under either of the Apache License 2.0 or MIT license, at your option.