public class PoissonEstimator extends PoissonDistribution
PoissonEstimatorimplements the maximum likelihood Poisson distribution given training events. The training events are simply in the form of long integer outcomes. The rate parameter for the unbiased maximum likelihood estimator is given by the mean of the training samples. likelihood unbiased estimator
If there have been no training events, or if all training events
have 0 values, an illegal state exception is thrown by
compileTo(ObjectOutput) writes a compiled
version of this distribution to the specified output. Reading it
back in will produce a constant extension of
PoissonDistribution. Poisson estimators are also serializable and
the estimator read back in will have the same state as the one
|Constructor and Description|
Construct a Poisson estimator.
Construct a Poisson estimator with a prior set by the specified number of samples and mean value.
|Modifier and Type||Method and Description|
Writes a constant Poisson distribution with the same mean as the current value of this Poisson distribution's mean.
Returns the mean for this estimator.
Add the specified sample to the collection of training data.
Add the specified sample to the collection of training data with the specified weight.
log2Probability, minOutcome, probability, variance
cumulativeProbability, cumulativeProbabilityGreater, cumulativeProbabilityLess, entropy, maxOutcome
public PoissonEstimator(double priorNumSamples, double priorMean)
priorNumSamples- The initial number of samples given by the prior.
priorMean- The initial mean.
IllegalArgumentException- If either number is not positive and finite.
public void train(long sample)
public void train(long sample, double weight)
If adding the sample to the running sum would cause overflow, it is not added and an illegal state exception is thrown instead. If overflow is a problem, samples and the resulting rates may be scaled down.
public double mean()
public void compileTo(ObjectOutput objOut) throws IOException