Skip to content

Latest commit

 

History

48 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Team and Contributors

State University of São Paulo, Department of Computing, Recogna Laboratory

Joel da Silva Cavalcanti Filho
João Renato Ribeiro Manesco
Eduardo Roldão Nonato Perondini

2. Repository Structure

File/Folder Description
Demo Notebooks/ Contains Jupyter notebooks demonstrating how to use the Mosqlimate API for model registration, prediction submission, and evaluation. These notebooks serve as practical examples for reproducing the competition workflow.
PatchTST_results/ Stores the prediction results generated using the PatchTST forecasting model. The directory is organized by experiment, containing the JSON files required for submission to the IMDC platform.
TTM_results/ Contains the prediction results produced with the Tiny Time Mixer (TTM) model. Results are organized according to the evaluated datasets and geographical aggregation levels.
img/ Repository images used in the documentation, including figures displayed in the README.
.gitignore Specifies files and directories that should not be tracked by Git, such as cache files, temporary outputs, and virtual environments.
LICENSE Defines the license under which the repository is distributed.
README.md Main documentation of the repository, including project overview, installation instructions, usage examples, and submission workflow.
pyproject.toml Project configuration file defining metadata, dependencies, and build settings required for the Python environment.

3. Libraries and Dependencies

Python Dependencies

Package Imported Modules / Objects Purpose
torch torch, TensorDataset, DataLoader, AdamW, OneCycleLR Deep learning framework used for model training, optimization, data loading, and learning rate scheduling.
transformers PatchTSTConfig, PatchTSTForPretraining, PatchTSTForPrediction, get_scheduler Hugging Face implementation of the PatchTST architecture and training utilities.
tsfm-public get_model Loads the IBM Granite Time Series TinyTimeMixer (TTM) foundation model.
pandas pandas (pd) Data manipulation and preprocessing.
numpy numpy (np) Numerical computations and array operations.
wandb wandb Experiment tracking and logging of training metrics.
tqdm tqdm Progress bars for training and evaluation loops.
pathlib Path Platform-independent file and directory handling.
os os Operating system utilities (file handling, CPU detection, paths).
json json Reading and writing JSON files for configuration and prediction outputs.

4. Data and Variables

Dataset Variables Used
dengue.csv.gz casos
climate.csv.gz temp_min, temp_med, temp_max
precip_min, precip_med, precip_max
pressure_min, pressure_med, pressure_max
rel_humid_min, rel_humid_med, rel_humid_max
thermal_range, rainy_days

5. Model Training

TTM-R2

Item Description
Model IBM Granite Time Series TinyTimeMixer (TTM-R2) (ibm-granite/granite-timeseries-ttm-r2)
Fine-tuning Only the decoder and prediction head were trained; all remaining backbone parameters were frozen.
Input context Sliding window applied in the datasets train1, train2, train3, train4
Forecast horizon 53 weekly observations
Input transformation log1p applied to both input and target tensors
Batch size 256
Optimizer AdamW
Learning rate 1 × 10⁻4
Weight decay 1 × 10⁻²
Learning rate scheduler OneCycleLR
Number of epochs 100
Gradient clipping 1.0
Model selection Lowest average training loss
Saved model ./melhor_modelo_ttm_dengue
Item Description
Input data national_tensor_train_1.pt, national_tensor_train_2.pt, national_tensor_train_3.pt,national_tensor_train_4.pt
Output Weekly forecasts for the required target locations in the IMDC submission format.
Execution Run the training script to fine-tune the model, then run the prediction script using the saved model (./melhor_modelo_ttm_dengue).

PatchTST

