tensorflow / tensorflow/probability

Probabilistic regression with 3-parameters LogNormal distribution ?

Open
#1,632 2 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

Hello everyone,

I'm still learning tensorflow probability and I'm trying to learn by browsing the tutorials and applying them (or trying to) to a real business project.
We usually model our target distribution with a 3-parameter lognormal distribution (or the shifted lognormal) and I'm kind of struggling finding a tweak to the tfd.LogNormal without reimplementing a whole class. For the record, the shifted lognormal is defined this way, with X a real r.v.:
If image
then image follows a 3-parameters lognormal: image

So my idea would be to introduce this shift, as a learnable parameter of the distribution, in the code of the first tutorial, case 2:

model = tf.keras.Sequential([
    tf.keras.layers.Dense(2),  # Maybe a 3rd output ?
    tfp.layers.DistributionLambda(lambda t: tfd.LogNormal(loc=t, scale=1e-3 + tf.math.softplus(0.01 * t[...,1:]))),
    # But then how can I tweak the LogNormal distribution ?
])

I feel that I'm wrong and that is simply not possible.
Any tips here ?

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 with the first tutorial, case 2, and review the tfd.LogNormal and DistributionLambda usage shown in the issue. Determine whether a shifted, learnable three-parameter distribution is an appropriate library feature or requires a new distribution implementation; done means a decided approach with documented behavior and relevant tutorial or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
18/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.