Skip to content

Add Tweedie distribution - #3277

Open
timoschowski wants to merge 1 commit into
awslabs:devfrom
timoschowski:feature/tweedie-distribution
Open

Add Tweedie distribution #3277
timoschowski wants to merge 1 commit into
awslabs:devfrom
timoschowski:feature/tweedie-distribution

Conversation

@timoschowski

Copy link
Copy Markdown
Contributor

Summary

  • Add Tweedie distribution implementation for modeling non-negative data with exact zeros
  • Suitable for insurance claims, rainfall amounts, intermittent demand forecasting

Changes

  • Tweedie class: PyTorch distribution with compound Poisson-Gamma sampling and saddle-point log_prob
  • TweedieOutput class: GluonTS output for use with DeepAR and other estimators
  • Unit tests: Parameter recovery via MLE, distribution properties

References

Test plan

  • Unit tests pass: pytest test/torch/modules/test_tweedie_distribution_inference.py
  • Import test: from gluonts.torch.distributions import TweedieOutput
  • Integration tested with DeepAR on synthetic and electricity datasets

🤖 Generated with Claude Code

@timoschowski timoschowski changed the title Add Tweedie distribution for non-negative data with point mass at zero Add Tweedie distribution Feb 3, 2026
Implement Tweedie distribution following PyTorch PR #171705, suitable for
modeling non-negative data with exact zeros (insurance claims, rainfall,
intermittent demand).

Features:
- Tweedie class extending torch.distributions.Distribution
  - Parameters: mu (mean), dispersion, power (in range 1-2)
  - Compound Poisson-Gamma sampling algorithm
  - Saddle-point approximation for log_prob (Dunn & Smyth 2005)
- TweedieOutput class for use with GluonTS estimators (DeepAR, etc.)
  - Learnable mu, dispersion, and power parameters
  - Proper domain mapping via softplus/sigmoid

Includes unit tests for parameter recovery via MLE and distribution properties.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@timoschowski
timoschowski force-pushed the feature/tweedie-distribution branch from 90e3fea to f748a38 Compare February 3, 2026 15:48
@timoschowski

Copy link
Copy Markdown
Contributor Author

I ran this on sinoidal data and electricity data (test script not included in PR) and the results look reasonable.
deepar_electricity_comparison
deepar_tweedie_comparison

@timoschowski timoschowski mentioned this pull request Feb 3, 2026
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