public class PoissonEstimator extends PoissonDistribution
PoissonEstimator implements 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
lambda() and log2Prob().
The method 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
written out.
| Constructor and Description |
|---|
PoissonEstimator()
Construct a Poisson estimator.
|
PoissonEstimator(double priorNumSamples,
double priorMean)
Construct a Poisson estimator with a prior set by the specified
number of samples and mean value.
|
| Modifier and Type | Method and Description |
|---|---|
void |
compileTo(ObjectOutput objOut)
Writes a constant Poisson distribution with the same mean
as the current value of this Poisson distribution's mean.
|
double |
mean()
Returns the mean for this estimator.
|
void |
train(long sample)
Add the specified sample to the collection of training data.
|
void |
train(long sample,
double weight)
Add the specified sample to the collection of training data
with the specified weight.
|
log2Probability, minOutcome, probability, variancecumulativeProbability, cumulativeProbabilityGreater, cumulativeProbabilityLess, entropy, maxOutcomepublic PoissonEstimator()
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)
sample - Sample to add to the training data.IllegalArgumentException - If the sample is less thanIllegalStateException - If the sample would overflow the
running sum of samples.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.
sample - Sample to add to the training data.IllegalArgumentException - If the sample is less thanIllegalStateException - If the sample would overflow the
running sum of samples.public double mean()
mean in interface DiscreteDistributionmean in class PoissonDistributionIllegalStateException - If there have been no training
instances or all training instances had value 0, an illegal
state exception is thrown.public void compileTo(ObjectOutput objOut) throws IOException
objOut - Object output to which a compiled version of this
distribution is written.IllegalStateException - If there have been no training
instances or all training instances had value 0, an illegal
state exception is thrown.IOExceptionCopyright © 2016 Alias-i, Inc.. All rights reserved.