Reputation: 320
I'm trying to work out P(m|s)
probability of meningitis given "stiff neck"
So I'm trying to represent this in the model: P(m|s) = (P(s|m) * P(m))/P(s)
P(s) = 0.1
P(m) = 0.0001
P(s|m) = 0.8
this is how I've represented it:
meningitis = DiscreteDistribution({"have meningitis": 0.0001, "no meningitis": 0.9999})
stiffNeckIfMeningitis = ConditionalProbabilityTable(
[["have meningitis", "stiff", 0.8],
["have meningitis", "not stiff", 0.2]
],[meningitis])
I have to specify the values for ["no meningitis", "stiff", x]
and ["no meningitis", "not stiff", x]
which I did by manually working out the values, but should the bayes network not be doing this?
Should I have have a Discrete distribution like this too:
neck = DiscreteDistribution({ "stiff": 0.1, "not_sitff": 0.9})
I'm completely stumped on how to represent the relationships in the model = BayesNetwork()
bit.
At the moment I have:
s1 = Node(meningitis, name="meningitis")
s2 = Node(stiffNeckIfMeningits, name="stiffNeckIfMeningits")
model.add_states(meningitis, stiffNeckIfMeningits)
model.add_edges(s1, s2)
model.bake()
Upvotes: 3
Views: 59