question: @ Override public MultivariateTable queryProb ( Query . ProbQuery query ) { BNetwork network = query . getNetwork ( ) ; Set < String > queryVars = new HashSet < String > ( query . getQueryVars ( ) ) ; Assignment evidence = query . getEvidence ( ) ; Map < Assignment , Double > fullJoint = getFullJoint ( network , false ) ; SortedMap < String , Set < Value > > queryValues = new TreeMap < String , Set < Value > > ( ) ; for ( ChanceNode n : network . getChanceNodes ( ) ) { if ( queryVars . contains ( n . getId ( ) ) ) { queryValues . put ( n . getId ( ) , n . getValues ( ) ) ; } } Set < Assignment > queryAssigns = InferenceUtils . getAllCombinations ( queryValues ) ; MultivariateTable . Builder queryResult = new MultivariateTable . Builder ( ) ; for ( Assignment queryA : queryAssigns ) { double sum = 0.0f ; for ( Assignment a : fullJoint . keySet ( ) ) { if ( a . contains ( queryA ) && a . contains ( evidence ) ) { sum += fullJoint . get ( a ) ; } } queryResult . addRow ( queryA , sum ) ; } queryResult . normalise ( ) ; return queryResult . build ( ) ; }
target:  Queries the probability distribution encoded in the Bayesian Network, given a set of query variables, and some evidence.