Skip to content

Add MQ{C,R}NN Python version (port from MXNet)#3276

Open
timoschowski wants to merge 7 commits intoawslabs:devfrom
timoschowski:dev
Open

Add MQ{C,R}NN Python version (port from MXNet)#3276
timoschowski wants to merge 7 commits intoawslabs:devfrom
timoschowski:dev

Conversation

@timoschowski
Copy link
Copy Markdown
Contributor

Issue #, if available:
#2059

Description of changes:

Claude and me worked on a port of MQCNN from MXNet to PyTorch. This works close enough for electricity dataset that I think we could try to merge this.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Please tag this pr with at least one of these labels to make our release process faster: BREAKING, new feature, bug fix, other change, dev setup

timjan-db and others added 7 commits January 31, 2026 06:09
…data.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Key fixes:
- Changed scaling parameter default from True to None (defaults to False for quantile output, matching MXNet's NOPScaler behavior)
- Removed incorrect scale multiplication before quantile projection (MXNet applies quantile_proj directly to decoder output)
- Added checkpoint loading error handling in PyTorchLightningEstimator
- Added AddSeriesScale transformation for forking sequence models

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Added static features (including log(scale)) to RNN encoder input
to match CNN encoder and MXNet MQRNN behavior.

Changes:
- RNNEncoder.forward() now concatenates target + static_features + dynamic_features
- Matches CNN encoder feature concatenation pattern
- Matches MXNet RNNEncoder._assemble_inputs() behavior

Results:
- Reduced MAE difference from 32.85% to 21.16% on electricity dataset
- RMSE difference improved to 8.62%
- Still investigating remaining ~20% difference

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Adds unit tests, integration tests, and parity tests to ensure MQCNN
and MQRNN PyTorch implementations work correctly and maintain parity
with MXNet reference implementations.

Key additions:
- Regression test for lazy initialization optimizer bug
- Integration tests for both MQCNN and MQRNN estimators
- MXNet vs PyTorch parity tests with documented tolerances
- Tests verify RNN parameters are trained correctly

Test coverage:
- test_optimizer_includes_all_parameters: Critical regression test
- test_mq_dnn_estimator_constant_dataset: End-to-end estimator tests
- test_mq_dnn_mxnet_pytorch_parity: Framework parity verification
- Additional tests for various configurations and edge cases

All tests include clear assertions and failure messages to facilitate
debugging if issues arise.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Remove backup files and debug output that should not be included
in the pull request:
- estimator.py.backup (backup file)
- extreme_scales_output.txt (debug output)
- MQ_DNN_MIGRATION_SUMMARY.md (internal documentation)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@timoschowski timoschowski marked this pull request as draft January 31, 2026 18:14
@timoschowski timoschowski marked this pull request as ready for review January 31, 2026 20:59
@timoschowski
Copy link
Copy Markdown
Contributor Author

mqrnn_four_series_after_fix

@timoschowski
Copy link
Copy Markdown
Contributor Author

test_electricity_mqrnn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants