#include <ProximityMeasure.h>
Inheritance diagram for prapi::Cumlog< T >:

It is defined as C = -sumi=1..N(Siln(Mi)), 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=1e-8, 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 zero-valued 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 log-likelihood measure, one may think of using a look-up table instead of the on-line calculation. | |
| void | releaseLookupTable () |
| Release the look-up table. | |
|
||||||||||||||||
|
Construct a new cumlog proximity measure. The measure is set to use cluster representatives.
|
|
|||||||||
|
Destroy the measure. If there is a look-up table, it will be destroyed as well. |
|
||||||||||
|
To speed up the calculation of the log-likelihood measure, one may think of using a look-up table instead of the on-line calculation. If you know that the values in your samples will never exceed a certain maximum value, then a look-up 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 look-up table will contain 1025x1025 entries. Alternatively, you may use the look-up 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 look-up table index.
Once created, the look-up table will be used for all subsequent proximity calculations. If you want to return to the on-line 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 look-up table. All subsequent proximity calculations will be made on-line. |
|
||||||||||
|
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. |