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

Implement Analytic Likelihood for Student's T Distribution #81

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

WawerOS
Copy link

@WawerOS WawerOS commented Apr 19, 2022

No description provided.

Copy link
Member

@theogf theogf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the PR!
A few things are missing.
Most importantly, you need to implement

(lik::StudentTLikelihood)(f::Real)

also you need to add the file to the list of included files in src/GPLikelihoods.jl and add a test in the test suite.

Comment on lines +2 to +3
using SpecialFunctions :: logbeta
using IrrationalConstants :: logπ,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You only need one :

Suggested change
using SpecialFunctions :: logbeta
using IrrationalConstants :: logπ,
using SpecialFunctions: logbeta
using IrrationalConstants: logπ,

"""
StudentTLikelihood(σ²,ν)

Student's T likelihood with `σ²` scale and ν degrees of freedom . This is to be used if we assume that the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Student's T likelihood with `σ²` scale and ν degrees of freedom . This is to be used if we assume that the
Student's T likelihood with scale `σ²` and `ν` degrees of freedom. This is to be used if we assume that the

Comment on lines +18 to +19
σ²::Vector{T}
ν::Vector{Tn}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We tend to change the implementation to avoid storing everything in Vector (I know it's not true for GaussianLikelihood but it should change).

Suggested change
σ²::Vector{T}
ν::Vector{Tn}
σ²::T
ν::Tn

function expected_loglikelihood( ::AnalyticExpectation,lik::StudentTLikelihood,q_f :: AbstractVector{<:Normal}, y :: AbstractVector{<:Real})
f_μ = mean.(q_f)
# Why?
return sum(-logbeta(0.5,0.5*lik.ν) .- 0.5*logπ .- 0.5*log(lik.ν) .- log(lik.σ²) .- (0.5*(lik.ν+1))*log.(1 .+ ((y .- f_μ).^2 + var.(q_f)) / lik.σ²))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure that this is correct. The expectation of `log( (y - f)^2) is not available analytically I think

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