All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home

Interface weka.estimators.ConditionalEstimator

public interface ConditionalEstimator
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));
   }
 

Version:
$Revision: 1.2 $
Author:
Len Trigg (trigg@cs.waikato.ac.nz)

Method Index

 o addValue(double, double, double)
Add a new data value to the current estimator.
 o getEstimator(double)
Get a probability estimator for a value
 o getProbability(double, double)
Get a probability for a value conditional on another value

Methods

 o addValue
 public abstract void addValue(double data,
                               double given,
                               double weight)
Add a new data value to the current estimator.

Parameters:
data - the new data value
given - the new value that data is conditional upon
weight - the weight assigned to the data value
 o getEstimator
 public abstract Estimator getEstimator(double given)
Get a probability estimator for a value

Parameters:
given - the new value that data is conditional upon
Returns:
the estimator for the supplied value given the condition
 o getProbability
 public abstract double getProbability(double data,
                                       double given)
Get a probability for a value conditional on another value

Parameters:
data - the value to estimate the probability of
given - the new value that data is conditional upon
Returns:
the estimator for the supplied value given the condition

All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home