Skip to content

Commit

Permalink
minor fix for RxInfer
Browse files Browse the repository at this point in the history
  • Loading branch information
bvdmitri committed Oct 31, 2023
1 parent b6fd0c7 commit bea7d20
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/densities/mixture.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using StatsFuns: softmax
using StatsFuns: softmax, logsumexp
using LinearAlgebra

export MixtureDistribution
Expand Down Expand Up @@ -82,19 +82,19 @@ function Base.prod(
end

function BayesBase.compute_logscale(
new_dist::MixtureDistribution, left_dist::MixtureDistribution, right_dist::Any
new_dist::MixtureDistribution, left::MixtureDistribution, right::Any
)

# get prior weights and components
w = left_dist.weights
dists = left_dist.components
# get weights and components
w = weights(left)
dists = components(left)

# get new distributions
dists_new = map(dist -> prod(ProdAnalytical(), dist, right_dist), dists)
dists_new = map(dist -> prod(default_prod_rule(dist, right), dist, right), dists)

# get scales
logscales = map(
(dist, dist_new) -> compute_logscale(dist_new, dist, right_dist), dists, dists_new
(dist, dist_new) -> compute_logscale(dist_new, dist, right), dists, dists_new
)

# compute updated weights
Expand Down

0 comments on commit bea7d20

Please sign in to comment.