-
Notifications
You must be signed in to change notification settings - Fork 0
Integrate Deep Learning Models into Monthly Forecasting Workflow #47
Copy link
Copy link
Open
Description
Summary
Integrate deep learning models into the monthly discharge forecasting workflow with a clean, maintainable structure that allows easy addition of new models while maintaining compatibility with existing workflows.
Background
The current codebase has legacy deep learning code in deep_scr/ that needs to be restructured and integrated into the production workflow. The goal is to create a unified interface for both traditional ML models (SciRegressor) and deep learning models, supporting both standalone forecasting and meta-learning approaches.
Objectives
- Restructure Deep Learning Components: Move
deep_scr/code into proper production structure underforecast_models/deep_models/ - Unified Interface: Create deep learning models that inherit from
BaseForecastModelwith same interface asSciRegressor - Multiple Architectures: Support LSTM, CNN-LSTM, TiDE, TSMixer, and Mamba models
- Enhanced Dataset: Generic dataset supporting multi-input structure with NaN handling
- Easy Extensibility: Plugin-style architecture for adding new model types
Technical Requirements
Data Structure (at prediction time t):
x_past: (batch, past_time_steps, past_features) - past discharge, P, T, past predictionsx_nan_mask: (batch, past_time_steps, past_features) - binary mask for missing featuresx_future: (batch, future_time_steps, future_vars) - weather forecast, temporal featuresx_now: (batch, 1, now_vars) - current predictions/errors from other modelsx_static: static basin features
Core Components Needed:
-
DeepRegressorclass inheriting fromBaseForecastModel -
DeepMetaLearnerfor meta-learning approaches - Generic dataset classes with configurable NaN handling
- Neural network architectures (LSTM, CNN-LSTM, TiDE, TSMixer, Mamba)
- Loss functions (Quantile, Asymmetric Laplace)
- PyTorch Lightning base modules and training utilities
Integration Requirements:
- LOOCV implementation (yearly cross-validation)
- Hyperparameter tuning with Optuna
- Model saving/loading functionality
- Operational prediction pipeline
- Compatibility with existing
FeatureExtractorand evaluation pipeline
Proposed Structure
monthly_forecasting/
├── forecast_models/
│ ├── deep_models/ # NEW: Deep learning models
│ │ ├── deep_regressor.py # Main forecaster class
│ │ ├── deep_meta_learner.py # Meta-learning variant
│ │ ├── architectures/ # Neural network architectures
│ │ │ ├── lstm_models.py
│ │ │ ├── cnn_lstm_models.py
│ │ │ ├── tide_models.py
│ │ │ ├── tsmixer_models.py
│ │ │ └── mamba_models.py
│ │ ├── losses/ # Loss functions
│ │ └── utils/ # Training utilities
Implementation Plan
Phase 1: Core Infrastructure
- Set up project structure and dependencies
- Implement base deep learning classes
- Create generic dataset classes
- Develop PyTorch Lightning base modules
Phase 2: Model Architectures
- Implement LSTM variants
- Add CNN-LSTM models
- Integrate TiDE architecture
- Add TSMixer and Mamba models
Phase 3: Integration & Testing
- Integrate with existing workflow
- Implement LOOCV and hyperparameter tuning
- Create comprehensive test suite
- Performance benchmarking
Phase 4: Documentation & Examples
- Configuration examples
- Usage documentation
- Architecture extension guide
Success Criteria
- Deep learning models follow same interface as existing
SciRegressor - Models can be easily added through configuration
- Full integration with existing evaluation pipeline
- Comprehensive test coverage
- Performance comparable to or better than existing models
Dependencies
- PyTorch
- PyTorch Lightning
- Additional deep learning libraries as needed
References
- Detailed plan:
scratchpads/planning/deep-learning-integration-comprehensive-plan.md - Existing code:
monthly_forecasting/deep_scr/ - Current interface:
monthly_forecasting/forecast_models/base_class.py
🤖 Generated with Claude Code
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels