Go to the source code of this file.
Defines | |
#define | BETA_MAX DBL_MAX |
#define | PLOGP(x) ((x)*log((x))) |
Functions | |
void | vl_aib_calculate_information (VlAIB *aib, double *I, double *H) |
void | vl_aib_delete (VlAIB *aib) |
Deletes AIB data structure. | |
void | vl_aib_merge_nodes (VlAIB *aib, vl_uint i, vl_uint j, vl_uint new) |
void | vl_aib_min_beta (VlAIB *aib, vl_uint *besti, vl_uint *bestj, double *minbeta) |
VlAIB * | vl_aib_new (double *Pcx, vl_uint nvalues, vl_uint nlabels) |
Allocates and initializes the internal data structure. | |
vl_uint * | vl_aib_new_nodelist (vl_uint nentries) |
double * | vl_aib_new_Pc (double *Pcx, vl_uint nvalues, vl_uint nlabels) |
double * | vl_aib_new_Px (double *Pcx, vl_uint nvalues, vl_uint nlabels) |
void | vl_aib_normalize_P (double *P, vl_uint nelem) |
VL_EXPORT void | vl_aib_process (VlAIB *aib) |
Runs AIB on Pcx. | |
void | vl_aib_update_beta (VlAIB *aib) |
#define PLOGP | ( | x | ) | ((x)*log((x))) |
void vl_aib_calculate_information | ( | VlAIB * | aib, |
double * | I, | ||
double * | H | ||
) |
void vl_aib_delete | ( | VlAIB * | aib | ) |
void vl_aib_min_beta | ( | VlAIB * | aib, |
vl_uint * | besti, | ||
vl_uint * | bestj, | ||
double * | minbeta | ||
) |
VlAIB* vl_aib_new | ( | double * | Pcx, |
vl_uint | nvalues, | ||
vl_uint | nlabels | ||
) |
Allocates and initializes the internal data structure.
------------------------------------------------------------------
Pcx | A pointer to a 2D array of probabilities |
nvalues | The number of rows in the array |
nlabels | The number of columns in the array |
Creates a new VlAIB struct containing pointers to all the data that will be used during the AIB process.
Allocates memory for the following:
Since it simply copies to pointer to Pcx, the total additional memory requirement is:
(3*nvalues+nlabels)*sizeof(double) + 4*nvalues*sizeof(vl_uint)
vl_uint* vl_aib_new_nodelist | ( | vl_uint | nentries | ) |
double* vl_aib_new_Pc | ( | double * | Pcx, |
vl_uint | nvalues, | ||
vl_uint | nlabels | ||
) |
double* vl_aib_new_Px | ( | double * | Pcx, |
vl_uint | nvalues, | ||
vl_uint | nlabels | ||
) |
void vl_aib_normalize_P | ( | double * | P, |
vl_uint | nelem | ||
) |
VL_EXPORT void vl_aib_process | ( | VlAIB * | aib | ) |
Runs AIB on Pcx.
------------------------------------------------------------------
aib | AIB object to process |
The function runs Agglomerative Information Bottleneck (AIB) on the joint probability table aib->Pcx which has labels along the columns and feature values along the rows. AIB iteratively merges the two values of the feature x
that causes the smallest decrease in mutual information between the random variables x
and c
.
Merge operations are arranged in a binary tree. The nodes of the tree correspond to the original feature values and any other value obtained as a result of a merge operation. The nodes are indexed in breadth-first order, starting from the leaves. The first index is zero. In this way, the leaves correspond directly to the original feature values. In total there are 2*nvalues-1
nodes.
The results may be accessed through vl_aib_get_parents which returns an array with one element per tree node. Each element is the index the parent node. The root parent is equal to zero. The array has 2*nvalues-1
elements.
Feature values with null probability are ignored by the algorithm and their nodes have parents indexing a non-existent tree node (a value bigger than 2*nvalues-1
).
Then the function will also compute the information level after each merge. vl_get_costs will return a vector with the information level after each merge. cost has nvalues
entries: The first is the value of the cost functional before any merge, and the others are the cost after the nvalues-1
merges.
void vl_aib_update_beta | ( | VlAIB * | aib | ) |