I'm trying to get the likelihood of a data record to belong to a data set characterized by a Bayesian Network.
Here is my current simple code:
library(bnlearn)
library(gRain)
dag = hc(learning.test)
fitted.bnlearn = bn.fit(dag, learning.test, method = "bayes", iss=1)
fitted.grain = as.grain(fitted.bnlearn)
retractEvidence(fitted.grain)
evidence_probability <- setEvidence(fitted.grain, c("A","B", "C", "D", "E", "F"), c("Z", "Z", "Z", "Z", "Z", "Z"))
evidence_probability
pEvidence(evidence_probability)
this outputs:
> pEvidence(evidence_probability)
[1] 1
What definitely is not what I'm expecting. What I'm expecting is that by using the smoothing (iss=1) it should output a very small but not null probability.
There is definitely something that I don't understand (all 6 variables have on ly a, b or c values int the "learning.test" training data set).