@PublicationReference(author="Wikipedia", title="Conjugate Prior", type=WebPage, year=2009, url="http://en.wikipedia.org/wiki/Conjugate_prior") public class MultinomialBayesianEstimator extends AbstractConjugatePriorBayesianEstimator<Vector,Vector,MultinomialDistribution,DirichletDistribution> implements ConjugatePriorBayesianEstimatorPredictor<Vector,Vector,MultinomialDistribution,DirichletDistribution>
Modifier and Type | Class and Description |
---|---|
static class |
MultinomialBayesianEstimator.Parameter
Parameter of this conjugate prior relationship.
|
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_NUM_CLASSES
Default number of classes/labels, 2.
|
static int |
DEFAULT_NUM_TRIALS
Default number of trials, 2.
|
parameter
Modifier | Constructor and Description |
---|---|
|
MultinomialBayesianEstimator()
Creates a new instance of MultinomialBayesianEstimator
|
protected |
MultinomialBayesianEstimator(BayesianParameter<Vector,MultinomialDistribution,DirichletDistribution> parameter)
Creates a new instance
|
|
MultinomialBayesianEstimator(DirichletDistribution initialBelief,
int numTrials)
Creates a new instance of MultinomialBayesianEstimator
|
|
MultinomialBayesianEstimator(int numTrials)
Creates a new instance of MultinomialBayesianEstimator
|
|
MultinomialBayesianEstimator(int numClasses,
int numTrials)
Creates a new instance of MultinomialBayesianEstimator
|
|
MultinomialBayesianEstimator(MultinomialDistribution conditional,
DirichletDistribution prior)
Creates a new instance of PoissonBayesianEstimator
|
Modifier and Type | Method and Description |
---|---|
double |
computeEquivalentSampleSize(DirichletDistribution belief)
Computes the equivalent sample size of using the given prior.
|
MultinomialDistribution |
createConditionalDistribution(Vector parameter)
Creates an instance of the class conditional distribution,
parameterized by the given parameter value.
|
MultinomialBayesianEstimator.Parameter |
createParameter(MultinomialDistribution conditional,
DirichletDistribution prior)
Creates a parameter linking the conditional and prior distributions
|
MultivariatePolyaDistribution |
createPredictiveDistribution(DirichletDistribution posterior)
Creates the predictive distribution of new data given the posterior.
|
int |
getNumTrials()
Getter for numTrials
|
void |
setNumTrials(int numTrials)
Setter for numTrials
|
void |
update(DirichletDistribution belief,
Vector value)
The
update method updates an object of ResultType using
the given new data of type DataType , using some form of
"learning" algorithm. |
clone, createInitialLearnedObject, getInitialBelief, getParameter, setParameter
learn, learn, update
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getParameter
learn
clone
createInitialLearnedObject, update
public static final int DEFAULT_NUM_TRIALS
public static final int DEFAULT_NUM_CLASSES
public MultinomialBayesianEstimator()
public MultinomialBayesianEstimator(int numTrials)
numTrials
- Number of trials in the distribution, must be greater than 0.public MultinomialBayesianEstimator(int numClasses, int numTrials)
numClasses
- Number of classes/labels/parametersnumTrials
- Number of trials in the distribution, must be greater than 0.public MultinomialBayesianEstimator(DirichletDistribution initialBelief, int numTrials)
initialBelief
- Initial belief of the prior.numTrials
- Number of trials in the distribution, must be greater than 0.public MultinomialBayesianEstimator(MultinomialDistribution conditional, DirichletDistribution prior)
prior
- Default conjugate prior.conditional
- Conditional distribution of the conjugate prior.protected MultinomialBayesianEstimator(BayesianParameter<Vector,MultinomialDistribution,DirichletDistribution> parameter)
parameter
- Bayesian hyperparameter relationship between the conditional
distribution and the conjugate prior distribution.public MultinomialBayesianEstimator.Parameter createParameter(MultinomialDistribution conditional, DirichletDistribution prior)
ConjugatePriorBayesianEstimator
createParameter
in interface ConjugatePriorBayesianEstimator<Vector,Vector,MultinomialDistribution,DirichletDistribution>
conditional
- Distribution from which observations are generatedprior
- Distribution that generates parameters for the conditionalpublic double computeEquivalentSampleSize(DirichletDistribution belief)
ConjugatePriorBayesianEstimator
computeEquivalentSampleSize
in interface ConjugatePriorBayesianEstimator<Vector,Vector,MultinomialDistribution,DirichletDistribution>
belief
- Prior belief to measure.public void update(DirichletDistribution belief, Vector value)
IncrementalLearner
update
method updates an object of ResultType
using
the given new data of type DataType
, using some form of
"learning" algorithm.update
in interface IncrementalLearner<Vector,DirichletDistribution>
belief
- The object to update.value
- The new data for the learning algorithm to use to update
the object.public int getNumTrials()
public void setNumTrials(int numTrials)
numTrials
- Number of trials in the distribution, must be greater than 0.public MultinomialDistribution createConditionalDistribution(Vector parameter)
ConjugatePriorBayesianEstimator
createConditionalDistribution
in interface ConjugatePriorBayesianEstimator<Vector,Vector,MultinomialDistribution,DirichletDistribution>
createConditionalDistribution
in class AbstractConjugatePriorBayesianEstimator<Vector,Vector,MultinomialDistribution,DirichletDistribution>
parameter
- Parameter used to create the class conditional distribution.public MultivariatePolyaDistribution createPredictiveDistribution(DirichletDistribution posterior)
BayesianEstimatorPredictor
createPredictiveDistribution
in interface BayesianEstimatorPredictor<Vector,Vector,DirichletDistribution>
posterior
- Posterior distribution from which to compute the predictive posterior.