Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Implement beta likelihood #297

Open
thomaspinder opened this issue Jun 8, 2023 · 4 comments
Open

feat: Implement beta likelihood #297

thomaspinder opened this issue Jun 8, 2023 · 4 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Milestone

Comments

@thomaspinder
Copy link
Collaborator

Feature Request

Implement the Beta likelihood function. This can be easily achieved as the link function and integration strategy will be identical to the Bernoulli likelihood.

Related Code

https://github.com/JaxGaussianProcesses/GPJax/blob/main/gpjax/likelihoods.py#L170

@thomaspinder thomaspinder added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Jun 8, 2023
@thomaspinder thomaspinder added this to the v1.0.0 milestone Jun 8, 2023
@brandall25
Copy link

@thomaspinder can I have a go at this?

@thomaspinder
Copy link
Collaborator Author

Of course! Do let me know if you need a hand.

@brandall25
Copy link

Hi @thomaspinder , this is what I have so far:

@dataclass
class Beta(AbstractLikelihood):
    def link_function(self, alpha: float, beta: float) -> tfd.Distribution:
        r"""The probit link function of the Beta likelihood.

        Args:
            alpha : alpha parameter, indicating mean number of successes
            beta  : beta parameter, indicating mean number of failures

        Returns
        -------
            tfd.Distribution: The likelihood function.
        """
        return tfd.Beta(tf.constant(alpha), tf.constant(beta))

    def predict(self, dist: tfd.Distribution, alpha: float, beta: float) -> tfd.Distribution:
        r"""Evaluate the pointwise predictive distribution.

        Evaluate the pointwise predictive distribution, given a Gaussian
        process posterior and likelihood parameters.

        Args:
            dist (tfd.Distribution): The Gaussian process posterior, evaluated
                at a finite set of test points.
            alpha (float) : alpha parameter, indicating mean number of successes
            beta  (float) : beta parameter, indicating mean number of failures

        Returns
        -------
            tfd.Distribution: The pointwise predictive distribution.
        """
        return self.link_function(alpha, beta)

Couple questions:

  1. Should I keep alpha and beta as inputs to the predict function? Or, should I try to infer them from the base distribution class?
  2. Do I need to specify any of the other arguments for the call to tfd.Beta()?

Thanks!

@thomaspinder
Copy link
Collaborator Author

Hi @brandall25. This is starting to look good! Are you able to open this as a PR to main? It'll be easier for me to make comments and give feedback there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants