Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def predict(allevidence: Seq[Tuple2[Int,Int]], targetId : Int) : Array[Double] = {
- //want to create a new generic cluster graph with the same factors as this cluster graph
- val tempCG = ClusterGraph()
- clusterGraph.getClusters.foreach(cluster => tempCG.addCluster(cluster.id, cluster.getFactor))
- //set evidence on the new loopyBP
- val loopyBP = LoopyBP(tempCG)
- allevidence.foreach(evidence => if(evidence._2 != -1) loopyBP.setEvidence(evidence))
- loopyBP.marginal(targetId).getValues
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement