public class DistCustomCategorical<C extends java.lang.Enum<C>> extends DistributionCategorical<C> implements java.io.Serializable
DistributionCategorical.RangeCUMULATIVE_PROB_TOLERANCE| Constructor and Description |
|---|
DistCustomCategorical(java.lang.Class<C> categoryEnumType,
double[] pmf)
Create an instance where outcomes map to an Java enum category.
|
DistCustomCategorical(double[] pmf,
boolean keepLocked)
Create an instance where outcomes map to integers 1-K.
|
| Modifier and Type | Method and Description |
|---|---|
Distribution |
createUnregisteredCopy()
Create an unregistered copy of this distribution.
|
void |
setProbability(C categoryValue,
double prob)
Set (change) a probability value linked to a categorical outcome.
|
void |
setProbability(int outcomeNum,
double prob)
Set (change) a probability value linked to a numeric (integer) outcome.
|
java.lang.String |
toString()
Custom toString implementation.
|
void |
unlock()
Unlock the distribution (allowing it to be sampled) after changes to probabilities
are completed.
|
addRange, clearRanges, getK, isLocked, lock, sampleCategory, usesEnumCategory, usesMappedRangessampleDouble, sampleIntcreateRegisteredCopygetSampler, registerAccessInfo, registerSamplerpublic DistCustomCategorical(java.lang.Class<C> categoryEnumType, double[] pmf)
categoryEnumType - The enum which defines your categories.pmf - The probability mass function (PMF) as an array of probabilities.public DistCustomCategorical(double[] pmf,
boolean keepLocked)
pmf - The probability mass function (PMF) as an array of probabilities.keepLocked - Whether to keep the distribution locked (see above).public void unlock()
unlock in class DistributionCategorical<C extends java.lang.Enum<C>>public void setProbability(C categoryValue, double prob)
categoryValue - The enum value (category) being changed.prob - The new probability.public void setProbability(int outcomeNum,
double prob)
outcomeNum - The number ('position') of the outcome to change (1-K).prob - The new probability.public java.lang.String toString()
toString in class DistributionCategorical<C extends java.lang.Enum<C>>"CustomPMF[0.1,0.2,0.7]".public Distribution createUnregisteredCopy()
createUnregisteredCopy in class Distribution