Package cc.mallet.types
Class Multinomial
- java.lang.Object
-
- cc.mallet.types.SparseVector
-
- cc.mallet.types.FeatureVector
-
- cc.mallet.types.Multinomial
-
- All Implemented Interfaces:
AlphabetCarrying,ConstantMatrix,Vector,java.io.Serializable
- Direct Known Subclasses:
Multinomial.Logged
public class Multinomial extends FeatureVector
A probability distribution over a set of features represented as aFeatureVector. 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.Estimatorprovides a subhierachy of ways to generate an estimate of the probability distribution from counts associated with the features.- Author:
- Andrew McCallum mccallum@cs.umass.edu
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMultinomial.EstimatorA 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 classMultinomial.LaplaceEstimatorAn MEstimator with m set to 1.static classMultinomial.LoggedA Multinomial in which the values associated with each feature index fi is Math.log(probability[fi]) instead of probability[fi].static classMultinomial.MAPEstimatorUnimplemented, but the MEstimators are.static classMultinomial.MEstimatorAn 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 classMultinomial.MLEstimatorAn MEstimator with m set to 0.
-
Field Summary
-
Fields inherited from class cc.mallet.types.SparseVector
hasInfinite, indices, values
-
-
Constructor Summary
Constructors Modifier Constructor Description Multinomial(double[] probabilities)Multinomial(double[] probabilities, int size)Multinomial(double[] probabilities, Alphabet dictionary)protectedMultinomial(double[] probabilities, Alphabet dictionary, int size, boolean copy, boolean checkSum)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddProbabilitiesTo(double[] vector)AlphabetgetAlphabet()doublelogProbability(int featureIndex)doublelogProbability(java.lang.Object key)doubleprobability(int featureIndex)doubleprobability(java.lang.Object key)FeatureSequencerandomFeatureSequence(Randoms r, int length)FeatureVectorrandomFeatureVector(Randoms r, int size)intrandomIndex(Randoms r)java.lang.ObjectrandomObject(Randoms r)intsize()-
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
-
-
-
-
Constructor Detail
-
Multinomial
protected Multinomial(double[] probabilities, Alphabet dictionary, int size, boolean copy, boolean checkSum)
-
Multinomial
public Multinomial(double[] probabilities, Alphabet dictionary)
-
Multinomial
public Multinomial(double[] probabilities, int size)
-
Multinomial
public Multinomial(double[] probabilities)
-
-
Method Detail
-
size
public int size()
-
probability
public double probability(int featureIndex)
-
probability
public double probability(java.lang.Object key)
-
logProbability
public double logProbability(int featureIndex)
-
logProbability
public double logProbability(java.lang.Object key)
-
getAlphabet
public Alphabet getAlphabet()
- Specified by:
getAlphabetin interfaceAlphabetCarrying- Overrides:
getAlphabetin classFeatureVector
-
addProbabilitiesTo
public void addProbabilitiesTo(double[] vector)
-
randomIndex
public int randomIndex(Randoms r)
-
randomObject
public java.lang.Object randomObject(Randoms r)
-
randomFeatureSequence
public FeatureSequence randomFeatureSequence(Randoms r, int length)
-
randomFeatureVector
public FeatureVector randomFeatureVector(Randoms r, int size)
-
-