#include <ProximityMeasure.h>
Inheritance diagram for prapi::Cumlog< T >:
It is defined as C = sum_{i=1..N}(S_{i}ln(M_{i})), where S and M represent the sample and model distributions, respectively. N is the length of the distributions. If the normalization flag is set to true, M and S are normalized prior to distance calculation.
Cumlog is an asymmetric proximity measure, i.e. P(a,b) is generally different from P(b,a).
Public Methods  
Cumlog (double minValue=1e8, bool normalized=true)  
Construct a new cumlog proximity measure.  
~Cumlog ()  
Destroy the measure.  
void  setMinValue (double value) throw (InvalidArgumentException&) 
Set the minimum value for a distribution entry that will be encountered.  
double  getMinValue (void) const 
Get the minimum value that is substituted to zerovalued feature vector entries.  
void  setNormalized (bool normalize) 
Set the normalized state.  
bool  isNormalized (void) const 
Get the normalize state.  
double  getProximity (const util::List< T > &sample, const util::List< T > &model, double stopAfter=MAXDOUBLE) const throw (ProximityException&) 
Proximity between two lists.  
void  createLookupTable (int maxValue) 
To speed up the calculation of the loglikelihood measure, one may think of using a lookup table instead of the online calculation.  
void  releaseLookupTable () 
Release the lookup table. 

Construct a new cumlog proximity measure. The measure is set to use cluster representatives.


Destroy the measure. If there is a lookup table, it will be destroyed as well. 

To speed up the calculation of the loglikelihood measure, one may think of using a lookup table instead of the online calculation. If you know that the values in your samples will never exceed a certain maximum value, then a lookup table of finite size can be created. For example, when creating a histogram out of 32x32 images, there will never be a value greater than 1024 (or smaller than 0). There are thus 1025 distinct values, and the lookup table will contain 1025x1025 entries. Alternatively, you may use the lookup table with normalized feature values. Each feature vector element is assumed to be in the range [0,1]. The values are multiplied by the given maximum value, rounded to the closest integer and used as a lookup table index.
Once created, the lookup table will be used for all subsequent proximity calculations. If you want to return to the online calculation mode, call releaseLookupTable(). Note that with normalized features, the proximity calculation is "quantized", resulting in somewhat more inaccurate proximity calculations.


Proximity between two lists.
Implements prapi::ProximityMeasure< T >. 

Release the lookup table. All subsequent proximity calculations will be made online. 

Set the minimum value for a distribution entry that will be encountered. All zeros in model histograms will be replaced with this value in proximity calculations. (Because otherwise a logarithm of zero would be calculated.) The default value is 10^{8}. Setting this value is particularty important with sparse distributions. If your distribution is a histogram calculated from an matrix, you may want to set this value to 1/(rows*cols).


Set the normalized state. If true, then all feature vectors given to this proximity measure are normalized prior to calculating the proximity. If false, then the feature vectors are assumed to be normalized a priori. In the latter case, the computational performance of the measure will be significantly higher. The default value is true. 