GPLikelihoods.jl icon indicating copy to clipboard operation
GPLikelihoods.jl copied to clipboard

`CategoricalLikelihood` should contain the input dimensionality

Open theogf opened this issue 3 years ago • 4 comments

I am planning to write a nlatent function for the package, returning the dimensionality of the input needed for the likelihood. It is very practical to initialize things with a given likelihood.

However, the current version of CategoricalLikelihood has no way of knowing the number of latent needed. what do you think about enforcing the number of outputs in the likelihood?

theogf avatar Dec 16 '21 16:12 theogf

I think I would like to see an example of how using this would look with / without this requirement. i.e. what would we currently do, vs what would we do if this data were stored in the likelihood.

willtebbutt avatar Mar 09 '22 10:03 willtebbutt

I guess something like:

struct CategoricalLikelihood{Tl<:AbstractLink} <: AbstractLikelihood
    nclass::Int
    invlink::Tl
end

CategoricalLikelihood(nclass, l=BijectiveSimplexLink(softmax)) = CategoricalLikelihood(nclass, link(l))

nlatent(l::CategoricalLikelihood) = l.nclass
nlatent(l::CategoricalLikelihood{<:BijectiveSimplexLink}) = l.nclass - 1

Eventually this could be used to check the input dimensionality. But I am more imagining a front end model where you would pass, kernel, likelihood and inference and that it could be automatically inferred how many latent GPs you need

theogf avatar Mar 09 '22 11:03 theogf

I will just do a PR proposal and we can see if it makes sense

theogf avatar Mar 10 '22 10:03 theogf

Sorry, yeah, that seems like a good idea.

willtebbutt avatar Mar 10 '22 10:03 willtebbutt