Open sethaxen opened 8 months ago
AbstractMixture has no implementation of gradlogpdf, but this is straightforward to implement in terms of gradlogpdf of the components, e.g.
AbstractMixture
gradlogpdf
function Distributions.gradlogpdf(d::AbstractMixtureModel, x) ps = probs(d) ds = components(d) inds = filter(i -> !iszero(ps[i]), eachindex(ps, ds)) ws = pweights(softmax!([log(ps[i]) + logpdf(ds[i], x) for i in inds])) g = mean(map(i -> gradlogpdf(ds[i], x), inds), ws) return g end
AbstractMixture
has no implementation ofgradlogpdf
, but this is straightforward to implement in terms ofgradlogpdf
of the components, e.g.