All Packages Class Hierarchy This Package Previous Next Index WEKA's home
// Create a discrete estimator that takes values 0 to 9
DiscreteEstimator newEst = new DiscreteEstimator(10, true);
// Create 50 random integers first predicting the probability of the
// value, then adding the value to the estimator
Random r = new Random(seed);
for(int i = 0; i < 50; i++) {
current = Math.abs(r.nextInt() % 10);
System.out.println(newEst);
System.out.println("Prediction for " + current
+ " = " + newEst.getProbability(current));
newEst.addValue(current, 1);
}
public void addValue(double data, double weight)
data
- the new data value
weight
- the weight assigned to the data value
public double getProbability(double data)
data
- the value to estimate the probability of
All Packages Class Hierarchy This Package Previous Next Index WEKA's home