KeyType - Type of Key in the distributionpublic class DefaultDataDistribution<KeyType> extends AbstractDataDistribution<KeyType>
ScalarDataDistribution that uses a
backing map.| Modifier and Type | Class and Description |
|---|---|
static class |
DefaultDataDistribution.DefaultFactory<DataType>
A factory for
DefaultDataDistribution objects using some given
initial capacity for them. |
static class |
DefaultDataDistribution.Estimator<KeyType>
Estimator for a DefaultDataDistribution
|
static class |
DefaultDataDistribution.PMF<KeyType>
PMF of the DefaultDataDistribution
|
static class |
DefaultDataDistribution.WeightedEstimator<KeyType>
A weighted estimator for a DefaultDataDistribution
|
AbstractMutableDoubleMap.Entry<KeyType>, AbstractMutableDoubleMap.SimpleEntry<KeyType>, AbstractMutableDoubleMap.SimpleEntrySet<KeyType>, AbstractMutableDoubleMap.SimpleIterator<KeyType>ScalarMap.Entry<KeyType>| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_INITIAL_CAPACITY
Default initial capacity, 10.
|
protected double |
total
Total of the counts in the distribution
|
map| Modifier | Constructor and Description |
|---|---|
|
DefaultDataDistribution()
Default constructor
|
|
DefaultDataDistribution(DataDistribution<? extends KeyType> other)
Creates a new instance of DefaultDataDistribution
|
|
DefaultDataDistribution(int initialCapacity)
Creates a new instance of DefaultDataDistribution
|
|
DefaultDataDistribution(java.lang.Iterable<? extends KeyType> data)
Creates a new instance of ScalarDataDistribution
|
protected |
DefaultDataDistribution(java.util.Map<KeyType,MutableDouble> map,
double total)
Creates a new instance of
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Removes all elements from the map.
|
DefaultDataDistribution<KeyType> |
clone()
This makes public the clone method on the
Object class and
removes the exception that it throws. |
DistributionEstimator<KeyType,? extends DataDistribution<KeyType>> |
getEstimator()
Gets an estimator associated with this distribution.
|
double |
getMeanValue()
Gets the average value of all keys in the distribution, that is, the
total value divided by the number of keys (even zero-value keys)
|
DataDistribution.PMF<KeyType> |
getProbabilityFunction()
Gets the distribution function associated with this Distribution,
either the PDF or PMF.
|
double |
getTotal()
Gets the total (sum) of the values in the distribution.
|
double |
increment(KeyType key,
double value)
Increments the value associated with the given key by the given amount.
|
void |
set(KeyType key,
double value)
Sets the value associated with a given key.
|
fromInfiniteVector, getDomain, getDomainSize, getEntropy, getFraction, getLogFraction, getMaxValue, getMinValue, sample, sample, sampleInto, toInfiniteVectorasMap, compact, entrySet, getcontainsKey, decrement, decrement, decrementAll, decrementAll, getMaxValueKey, getMaxValueKeys, getMinValueKey, getMinValueKeys, increment, incrementAll, incrementAll, isEmpty, keySet, setAll, setAll, sizeequals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitasMap, decrement, decrement, decrementAll, decrementAll, entrySet, get, increment, incrementAll, incrementAll, setAll, setAllcontainsKey, getMaxValueKey, getMaxValueKeys, getMinValueKey, getMinValueKeys, isEmpty, keySet, sizepublic static final int DEFAULT_INITIAL_CAPACITY
protected double total
public DefaultDataDistribution()
public DefaultDataDistribution(int initialCapacity)
initialCapacity - Initial capacity of the Mappublic DefaultDataDistribution(DataDistribution<? extends KeyType> other)
other - DataDistribution to copypublic DefaultDataDistribution(java.lang.Iterable<? extends KeyType> data)
data - Data to create the distributionprotected DefaultDataDistribution(java.util.Map<KeyType,MutableDouble> map, double total)
map - Backing Map that stores the datatotal - Sum of all values in the Mappublic DefaultDataDistribution<KeyType> clone()
AbstractCloneableSerializableObject class and
removes the exception that it throws. Its default behavior is to
automatically create a clone of the exact type of object that the
clone is called on and to copy all primitives but to keep all references,
which means it is a shallow copy.
Extensions of this class may want to override this method (but call
super.clone() to implement a "smart copy". That is, to target
the most common use case for creating a copy of the object. Because of
the default behavior being a shallow copy, extending classes only need
to handle fields that need to have a deeper copy (or those that need to
be reset). Some of the methods in ObjectUtil may be helpful in
implementing a custom clone method.
Note: The contract of this method is that you must use
super.clone() as the basis for your implementation.clone in interface DataDistribution<KeyType>clone in interface CloneableSerializableclone in class AbstractDataDistribution<KeyType>public double increment(KeyType key, double value)
ScalarMappublic void set(KeyType key, double value)
ScalarMappublic double getTotal()
DataDistributionpublic void clear()
NumericMapclear in interface NumericMap<KeyType>clear in class AbstractScalarMap<KeyType,MutableDouble>public DistributionEstimator<KeyType,? extends DataDistribution<KeyType>> getEstimator()
EstimableDistributionpublic DataDistribution.PMF<KeyType> getProbabilityFunction()
ComputableDistributionpublic double getMeanValue()