Parameter Value
Architecture PatchTSTForPretraining
Model type patchtst
Activation function gelu
Context length 305
Prediction length 24
Number of input channels 15
Number of targets 1
Hidden dimension (d_model) 128
Feed-forward dimension (ffn_dim) 512
Number of hidden layers 3
Number of attention heads 4
Patch length 16
Patch stride 1
Stride 8
Pooling type mean
Distribution output student_t
Loss function mse
Scaling std
Positional encoding sincos
Normalization batchnorm
Normalization epsilon 1e-5
Pre-normalization True
Bias True
Channel attention True
Share embedding True
Share projection True
Use CLS token False
Input masking True
Mask type random
Random mask ratio 0.5
Forecast mask patches [2]
Channel-consistent masking False
Unmasked channel indices None
Mask value 0
Dropout (attention) 0.0
Dropout (feed-forward) 0.0
Dropout (head) 0.0
Dropout (path) 0.0
Dropout (positional) 0.0
Weight initialization std 0.02
Number of parallel samples 100
Output range None
Data type float32
Transformers version 5.3.0
Item Description
Model PatchTST (PatchTSTForPretraining)
Architecture Transformer-based self-supervised pretraining model
Training objective Self-supervised pretraining using masked patch reconstruction
Input variables Dengue cases and climate variables
Input context Sliding window applied in the datasets train1, train2, train3, train4
Prediction horizon 53 weeks (configuration parameter)
Patch length 16
Patch stride 8
Number of input channels Equal to the number of variables in the input tensor
Channel attention Enabled (True)
Shared embedding Enabled (True)
Optimizer AdamW
Backbone learning rate 1 × 10⁻⁵
Head learning rate 1 × 10⁻³
Weight decay 1 × 10⁻²
Learning rate scheduler Linear scheduler
Warm-up steps 0
Batch size 200
Number of epochs 1
Hyperparameter optimization None. Hyperparameters were manually selected.
Model checkpoint Saved after each training iteration as weights/PatchTST-Dengue-ClimateExogs_v{1,2,3,4}.pth and in Hugging Face format under weights/Pretrained_PatchTST_dengue_climate_exogs_v{1,2,3,4}.
Item Description
Input data Tensor containing weekly dengue cases and climate variables.
Output Pretrained PatchTST model weights used for downstream forecasting.
Execution Run the pretraining script to generate the pretrained weights. Afterwards, run the forecasting script that loads weights/Pretrained_PatchTST_dengue_climate_exogs_v{1,2,3,4} to produce the final predictions.

Fine-tuning Routine | PatchTST

Item Description
Model PatchTST (PatchTSTForPrediction)
Initialization Pretrained weights loaded from weights/Pretrained_PatchTST_dengue_climate_exogs_v{1,2,3,4}
Architecture Transformer-based PatchTST
Input variables Dengue cases and climate variables
Input context Sliding window applied in the datasets train1, train2, train3, train4
Forecast horizon 53 weeks
Patch length 16
Patch stride 8
Number of input channels Equal to the number of variables in the input tensor
Channel attention Enabled (True)
Shared embedding Enabled (True)
Optimizer AdamW
Backbone learning rate 1 × 10⁻⁵
Prediction head learning rate 1 × 10⁻³
Weight decay 1 × 10⁻²
Learning rate scheduler Linear scheduler
Warm-up steps 0
Number of epochs 3
Mini-batch size 183 samples
Validation batch size 200
Early stopping Enabled (based on validation loss)
Hyperparameter optimization None. Hyperparameters were manually selected.
Model checkpoint Saved after each epoch as both PyTorch (*.pth) and Hugging Face (save_pretrained) formats.
Item Description
Pretrained model weights/Pretrained_PatchTST_dengue_climate_exogs_v{1,2,3,4}
Training data Strided training windows generated from the dengue and climate tensor.
Validation data Validation tensor loaded through ValidationDataset.
Output Fine-tuned PatchTST model for weekly dengue forecasting.

5. Data Usage Restriction

During the model training phase, the fine-tuning process considered the data availability constraints by reserving only the remaining epidemiological weeks for validation. However, these constraints did not impact the inference stage, since the prediction horizon was predefined and remained unchanged.

6. Predictive Uncertainty

z = {
    "50": 0.67448975,
    "80": 1.28155157,
    "90": 1.64485363,
    "95": 1.95996398
}
predicoes = pred_estado.iloc[:, 1:].to_numpy(dtype=float)

sigma = np.maximum(predicoes * 0.20, 1.0)
resultado = pd.DataFrame({
    "date": datas_validacao,
    "lower_95": np.maximum(pred - z["95"] * sigma[i], 0),
    "lower_90": np.maximum(pred - z["90"] * sigma[i], 0),
    "lower_80": np.maximum(pred - z["80"] * sigma[i], 0),
    "lower_50": np.maximum(pred - z["50"] * sigma[i], 0),
    "median": pred,
    "predicted": pred,
    "upper_50": pred + z["50"] * sigma[i],
    "upper_80": pred + z["80"] * sigma[i],
    "upper_90": pred + z["90"] * sigma[i],
    "upper_95": pred + z["95"] * sigma[i],
})

7. References

  • EKAMBARAM, Vijay et al. Tiny time mixers (ttms): Fast pre-trained models for enhanced zero/few-shot forecasting of multivariate time series. Advances in Neural Information Processing Systems, v. 37, p. 74147-74181, 2024.
  • NIE, Yuqi et al. A time series is worth 64 words: Long-term forecasting with transformers. arXiv preprint arXiv:2211.14730, 2022.
  • MOSQLIMATE. Infodengue-Mosqlimate Dengue Sprint 2026: Instructions. [S. l.], 2026. Disponível em: https://sprint.mosqlimate.org/instructions/. Acesso em: 3 jul. 2026.

About

Dengue forecasting models for sprint 2026

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages