Added Daniel's Bayes Net code. Converted example code to unit tests. Minor code clean-up.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package dkohl.bayes.probability.distribution.tree;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import dkohl.bayes.probability.Assignment;
|
||||
import dkohl.bayes.probability.Probability;
|
||||
import dkohl.bayes.probability.distribution.ProbabilityDistribution;
|
||||
|
||||
/**
|
||||
* Just a dummy node. Always returns the probability value, ignoring the
|
||||
* assignment.
|
||||
*
|
||||
* @author Daniel Kohlsdorf
|
||||
*/
|
||||
public class ProbabilityLeaf implements ProbabilityDistribution {
|
||||
|
||||
private Probability probability;
|
||||
|
||||
public ProbabilityLeaf(Probability probability) {
|
||||
super();
|
||||
this.probability = probability;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Probability eval(LinkedList<Assignment> assignment) {
|
||||
return probability;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user