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

PointMass constraint combined with BP breaks BFE computation #140

Open
bartvanerp opened this issue Jul 26, 2023 · 0 comments
Open

PointMass constraint combined with BP breaks BFE computation #140

bartvanerp opened this issue Jul 26, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@bartvanerp
Copy link
Member

The PointMass constraint without a mean-field factorization breaks the BFE computation. I think this issue is related to #32.

Minimal working examples:

Works fine

@model function test_model()

	# controls
	y = datavar(Float64)

	# prior on state
	u ~ NormalMeanVariance(0, 1)
	z ~ NormalMeanVariance(u, 1)
	y ~ NormalMeanVariance(z, 1)
	
end;
@constraints function test_constraints() 
	q(u, z) = q(u)q(z)
	q(u) :: PointMass
end;
test_results = inference(
	model 			= test_model(),
	data  			= ( y = 1.0, ),
	constraints 	= test_constraints(),
	free_energy     = true,
	initmarginals = (u = PointMass(0), z = Normal(0,1)),
)

Error: Failed to compute the final Bethe Free Energy value. The result is Inf after subtracting PointMass entropies.

@model function test_model()

	# controls
	y = datavar(Float64)

	# prior on state
	u ~ NormalMeanVariance(0, 1)
	z ~ NormalMeanVariance(u, 1)
	y ~ NormalMeanVariance(z, 1)
	
end;
@constraints function test_constraints() 
	q(u) :: PointMass
end;
test_results = inference(
	model 			= test_model(),
	data  			= ( y = 1.0, ),
	constraints 	= test_constraints(),
	free_energy     = true,
)

Returns NaN (Invalid release! call on ScoreActor. The current frame has not been fully specified)

@model function test_model()

	# controls
	y = datavar(Float64)

	# prior on state
	u ~ NormalMeanVariance(0, 1)
	y ~ NormalMeanVariance(u, 1)
	
end;
@constraints function test_constraints() 
	q(u) :: PointMass
end;
test_results = inference(
	model 			= test_model(),
	data  			= ( y = 1.0, ),
	constraints 	= test_constraints(),
	free_energy     = true,
)
@bartvanerp bartvanerp added the bug Something isn't working label Jul 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant