|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcommon.SamplingMultiset
public class SamplingMultiset
Multiset that allows sampling, but not iteration or removals. Uses a sorted map (from elements to integers) so the sampling is reproducible. Null elements cannot be added.
Constructor Summary | |
---|---|
SamplingMultiset()
Creates a new, empty multiset. |
Method Summary | |
---|---|
int |
getCount(java.lang.Object o)
Returns the count for the given element. |
double |
getLogProb(java.lang.Object o)
Returns the natural log of the probability of the given object under this distribution. |
double |
getProb(java.lang.Object o)
Returns the probability of the given object under this distribution. |
void |
incrementCount(java.lang.Object o)
Increments the count for the given element. |
java.lang.Object |
sample()
Returns an object sampled uniformly from this multiset. |
java.lang.String |
toString()
|
int |
totalCount()
Returns the total count of all elements. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SamplingMultiset()
Method Detail |
---|
public void incrementCount(java.lang.Object o)
public int getCount(java.lang.Object o)
public int totalCount()
public double getProb(java.lang.Object o)
SetWithDistrib
getProb
in interface SetWithDistrib
public double getLogProb(java.lang.Object o)
SetWithDistrib
getLogProb
in interface SetWithDistrib
public java.lang.Object sample()
sample
in interface SetWithDistrib
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |