| weka.estimators.ConditionalEstimator
All known Subclasses: weka.estimators.KKConditionalEstimator, weka.estimators.NNConditionalEstimator, weka.estimators.DNConditionalEstimator, weka.estimators.DKConditionalEstimator, weka.estimators.KDConditionalEstimator, weka.estimators.DDConditionalEstimator, weka.estimators.NDConditionalEstimator,
ConditionalEstimator | public interface ConditionalEstimator (Code) | | Interface for conditional probability estimators. Example code:
NNConditionalEstimator newEst = new NNConditionalEstimator();
// Create 50 random points and add them
Random r = new Random(seed);
for(int i = 0; i < 50; i++) {
int x = Math.abs(r.nextInt() % 100);
int y = Math.abs(r.nextInt() % 100);
System.out.println("# " + x + " " + y);
newEst.addValue(x, y, 1);
}
// Pick a random conditional value
int cond = Math.abs(r.nextInt() % 100);
System.out.println("## Conditional = " + cond);
// Print the probabilities conditional on that value
Estimator result = newEst.getEstimator(cond);
for(int i = 0; i <= 100; i+= 5) {
System.out.println(" " + i + " " + result.getProbability(i));
}
author: Len Trigg (trigg@cs.waikato.ac.nz) version: $Revision: 1.6 $ |
addValue | void addValue(double data, double given, double weight)(Code) | | Add a new data value to the current estimator.
Parameters: data - the new data value Parameters: given - the new value that data is conditional upon Parameters: weight - the weight assigned to the data value |
getEstimator | Estimator getEstimator(double given)(Code) | | Get a probability estimator for a value
Parameters: given - the new value that data is conditional upon the estimator for the supplied value given the condition |
getProbability | double getProbability(double data, double given)(Code) | | Get a probability for a value conditional on another value
Parameters: data - the value to estimate the probability of Parameters: given - the new value that data is conditional upon the estimator for the supplied value given the condition |
|
|