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

Towards BayesNets 2.0 #46

Open
5 of 8 tasks
tawheeler opened this issue Dec 14, 2016 · 4 comments
Open
5 of 8 tasks

Towards BayesNets 2.0 #46

tawheeler opened this issue Dec 14, 2016 · 4 comments

Comments

@tawheeler
Copy link
Contributor

tawheeler commented Dec 14, 2016

We dropped support for Julia 0.4, so the next release will need to increment the major tick. Thus, BayesNets v2.0.0

Before I tag a new release I would like to:

Does anyone have any additional issues to post? Things we need to clear up before moving forward?

@mykelk
Copy link
Member

mykelk commented Dec 14, 2016

Looks good to me!

@tawheeler
Copy link
Contributor Author

We now have a common interface for samplers:

abstract BayesNetSampler
Base.rand!(a::Assignment, bn::BayesNet, sampler::BayesNetSampler)

The only function new samplers need to implement is rand!

From that we provide:

Base.rand(bn::BayesNet, sampler::BayesNetSampler)
Base.rand(bn::BayesNet, sampler::BayesNetSampler, nsamples::Integer)

rand(bn) defaults to DirectSampler
rand(bn, N) also
rand(bn, evidence) defaults to RejectionSampler
rand(bn, N, evidence) also

@tawheeler
Copy link
Contributor Author

tawheeler commented Jan 5, 2017

I introduced a new common interface for inference:

"""
Abstract type for probability inference
"""
abstract InferenceMethod

"""
Infer p(query|evidence)
 - inference on a DiscreteBayesNet will always return a DataFrame factor over the evidence variables
"""
infer(im::InferenceMethod, bn::BayesNet, query::Vector{NodeName}; evidence::Assignment=Assignment()) = error("infer not implemented for $(typeof(im))")
infer(im::InferenceMethod, bn::BayesNet, query::NodeName; evidence::Assignment=Assignment()) = infer(im, bn, [query]; evidence=evidence)

Ideally it would return a distribution over the queried variables, ie a multivariable distribution. That isn't really possible right now, so for discrete variables we are using factors (which are basically the same thing) and for continuous / hybrid we can't really do anything.

@tawheeler
Copy link
Contributor Author

New Inference branch. Incorporated updated (the excellent) inference methods from @hamzaelsaawy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants