-
Notifications
You must be signed in to change notification settings - Fork 5
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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.
using SpecialFunctions :: logbeta | ||
using IrrationalConstants :: logπ, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You only need one :
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
σ²::Vector{T} | ||
ν::Vector{Tn} |
There was a problem hiding this comment.
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).
σ²::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.σ²)) |
There was a problem hiding this comment.
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
No description provided.