Defines | Functions
aib.c File Reference
#include "aib.h"
#include <stdio.h>
#include <stdlib.h>
#include <float.h>
#include <math.h>
Include dependency graph for vl/aib.c:

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)
VlAIBvl_aib_new (double *Pcx, vl_uint nvalues, vl_uint nlabels)
 Allocates and initializes the internal data structure.
vl_uintvl_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 Documentation

#define BETA_MAX   DBL_MAX

Definition at line 127 of file vl/aib.c.

#define PLOGP (   x)    ((x)*log((x)))

Function Documentation

void vl_aib_calculate_information ( VlAIB aib,
double *  I,
double *  H 
)

------------------------------------------------------------------

Definition at line 437 of file vl/aib.c.

void vl_aib_delete ( VlAIB aib)

Deletes AIB data structure.

------------------------------------------------------------------

Parameters:
aibdata structure to delete.

Definition at line 534 of file vl/aib.c.

void vl_aib_merge_nodes ( VlAIB aib,
vl_uint  i,
vl_uint  j,
vl_uint  new 
)

------------------------------------------------------------------

Definition at line 272 of file vl/aib.c.

void vl_aib_min_beta ( VlAIB aib,
vl_uint besti,
vl_uint bestj,
double *  minbeta 
)

------------------------------------------------------------------

Definition at line 233 of file vl/aib.c.

VlAIB* vl_aib_new ( double *  Pcx,
vl_uint  nvalues,
vl_uint  nlabels 
)

Allocates and initializes the internal data structure.

------------------------------------------------------------------

Parameters:
PcxA pointer to a 2D array of probabilities
nvaluesThe number of rows in the array
nlabelsThe 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:

  • Px (nvalues*sizeof(double))
  • Pc (nlabels*sizeof(double))
  • nodelist (nvalues*sizeof(vl_uint))
  • which (nvalues*sizeof(vl_uint))
  • beta (nvalues*sizeof(double))
  • bidx (nvalues*sizeof(vl_uint))
  • parents ((2*nvalues-1)*sizeof(vl_uint))
  • costs (nvalues*sizeof(double))

Since it simply copies to pointer to Pcx, the total additional memory requirement is:

(3*nvalues+nlabels)*sizeof(double) + 4*nvalues*sizeof(vl_uint)

Returns:
An allocated and initialized VlAIB pointer

Definition at line 489 of file vl/aib.c.

------------------------------------------------------------------

Definition at line 158 of file vl/aib.c.

double* vl_aib_new_Pc ( double *  Pcx,
vl_uint  nvalues,
vl_uint  nlabels 
)

------------------------------------------------------------------

Definition at line 205 of file vl/aib.c.

double* vl_aib_new_Px ( double *  Pcx,
vl_uint  nvalues,
vl_uint  nlabels 
)

------------------------------------------------------------------

Definition at line 180 of file vl/aib.c.

void vl_aib_normalize_P ( double *  P,
vl_uint  nelem 
)

------------------------------------------------------------------

Definition at line 139 of file vl/aib.c.

VL_EXPORT void vl_aib_process ( VlAIB aib)

Runs AIB on Pcx.

------------------------------------------------------------------

Parameters:
aibAIB 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.

Definition at line 588 of file vl/aib.c.

------------------------------------------------------------------

Definition at line 351 of file vl/aib.c.



libvlfeat
Author(s): Andrea Vedaldi
autogenerated on Thu Jun 6 2019 20:25:51