예제 #1
0
        public static double[] ask(Query q, ProbabilityDistribution pd)
        {
            double[] probDist            = new double[2];
            Dictionary <string, bool?> h = q.EvidenceVariables;

            // true probability
            h[q.QueryVariable] = true;
            probDist[0]        = pd.ProbabilityOf(h);
            // false probability
            h[q.QueryVariable] = false;
            probDist[1]        = pd.ProbabilityOf(h);
            return(Util.Util.Normalize(probDist));
        }
예제 #2
0
 public double ProbabilityOf(Dictionary <string, bool?> conditions)
 {
     return(distribution.ProbabilityOf(conditions));
 }