tensorflow / tensorflow/probability

PoissonLogNormalQuadratureCompound parameterization doesn't match LogNormal parameterization

Open
#929 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
4.4k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

What are loc and scale in this distribution.

Consider this:

import tensorflow_probability as tfp
import numpy as np
tfd = tfp.distributions

loc = 2.4
scale = 0.8

d1 = tfd.JointDistributionSequential([
    tfd.LogNormal(loc, scale),
    lambda z: tfd.Poisson(z)
])

d2 = tfd.PoissonLogNormalQuadratureCompound(loc, scale)

N = 100000
sample_1 = d1.sample(N)[1].numpy()
sample_2 = d2.sample(N).numpy()
sample_3 = np.random.poisson(np.random.lognormal(loc, scale , size=N))

print(sample_1.mean(), sample_1.var())
print(sample_2.mean(), sample_2.var())
print(sample_3.mean(), sample_3.var())
15.20101 217.6014
28675494000.0 5.8343047e+21
15.22877 224.11053428710002

Is it expected that the parameterization is different to LogNormal?

How can I obtain the "standard parameterization"? . I have tried to do log(scale) which gives closer but not correct answer.

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

Start by running the provided Python snippet and inspect the implementation and documentation for PoissonLogNormalQuadratureCompound alongside LogNormal. Compare how loc and scale are interpreted and identify whether the discrepancy is in parameter handling or the documented behavior. Done means the parameterization is explained clearly and the reported mismatch is corrected or covered by an appropriate regression check.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python, tensorflow
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.