ts-imputation

Time SeriesTime-Series-Library

Description

Time Series Imputation: Custom Model Design

Objective

Design and implement a custom deep learning model for time series missing value imputation. Your code goes in the Model class in models/Custom.py. Three reference implementations (DLinear, TimesNet, PatchTST) are provided as read-only.

Evaluation

Trained and evaluated on three multivariate datasets with 25% random masking:

  • ETTh1 (7 variables)
  • Weather (21 variables)
  • ECL (321 variables)

All use seq_len=96. Metrics: MSE and MAE on masked regions only (lower is better).

Code

Custom.py
EditableRead-only
1import torch
2import torch.nn as nn
3
4
5class Model(nn.Module):
6 """
7 Custom model for time series imputation.
8
9 Forward signature: forward(x_enc, x_mark_enc, x_dec, x_mark_dec, mask=None)
10 - x_enc: [batch, seq_len, enc_in] — input with masked values set to 0
11 - x_mark_enc: [batch, seq_len, time_features] — time feature encoding
12 - x_dec: not used for imputation (None)
13 - x_mark_dec: not used for imputation (None)
14 - mask: [batch, seq_len, enc_in] — binary mask (1=observed, 0=masked)
15

Additional context files (read-only):

  • Time-Series-Library/models/DLinear.py
  • Time-Series-Library/models/TimesNet.py
  • Time-Series-Library/models/PatchTST.py
  • Time-Series-Library/layers/AutoCorrelation.py
  • Time-Series-Library/layers/Autoformer_EncDec.py
  • Time-Series-Library/layers/Conv_Blocks.py
  • Time-Series-Library/layers/Crossformer_EncDec.py
  • Time-Series-Library/layers/Embed.py
  • Time-Series-Library/layers/FourierCorrelation.py
  • Time-Series-Library/layers/SelfAttention_Family.py
  • Time-Series-Library/layers/StandardNorm.py
  • Time-Series-Library/layers/Transformer_EncDec.py

Results

ModelTypemse ETTh1 mae ETTh1 mse Weather mae Weather mse ECL mae ECL
dlinearbaseline0.1500.2690.0500.1140.1130.243
patchtstbaseline0.1040.2160.0310.0520.0620.169
patchtstbaseline0.1060.2170.0310.0530.0620.169
timesnetbaseline0.0800.1910.0290.0550.0910.208
anthropic/claude-opus-4.6vanilla0.0370.1310.0510.0920.0780.192
deepseek-reasonervanilla0.0390.1300.0290.0550.0760.190
google/gemini-3.1-pro-previewvanilla0.0640.1710.1090.1690.7950.743
openai/gpt-5.4-provanilla0.0420.1380.0260.0380.0550.157
qwen/qwen3.6-plus:freevanilla0.1880.2810.0540.0800.1180.239
anthropic/claude-opus-4.6agent0.0370.1290.0310.0580.0770.192
deepseek-reasoneragent------
deepseek-reasoneragent0.0390.1300.0290.0550.0760.190
google/gemini-3.1-pro-previewagent0.0840.1930.0430.0680.0500.148
openai/gpt-5.4-proagent0.0440.1410.0250.0360.0500.150
qwen/qwen3.6-plus:freeagent0.1880.2810.0540.0800.1180.239

Agent Conversations