edu.umd.cloud9.util.cfd
Class Object2IntConditionalFrequencyDistributionFastutil<K extends Comparable<K>>

java.lang.Object
  extended by edu.umd.cloud9.util.cfd.Object2IntConditionalFrequencyDistributionFastutil<K>
All Implemented Interfaces:
Object2IntConditionalFrequencyDistribution<K>

public class Object2IntConditionalFrequencyDistributionFastutil<K extends Comparable<K>>
extends Object
implements Object2IntConditionalFrequencyDistribution<K>

An implementation of a conditional frequency distribution for arbitrary events, backed by a fastutil open hash map. This class keeps track of frequencies using ints, so beware when dealing with a large number of observations.

Author:
Jimmy Lin

Constructor Summary
Object2IntConditionalFrequencyDistributionFastutil()
           
 
Method Summary
 void check()
          Performs an internal consistency check of this data structure.
 int get(K k, K cond)
          Returns the observed count of k conditioned on cond.
 Object2IntFrequencyDistribution<K> getConditionalDistribution(K cond)
          Returns the frequency distribution conditioned on cond.
 long getMarginalCount(K k)
          Returns the marginal count of k.
 long getSumOfAllCounts()
          Returns the sum of all counts.
 void increment(K k, K cond)
          Increments the observed count of k conditioned on cond.
 void increment(K k, K cond, int v)
          Increments the observed count of k conditioned on cond by v.
 void set(K k, K cond, int v)
          Sets the observed count of k conditioned on cond to v.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Object2IntConditionalFrequencyDistributionFastutil

public Object2IntConditionalFrequencyDistributionFastutil()
Method Detail

set

public void set(K k,
                K cond,
                int v)
Description copied from interface: Object2IntConditionalFrequencyDistribution
Sets the observed count of k conditioned on cond to v.

Specified by:
set in interface Object2IntConditionalFrequencyDistribution<K extends Comparable<K>>

increment

public void increment(K k,
                      K cond)
Description copied from interface: Object2IntConditionalFrequencyDistribution
Increments the observed count of k conditioned on cond.

Specified by:
increment in interface Object2IntConditionalFrequencyDistribution<K extends Comparable<K>>

increment

public void increment(K k,
                      K cond,
                      int v)
Description copied from interface: Object2IntConditionalFrequencyDistribution
Increments the observed count of k conditioned on cond by v.

Specified by:
increment in interface Object2IntConditionalFrequencyDistribution<K extends Comparable<K>>

get

public int get(K k,
               K cond)
Description copied from interface: Object2IntConditionalFrequencyDistribution
Returns the observed count of k conditioned on cond.

Specified by:
get in interface Object2IntConditionalFrequencyDistribution<K extends Comparable<K>>

getMarginalCount

public long getMarginalCount(K k)
Description copied from interface: Object2IntConditionalFrequencyDistribution
Returns the marginal count of k. That is, sum of counts of k conditioned on all cond.

Specified by:
getMarginalCount in interface Object2IntConditionalFrequencyDistribution<K extends Comparable<K>>

getConditionalDistribution

public Object2IntFrequencyDistribution<K> getConditionalDistribution(K cond)
Description copied from interface: Object2IntConditionalFrequencyDistribution
Returns the frequency distribution conditioned on cond.

Specified by:
getConditionalDistribution in interface Object2IntConditionalFrequencyDistribution<K extends Comparable<K>>

getSumOfAllCounts

public long getSumOfAllCounts()
Description copied from interface: Object2IntConditionalFrequencyDistribution
Returns the sum of all counts.

Specified by:
getSumOfAllCounts in interface Object2IntConditionalFrequencyDistribution<K extends Comparable<K>>

check

public void check()
Description copied from interface: Object2IntConditionalFrequencyDistribution
Performs an internal consistency check of this data structure. An exception will be thrown if an error is found.

Specified by:
check in interface Object2IntConditionalFrequencyDistribution<K extends Comparable<K>>