public class MultivariateEstimator extends MultivariateDistribution implements Serializable
MultivariateEstimator provides a maximum likelihood
estimator of a multivariate distribution based on training samples.
Training is carried out by incrementing outcomes through train(String,long). At any point, the distribution provides a
maximum likelihood estimator.
Simple additive smoothing can be achieved through the API by initially incrementing counts for all possible outcomes by one.
Serialization simply stores the current multivariate estimator
and reconstructs it exactly as is under deserialization (that is,
the class of the deserialized object is
MultivariateEstimator). Compilation stores a more
efficient and compact version of the estimator, which deserializes
to a MultivariateDistribution rather than a
MultivariateEstimator.
| Constructor and Description |
|---|
MultivariateEstimator()
Construct a multivariate estimator with no known outcomes
or counts.
|
| Modifier and Type | Method and Description |
|---|---|
void |
compileTo(ObjectOutput objOut)
Writes a constant version of this estimator to the specified
object output.
|
long |
getCount(long outcome)
Returns the count in this estimator for the specified outcome.
|
long |
getCount(String outcomeLabel)
Returns the count for the specified outcome.
|
String |
label(long outcome)
Return the label for the specified outcome.
|
int |
numDimensions()
Returns the number of dimensions for this multivariate
estimator.
|
long |
outcome(String outcomeLabel)
Return the outcome for the specified label.
|
double |
probability(long outcome)
Returns the multivariate probability estimate for the specified
outcome.
|
void |
resetCount(String outcomeLabel)
Resets the count for the specified outcome label to zero.
|
void |
train(String outcomeLabel,
long increment)
Increment counts in this estimator for the specified
outcome by the specified increment.
|
long |
trainingSampleCount()
Returns the total count of training sample.
|
log2Probability, maxOutcome, minOutcome, probabilitycumulativeProbability, cumulativeProbabilityGreater, cumulativeProbabilityLess, entropy, log2Probability, mean, variancepublic MultivariateEstimator()
public void resetCount(String outcomeLabel)
outcomeLabel - Label of outcome that is reset.IllegalArgumentException - If the outcome label is not
known.public void train(String outcomeLabel, long increment)
outcomeLabel - Label of sample outcome.increment - Amount to increment count for outcome.IllegalArgumentException - If the result would
be a count higher than the maximum long value or if the
increment is less than one.public long outcome(String outcomeLabel)
outcome in class MultivariateDistributionoutcomeLabel - Label whose outcome is returned.public String label(long outcome)
label in class MultivariateDistributionoutcome - Outcome whose label is returned.public int numDimensions()
numDimensions in class MultivariateDistributionpublic double probability(long outcome)
probability in interface DiscreteDistributionprobability in class MultivariateDistributionoutcome - The outcome whose probability is returned.public long getCount(long outcome)
outcome - The outcome whose probability is returned.IllegalArgumentException - If the outcome is not between
zero and the maximum outcome inclusive.public long getCount(String outcomeLabel)
outcomeLabel - Label of specified outcome.IllegalArgumentException - If thepublic long trainingSampleCount()
IllegalArgumentException - If the outcome is not between
zero and the maximum outcome inclusive.public void compileTo(ObjectOutput objOut) throws IOException
MultivariateConstant with the same
distribution as the estimated distribution.objOut - The object output to which this estimator is
compiled.IOException - If there is an I/O exception writing to the
output.Copyright © 2019 Alias-i, Inc.. All rights reserved.