Releases: NasdormML/Moex_predict
v1.6.0 — Risk-Aware Forecasting
Beta release introducing probabilistic forecasting with calibrated confidence intervals and production-ready risk metrics.
🎯 What’s New
Quantile Forecasting (All Architectures)
Every model now predicts full probability distributions, not just point estimates:
# Before: [307.4, 306.1, ...] # Just numbers
# After: {
"mean": 307.4,
"confidence_interval": {"lower_5%": 290.1, "upper_95%": 325.8}
}New variants: quantile_tcn, quantile_lstm, quantile_tft, quantile_autoformer
Zero-Code Architecture
- Smart Factory: Auto-injects
n_quantilesbased on model name prefix - Universal TCN: Single module handles both modes via
Optional[int]flag - DRY Principle: No duplicate
quantile_*.pyfiles → maintainability +90%
Risk Metrics in MLflow
Two new metrics logged automatically:
- Quantile Loss: Lower = better calibrated intervals
- Coverage: Measures if real prices fall inside predicted range (target: 5%/95%)
⚡ Quick Start
# 90% confidence interval forecast
python train.py model=quantile_tcn data.ticker=SBER
# With Optuna hyperparameter tuning
python train.py model=quantile_tcn data.ticker=SBER optimization.enable=true
# Access via API
curl -X POST "http://localhost:8000/predict" \
-H "Content-Type: application/json" \
-d '{"ticker":"SBER","horizon":5}'📊 Performance Snapshot
| Model | Type | MSE | Quantile Loss | Coverage |
|---|---|---|---|---|
tcn |
Point | 18.31 | — | — |
quantile_tcn |
Risk-Aware | 18.5 | 0.82 | 5.2% / 94.8% ✅ |
Coverage within ±1% = perfectly calibrated risk model
✅ Backward Compatibility
No breaking changes. Existing code works unchanged:
# Ongoing production jobs unaffected
python train.py model=tcn data.ticker=SBER📝 Migration Guide
API Response Parsing (Client-Side)
# ❌ Old (v1.5.x)
predictions = response["predictions"]
for price in predictions:
print(price)
# ✅ New (v1.6.0)
for day in response["forecast"]:
print(f"Expected: {day['mean']}")
print(f"Risk Range: {day['confidence_interval']}")🛠️ Technical Details
- PR: #42 (Risk-Aware Forecasting Implementation)
- Tests:
pytest tests/test_quantile_coverage.py(coverage validation) - Configs:
conf/model/quantile_*.yamlinherit from base models - Factory:
app/models/factory.pyauto-detects vianame.startswith("quantile_")
Time Series Transformer
What's be Changed
- ReWork NN logic by @NasdormML, Swap LSTM to TFT.
- Upgrade model performance from MAPE: 1.20% to 0.90% on SBER ticker.
- Add ROSN notebook with TFE model with MAPE: 1.10%
v1.1.0
[1.1.0] - 2025-04-22
Changed
- Refactored
transfer_learning.py: the model updating process now runs through Optuna training cycles with automatic hyperparameter optimization. - After each cycle, the retrained model and associated scalers are saved in the
models/directory as new versions (v1.1,v1.2, etc.).
Improved
- Slight improvements to MLflow logging: error bars obtained during the transfer learning process are now displayed in experiment tracking.
v1.0.0
What's Changed
-
Added two forecasting models for MOEX tickers: SBER and GAZP
-
Implemented retraining support with automatic model versioning (models/v1.1, v1.2, etc.)
-
Integrated MLflow monitoring:
-
Tracks training loss for each retraining session
-
Supports full rollback by switching to previous model versions
Introduced Makefile:
Easy installation of dependencies
One-liner to run FastAPI backend and MLflow UI locally