pymc-devs / pymc-devs/pymc-examples

Guide for writing custom distributions

Open
#184 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

tracker id
Dominant language
Python
Stars
398
Forks
325
Avg merge
9d 15m
Merged PRs (30d)
1

Description

I would like to contribute a guide for defining custom PyMC3 distributions. I was working with count data and realized that the Poisson distribution didn't offer the flexibility in dispersion I needed since the mean and variance are fixed to each other. I decided that the Generalized Poisson was a better likelihood for my model, so I wrote a custom distribution for it. I have put together a notebook outlining this, and I'll link my PR to this issue.

I posted about this on discourse a while back, so it would be great to post updates for the community in this thread:
https://discourse.pymc.io/t/generalized-poisson-distribution/6535

Since I have now worked with the Generalized Poisson in PyMC3, I would also like to contribute this distribution to the main project: https://github.com/pymc-devs/pymc3/pull/4775

File:
Reviewers:

The sections below may still be pending. If so, the issue is still available, it simply doesn't
have specific guidance yet. Please refer to this overview of updates

Known changes needed

Changes listed in this section should all be done at some point in order to get this
notebook to a "Best Practices" state. However, these are probably not enough!
Make sure to thoroughly review the notebook and search for other updates.

General updates
ArviZ related

Changes for discussion

Changes listed in this section are up for discussion, these are ideas on how to improve
the notebook but may not have a clear implementation, or fix some know issue only partially.

General updates
ArviZ related

Notes

Exotic dependencies
Computing requirements

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the notebook described in the issue alongside the discourse discussion and the referenced Generalized Poisson distribution work. Check whether it explains defining a custom distribution and the motivation from count-data dispersion, then bring it to the project's Best Practices state. Confirm the notebook is complete and its documented examples run successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, python
Domain
documentation, machine-learning
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.