Package com.quantfinlib.ml
@NullMarked
package com.quantfinlib.ml
Statistical learning models for market data, in plain Java. The main
classes:
GradientBoostedRegressor (stump boosting),
VolatilityForecaster (forward realized vol +
0-100 risk score), RegimeDetector (2-state
Gaussian Markov-switching model via Baum-Welch EM),
MarketImpactPredictor (learned impact + sweep
probability), IntradayLiquidityForecaster
(session volume profiles) and AnomalyDetector
(quote stuffing, price spikes).
4.0. This package stays in the stable jar in 4.0. The 3.1 design
proposed moving it out, but stable packages (execution) depend on
it, and a move would make the module graph cyclic. See
docs/DESIGN_4.0.md.
-
ClassDescriptionSurveillance anomaly detection over interval-aggregated market activity: Quote stuffing — message-rate spikes (robust z-score) combined with an abnormal order-to-trade ratio: lots of quoting, little trading. Price spikes — interval returns far outside their recent distribution.Gradient-boosted regression over decision stumps (XGBoost-style additive boosting with squared-error loss), implemented in pure Java with no dependencies.Intraday liquidity forecasting: accumulates per-bucket volumes across days into a seasonal profile (e.g. 24 hourly buckets) to predict when liquidity peaks — London open, the London/New York overlap, etc.ML market impact prediction: learns realized impact (bps) from order and book features using gradient-boosted trees, and estimates the probability a marketable order sweeps through the visible top of book.Two-state Gaussian Markov-switching model (hidden Markov model) fitted by Baum-Welch EM with scaled forward-backward recursions (Rabiner 1989, Proc.Machine Learning Risk Forecasting: predicts forward realized volatility from a return series using gradient-boosted trees over engineered features (multi-horizon realized vol, momentum, and shock magnitude), and maps the forecast to a 0-100 risk score.Out-of-sample comparison: RMSE (per-period vol units) of the model and of the two baselines over the same forecast dates.