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

DiscreteBayesNet - CPD order and named categories #89

Open
drbenvincent opened this issue May 22, 2020 · 2 comments
Open

DiscreteBayesNet - CPD order and named categories #89

drbenvincent opened this issue May 22, 2020 · 2 comments

Comments

@drbenvincent
Copy link

I am starting a project using discrete Bayes Nets and I am hoping to use this package, rather than one of the python packages (eg pomegranate or pgmpy). But I have a few questions...

I managed to get a simple example working (made up numbers), with

bn = DiscreteBayesNet()
push!(bn, DiscreteCPD(:smoke, [0.25,0.75]))
push!(bn, DiscreteCPD(:covid, [0.1,0.9]))
push!(bn, DiscreteCPD(:hospital, [:smoke, :covid], [2,2], 
        [Categorical([0.9,0.1]),
         Categorical([0.2,0.8]),
         Categorical([0.7,0.3]),
         Categorical([0.01,0.99]),
        ]))

Could I request a little more information in the documentation about the way in which this CPD is coded? Eventually I was able to figure it out by asking for the CPD table with table(bn, :hospital)
Screenshot 2020-05-22 at 16 11 02
but I'd definitely say more documentation here would help people out.

Secondly, is there a way to name the levels that each node can take? From the docs I attempted a guess at something like this...

bn = DiscreteBayesNet()
push!(bn, DiscreteCPD(:smoke, NamedCategorical([:yes, :no], [0.25, 0.75])))
push!(bn, DiscreteCPD(:covid, NamedCategorical([:yes, :no], [0.1, 0.9])))
push!(bn, DiscreteCPD(:hospital, [:smoke, :covid], [2,2], 
        [NamedCategorical([:yes, :no], [0.9, 0.1]),
         NamedCategorical([:yes, :no], [0.2, 0.8]),
         NamedCategorical([:yes, :no], [0.7, 0.3]),
         NamedCategorical([:yes, :no], [0.01, 0.99])]))

but no luck. Any pointers or updates to the docs on this would be very much appreciated.
Ben

@mathlawguy
Copy link

I too would be interested in either getting NamedCategorical to work with DiscreteBayesNet or having that feature added. As I understand it, the infer function works only with DiscreteBayesNet. Since mostly what I want to do is "infer," having the ability to use NamedCategorical would help the clarity of my programs.

@mykelk
Copy link
Member

mykelk commented Jul 20, 2021

@dwijenchawra is this issue of interest to you?

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

3 participants