Add UR2CUTE model for intermittent demand forecasting #1401
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds UR2CUTE (Using Repetitively 2 CNNs for Unsteady Timeseries Estimation), a specialized neural forecasting model designed for intermittent time series data, to the NeuralForecast library.
Model Description
UR2CUTE employs a two-step hurdle approach combining:
This dual-phase architecture significantly improves forecasting accuracy for intermittent demand patterns, which are common in retail, inventory management, and supply chain forecasting.
Changes
Files Added
neuralforecast/models/ur2cute.py- Complete UR2CUTE implementation (~545 lines)Files Modified
neuralforecast/models/__init__.py- Added UR2CUTE to model exportsREADME.md- Added UR2CUTE to the list of available modelsImplementation Details
Architecture
CNNClassifier (Classification Branch):
CNNRegressor (Regression Branch):
Combined Prediction:
Key Features
training_step()andvalidation_step()for combined losstotal_loss = α × BCE_loss + (1-α) × regression_lossModel Configuration
Usage Example
Parameters
hinput_sizeclassification_thresholddropout_classificationdropout_regressionclassification_weightlearning_ratemax_stepsbatch_sizeWhen to Use UR2CUTE
Ideal Use Cases ✅
Not Recommended ❌
Technical Validation
Compatibility
.fit()and.predict()interfaceCode Quality
Scientific Background
Original Paper:
Mirshahi, S., Brandtner, P., & Komínková Oplatková, Z. (2024).
Intermittent Time Series Demand Forecasting Using Dual Convolutional Neural Networks.
MENDEL — Soft Computing Journal, 30(1).
Key Findings from Paper:
Testing Recommendations
Basic Integration Test
Comparison Test
Performance Considerations
max_steps)Future Enhancements (Not in this PR)
Potential future improvements:
futr_exog,hist_exog,stat_exogBreaking Changes
None - this is a new model addition with no changes to existing functionality.
Checklist
BaseModelforward()methodmodels/__init__.pyAdditional Notes
Design Decisions
Why override
training_step()?The two-step approach requires computing separate losses (BCE for classification, MAE/MSE for regression) which isn't easily handled by a single loss function. Overriding allows explicit control over the combined loss calculation.
Why separate CNNs?
Separate architectures allow each branch to specialize: the classifier focuses on occurrence patterns while the regressor focuses on magnitude patterns. This matches the original paper's design.
Why no exogenous support initially?
To keep the initial implementation clean and focused on the core two-step architecture. Exogenous support can be added in a future enhancement.
Maintainability
Related Issues
This addresses the need for specialized models for intermittent/sparse time series, which is a common pain point in retail and inventory forecasting applications.
Authors
License
This implementation maintains compatibility with NeuralForecast's Apache 2.0 license.
Request for Review
Please review:
Thank you for considering this contribution!