public class BernoulliEstimator extends BernoulliDistribution implements Compilable
BernoulliEstimator provides a maximum likelihood
estimate of a Bernoulli distribution. Training samples are
provided through the method train(boolean,int) specifying
success or failure and the number of samples. An unbiased
estimator for a Bernoulli distribution's probability of success is
simply the percentage of successes.FAILURE_LABEL, SUCCESS_LABEL| Constructor and Description |
|---|
BernoulliEstimator()
Construct a Bernoulli estimator with zero counts.
|
| Modifier and Type | Method and Description |
|---|---|
void |
compileTo(ObjectOutput objOut)
Compiles this Bernoulli estimator to the specified object
output.
|
long |
numTrainingSamples()
Returns the number of training samples provided for this
estimator.
|
long |
numTrainingSamples(boolean success)
Returns the number of training samples for the specified
outcome, success or failure.
|
double |
successProbability()
Returns the maximum likelihood estimate of success from
the training samples provided.
|
void |
train(boolean success)
Trains the estimator with one sample that is specified as
a success or failure.
|
void |
train(boolean success,
int numSamples)
Train this estimator with the specified number of samples
for success or failure as specified.
|
label, maxOutcome, numDimensions, probability, variancelog2Probability, minOutcome, outcome, probabilitycumulativeProbability, cumulativeProbabilityGreater, cumulativeProbabilityLess, entropy, log2Probability, meanpublic BernoulliEstimator()
public void train(boolean success,
int numSamples)
success - A flag for whether the training samples
are for success or failure.numSamples - Number of samples to train.public void train(boolean success)
success - Flag for whether the sample was a success
or a failure.public double successProbability()
successProbability in class BernoulliDistributionpublic long numTrainingSamples()
public long numTrainingSamples(boolean success)
success - Flag indicating whether outcome is success
or failure.public void compileTo(ObjectOutput objOut) throws IOException
BernoulliConstant with the same success probability as
the estimate derived from this estimator.compileTo in interface CompilableobjOut - Object output to which this Bernoulli distribution
is written.IOException - If there is an I/O error compiling the
object.Copyright © 2016 Alias-i, Inc.. All rights reserved.