Add Mamba SSM module for time series generation #23
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 State Space Model (SSM) based generation as an alternative to diffusion models for time series synthesis.
Motivation: Diffusion models tend to average out patterns and struggle with:
SSMs address this through continuous-time dynamics and selective state transitions.
Key Additions
SSM/s4_layer.py: S4 layer with HiPPO initialization for long-range dependenciesSSM/mamba_tsg.py: Mamba selective SSM implementationSelectiveSSM: Core Mamba with input-dependent B, C, Δ parametersMambaVAE: VAE architecture with Mamba encoder/decoderMambaTimeSeriesGenerator: Autoregressive generatorSSM/train_mamba_oilfield.py: Training script exampleValidation Results
Tested on oil field degradation pattern (should have negative trend):
Mamba captures the degradation trend 250x better than diffusion.
Features
Bug Fix Included
TimeDP/utils/init_utils.py: Fix undefinedcfg_namevariable when using--nameflagTest Plan
Built with assistance from Claude Code