The PastDecomposableMixing layer is the core encoder block of TimeMixer. It combines:
Series Decomposition: Splits input into trend and seasonal components
Multi-Scale Mixing: Processes each component at multiple scales
Cross-Component Learning: Shared dense transformations between components
Hierarchical Representation: Captures patterns at different resolutions
This is the key innovation of TimeMixer - decomposable, multi-scale mixing for time series.
🔍 How It Works
1 2 3 4 5 6 7 8 91011121314151617
Input Time Series
|
V
Decomposition
/ \
/ \
V V
Trend Seasonal
| |
V V
[Multi-Scale] [Multi-Scale]
[Trend Mixing] [Season Mixing]
| |
V V
Trend Outputs Seasonal Outputs
| |
+-------- Output --------+
💡 Why Use This Layer?
Advantage
Benefit
Decomposable
Treat trend/seasonal separately
Multi-Scale
Capture patterns at different resolutions
Efficient
Reduced parameters vs monolithic
Interpretable
Understand which component contributes
📊 Use Cases
Time Series Forecasting: Primary encoder for TimeMixer
Long Sequence Forecasting: Efficient multi-scale handling
🚀 Quick Start
1 2 3 4 5 6 7 8 91011121314151617181920212223
importkerasfromkerasfactory.layersimportPastDecomposableMixingpdm=PastDecomposableMixing(seq_len=96,pred_len=12,down_sampling_window=2,down_sampling_layers=1,d_model=64,dropout=0.1,channel_independence=0,decomp_method='moving_avg',d_ff=256,moving_avg=25,top_k=5)# Input list of tensorsx_list=[keras.random.normal((32,96,64))]# Process through encoder blockoutputs=pdm(x_list)print(len(outputs))# Number of output scales