Skip to main content

chronix_analytics/preprocess/
mod.rs

1//! # Chronix Preprocessing Pipeline
2//!
3//! Gap detection, interpolation, smoothing, resampling, and clock drift
4//! correction for time-series data — all operating on Arrow-compatible
5//! `&[f64]` / `&[i64]` arrays with zero-copy where possible.
6//!
7//! ## Pipeline Order
8//!
9//! ```text
10//! Raw data → Clock drift correction → Gap detection → Interpolation → Smoothing → Resampling
11//! ```
12//!
13//! ## Interpolation Methods
14//!
15//! - `Linear` — linearly interpolated values between known points
16//! - `Nearest` — nearest neighbor fill
17//! - `CatmullRom` — Catmull-Rom spline (C1 local interpolation, requires ≥ 4 surrounding points)
18//! - `Zero` — fill with 0.0
19//! - `Forward` — last known value carried forward
20//! - `Nocb` — next observation carried backward
21//!
22//! ## Smoothing Filters
23//!
24//! - `ExponentialSmoother` — single-pass EMA with configurable alpha
25//! - `MovingAverageSmoother` — sliding window mean
26//! - `WeightedMovingAverage` — custom weight vector
27
28#![warn(missing_docs)]
29#![deny(unsafe_code)]
30
31mod clock_drift;
32mod gap;
33mod interpolation;
34mod pipeline;
35mod resampling;
36mod smoothing;
37
38pub mod arrow_adapters;
39pub mod auto_features;
40pub mod decomposition;
41pub mod features;
42
43pub use arrow_adapters::{
44    ArrowPreprocessResult, arrow_interpolate, arrow_preprocess, arrow_smooth,
45};
46pub use auto_features::{AutoFeatureConfig, FeatureMatrix};
47pub use clock_drift::{ClockDriftDetector, ClockDriftReport, ClockDriftStrategy};
48pub use decomposition::{
49    Decomposition, DecompositionError, SeasonalDecomposer, StlConfig, StlDecomposer, detect_period,
50    detect_period_with_threshold, stl_decompose,
51};
52pub use features::{diff, ewm, lag, pct_change, rolling_corr, rolling_mean, rolling_std, zscore};
53pub use gap::GapDetector;
54pub use interpolation::{InterpolationError, Interpolator};
55pub use pipeline::{PreprocessConfig, PreprocessError, PreprocessPipeline, PreprocessResult};
56pub use resampling::{AggregationFn, ResampleConfig, Resampler};
57pub use smoothing::{ExponentialSmoother, MovingAverageSmoother, Smoother, WeightedMovingAverage};