Class Multinomial

  extended by cc.mallet.types.SparseVector
      extended by cc.mallet.types.FeatureVector
          extended by cc.mallet.types.Multinomial
All Implemented Interfaces:
AlphabetCarrying, ConstantMatrix, Vector,
Direct Known Subclasses:

public class Multinomial
extends FeatureVector

A probability distribution over a set of features represented as a FeatureVector. The values associated with each element in the Multinomial/FeaturVector are probabilities and should sum to 1. Features are indexed using feature indices - the index into the underlying Alphabet - rather than using locations the way FeatureVectors do.

Multinomial.Estimator provides a subhierachy of ways to generate an estimate of the probability distribution from counts associated with the features.

Andrew McCallum
See Also:
Serialized Form

Nested Class Summary
static class Multinomial.Estimator
          A hierarchy of classes used to produce estimates of probabilities, in the form of a Multinomial, from counts associated with the elements of an Alphabet.
static class Multinomial.LaplaceEstimator
          An MEstimator with m set to 1.
static class Multinomial.Logged
          A Multinomial in which the values associated with each feature index fi is Math.log(probability[fi]) instead of probability[fi].
static class Multinomial.MAPEstimator
          Unimplemented, but the MEstimators are.
static class Multinomial.MEstimator
          An Estimator in which probability estimates in a Multinomial are generated by adding a constant m (specified at construction time) to each count before dividing by the total of the m-biased counts.
static class Multinomial.MLEstimator
          An MEstimator with m set to 0.
Field Summary
Fields inherited from class cc.mallet.types.SparseVector
hasInfinite, indices, values
Constructor Summary
  Multinomial(double[] probabilities)
  Multinomial(double[] probabilities, Alphabet dictionary)
protected Multinomial(double[] probabilities, Alphabet dictionary, int size, boolean copy, boolean checkSum)
  Multinomial(double[] probabilities, int size)
Method Summary
 void addProbabilitiesTo(double[] vector)
 Alphabet getAlphabet()
 double logProbability(int featureIndex)
 double logProbability(java.lang.Object key)
 double probability(int featureIndex)
 double probability(java.lang.Object key)
 FeatureSequence randomFeatureSequence(Randoms r, int length)
 FeatureVector randomFeatureVector(Randoms r, int size)
 int randomIndex(Randoms r)
 java.lang.Object randomObject(Randoms r)
 int size()
Methods inherited from class cc.mallet.types.FeatureVector
alphabetsMatch, cloneMatrix, cloneMatrixZeroed, contains, getAlphabets, getObjectIndices, location, newFeatureVector, toSimpFile, toString, toString, value
Methods inherited from class cc.mallet.types.SparseVector
absNorm, addTo, addTo, arrayCopyFrom, arrayCopyFrom, arrayCopyInto, dotProduct, dotProduct, dotProduct, dotProduct, extendedDotProduct, extendedDotProduct, getDimensions, getIndices, getNumDimensions, getValues, incrementValue, indexAtLocation, infinityNorm, isBinary, isInfinite, isNaN, isNaNOrInfinite, location, makeBinary, makeNonBinary, map, numLocations, oneNorm, plusEqualsSparse, plusEqualsSparse, print, removeDuplicates, setAll, setValue, setValueAtLocation, singleIndex, singleSize, singleToIndices, singleValue, sortIndices, timesEquals, timesEqualsSparse, timesEqualsSparse, timesEqualsSparseZero, twoNorm, value, value, valueAtLocation, vectorAdd
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail


protected Multinomial(double[] probabilities,
                      Alphabet dictionary,
                      int size,
                      boolean copy,
                      boolean checkSum)


public Multinomial(double[] probabilities,
                   Alphabet dictionary)


public Multinomial(double[] probabilities,
                   int size)


public Multinomial(double[] probabilities)
Method Detail


public int size()


public double probability(int featureIndex)


public double probability(java.lang.Object key)


public double logProbability(int featureIndex)


public double logProbability(java.lang.Object key)


public Alphabet getAlphabet()
Specified by:
getAlphabet in interface AlphabetCarrying
getAlphabet in class FeatureVector


public void addProbabilitiesTo(double[] vector)


public int randomIndex(Randoms r)


public java.lang.Object randomObject(Randoms r)


public FeatureSequence randomFeatureSequence(Randoms r,
                                             int length)


public FeatureVector randomFeatureVector(Randoms r,
                                         int size)