weka.estimators
Class PoissonEstimator

java.lang.Object
  extended byweka.estimators.PoissonEstimator
All Implemented Interfaces:
Estimator, java.io.Serializable

public class PoissonEstimator
extends java.lang.Object
implements Estimator

Simple probability estimator that places a single Poisson distribution over the observed values.

Version:
$Revision: 1.4 $
Author:
Len Trigg (trigg@cs.waikato.ac.nz)
See Also:
Serialized Form

Field Summary
private  double m_Lambda
          The average number of times an event occurs in an interval.
private  double m_NumValues
          The number of values seen
private  double m_SumOfValues
          The sum of the values seen
 
Constructor Summary
PoissonEstimator()
           
 
Method Summary
 void addValue(double data, double weight)
          Add a new data value to the current estimator.
 double getProbability(double data)
          Get a probability estimate for a value
private  double logFac(double x)
          Calculates the log factorial of a number.
static void main(java.lang.String[] argv)
          Main method for testing this class.
private  double Poisson(double x)
          Returns value for Poisson distribution
 java.lang.String toString()
          Display a representation of this estimator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_NumValues

private double m_NumValues
The number of values seen


m_SumOfValues

private double m_SumOfValues
The sum of the values seen


m_Lambda

private double m_Lambda
The average number of times an event occurs in an interval.

Constructor Detail

PoissonEstimator

public PoissonEstimator()
Method Detail

logFac

private double logFac(double x)
Calculates the log factorial of a number.

Parameters:
x - input number.
Returns:
log factorial of x.

Poisson

private double Poisson(double x)
Returns value for Poisson distribution

Parameters:
x - the argument to the kernel function
Returns:
the value for a Poisson kernel

addValue

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

Specified by:
addValue in interface Estimator
Parameters:
data - the new data value
weight - the weight assigned to the data value

getProbability

public double getProbability(double data)
Get a probability estimate for a value

Specified by:
getProbability in interface Estimator
Parameters:
data - the value to estimate the probability of
Returns:
the estimated probability of the supplied value

toString

public java.lang.String toString()
Display a representation of this estimator


main

public static void main(java.lang.String[] argv)
Main method for testing this class.

Parameters:
argv - should contain a sequence of numeric values