Main Page   Compound List   File List   Compound Members   File Members   Related Pages  

GraphManipulator Class Reference

Object designed to manipulate collection of sub-graphs included in a graph and drive the supervised learning procedure. More...

#include <graphCharac+.hh>

List of all members.

Public Methods

 GraphManipulator ()
virtual ~GraphManipulator ()
void ReadGraphVersion3 (char *path, char *pathTime)
 method for reading a graph in format 2 and for reading a file containing the time delay between the different time samples specific to the graph. More...

void CreateMatchCostObject ()
 This method creates a MatchCost Object used for matching.

void InitGraphforMatch (int nb_sample, int firstSample1, float seuilDiv, int kMT1a, int kMT1b)
 This method initializes the matching procedure relative to the positive semantic definition, with a given reference graph.

void InitGraphforMatchNeg (int nb_samples, float seuilDiv, int b)
 This method initializes the matching procedure relative to the negative semantic definition, with a given reference graph.

void FixWeights (float weightMTinTLDiff, float TL1TL2Div, float flowDiff, float divDiff, float MIDiff, float divMTaMTbCost, float timeDiff, bool meanCalcul)
 This method introduce in the similarity model a given parameter vector. This method fixes also another parameter specific to the matching calculus. More...

void FixLearnedWeights (int posOrNeg, bool meanCalcul, float factorReducList)
 This method updates the parameter vector used in the parametric similarity model, with the estimated parameters which were learned interactively. More...

float Match (int posOrNeg, int minSample, int maxSample, int nbMiniBranches)
 This method performs the matching of a collection of sub-graphes with a reference sub-graph according to the currently defined similarity model parameter vector. More...

void SaveSortedList (int a, int b)
 Method used to save the a posteriori collection of sub-graphs after a learning step and before beginning a matching procedure which selects candidates of this list. This method is also used to save a sub-graph collection after a matching procedure with a positive example. More...

float Learn (int posOrNeg, int interestkMTa, int interestkMTb, int interestfirstSample)
 Method to 1) calculate, after that the user has fed the system with a positive or negative example, the current estimate of the similarity model parameter vector by calling the ParaSearch method 'MMSEestim(...)'; and 2) calculate the posterior probabilities assigned to each sub-graph candidate and to update the posterior sorted collection of sub-graphs. More...

void LearnRefGraph (int posOrNeg)
 Method calling the 'Learn(..)' method to learn with the as an example the first (positive example) or the last (negative example) element of the current sorted collection of sub-graphs. More...

void PrintAPostList ()
 method to print on the standard output the sorted a posteriori collection of sub-graphs. More...

void WriteAPostList ()
 Method to write a text file destinated to the GUI, which contains the the relevance feedback measurements and the sorted a posteriori collection of sub-graphs.

void InitParaLearn (int a, int b)
 Memory allocation and initialization of ParaSearch objects related to the positive or/and negative semantic. More...

void ScaleParaLearnForSG (int a, int b, bool scale)
 Initialization of ParaSearch objects related to the positive or/and negative semantic. More...

void EraseMemLearn (int posNeg)
 Method to replace by a flat distribution the current multinomial estimated distribution of the similairty model parameters. As the distributions are stored in the ParaSearch object, its method 'ErasePdf(..)' is called. More...

void StrengthProbLink ()
 Method to evaluate the divergences measurements between the multinomial distribution related to the positive and negativ semantic. A smoothing of the multinomial distributions by a Gaussian kernel is applied before the symetric Kyullbach-Kleiber divergence calculation.

void ConvergenceQuality ()
 Method to calculate the move of the norm of the parameter vector estimates during the last learning step.

void VariancePosterior ()
 Method to calculate the mean and the variance of the posterior probabilities attached to the elements of the sub-graph a posteriori collection.

void PrintProbaLink ()
 Method to print on the standard output the relevance feedback measurements.


Public Attributes

int nb_TimelessClasses
 number of MT classes.

int minSample
 Minimum/Maximum time sample considered in the graph.

int maxSample
 Minimum/Maximum time sample considered in the graph.

float * TimeDelay
 Array of time delays between the different time samples specific to the graph.

int nbSamples
 number of samples of the time-window.

ParaSearch paraSearchObject
 Object used for the estimation of the parameter vector of the similarity model related to a positive semantic.

SearchTree **** searchTreeCollec
 Array of SearchTree objects related to a positive semantic, which is used to save the search tree during a macthing procedure.

float **** costs
 array of distorsion costs related to a positive semantic, assigned to the search tree nodes during the matching procedure.

vector< float > costSorted
 vector of sorted costs or posterior probabilities related to the elements of the collection of sub-graphs.

vector< int > kMT2aSorted
 vector of index of MT class attached to the elements of the collection of sub-graphs.

int * kMT2aSortedAux
 array of the MT class indexes attached to the collection of sub-graphs.

int * firstSample2aSortedAux
 array of first time sample indexes attached to the collection of sub-graphs.

float * kMT2aCostAux
 array of costs attached to the collection of sub-graphs.

vector< int > kMT2bSorted
 vector of indexes of 2nd MT class attached to the elements of the collection of sub-graphs. (only when 2 MT classes are considered simultaneously per sub-graph).

int * kMT2bSortedAux
 array of 2nd MT class indexes attached to the elements of the collection of sub-graphs (only when 2 MT classes are considered simultaneously per sub-graph).

int * firstSample2bSortedAux
 array of first time sample indexes related to the 2nd MT classes and attached to the elements of the collection of sub-graphs (only when 2 MT classes are considered simultaneously per sub-graph).

float * kMT2bCostAux
 array of costs related to the 2nd MT classes and attached to the elements of the collection of sub-graphs (only when 2 MT classes are considered simultaneously per sub-graph).

vector< int > firstSample2Sorted
 vector of first time sample indexes related to the elements of the collection of sub-graphs.

ParaSearch paraSearchObjectNeg
 Object used for the estimation of the parameter vector of the similarity model related to a negative semantic.

SearchTree **** searchTreeCollecNeg
 Array of SearchTree objects related to a negative semantic, which is used to save the search tree during a macthing procedure.

float **** costsNeg
 array of distorsion costs related to a negative semantic, assigned to the search tree nodes during the matching procedure.

float * divergences
 Relevance feedback mesures. Divergence between the positive and negative related parameter distributions.


Private Methods

void AddMTtoSubGraph (int subGraph, int kMT, float seuilDiv, int firstSample, int nb_samples)
 Method to load a sub-graph in order to perform after a matching procedure. More...


Private Attributes

int nb_dim
 dimensionnality of the feature space.

int nb_images
 number of image time samples.

unsigned long int dim
 number of pixels in each image.

int nx
 spatial dimension of the images.

int ny
 spatial dimension of the images.

int Index_CurrentImage
 index of the curent image time sample.

DynaClassTmpClass
 DynamicCluster Object for storing dynamic clusters trajectories.

SubGraphgraph1
 SubGraph Object used to select a 1 st sub-graph for inexact matching.

SubGraphgraph2
 SubGraph Object used to select a 2 nd sub-graph for inexact matching.

MatchCostmatchCostObject
 MatchCost Object used for performing the sub-graph matching with the paramteric similarity model.

float seuilDivergence
 Divergence treshold to fix the graph complexity.

int sizeList
 Current number of elements in the posterior sub-graph collection.

bool predefinedList
 Boolean flag to precise if a sub-graph collection was previously created or not.

float factorReducList
 Current factor used to reduce the size of the posterior sub-graph collection.

bool noTree
 Boolean flag to precise if a search-tree was previously created by a positive semantic matching.

bool noTreeNeg
 Boolean flag to precise if a search-tree was previously created by a negative semantic matching.

float meanPosterior
 Current statistical mean of the probability attached to the elements of the posterior sub-graph colection.

float varPosterior
 Current statistical variance of the probability attached to the elements of the posterior sub-graph colection.

float convQualityPos
 Move of the norm of the parameter vector estimates during the last learning step, for the positive parameter vector estimation.

float convQualityNeg
 Move of the norm of the parameter vector estimates during the last learning step, for the negative parameter vector estimation.


Detailed Description

Object designed to manipulate collection of sub-graphs included in a graph and drive the supervised learning procedure.

This object definition present methods defined in "readholegraph.cpp" and in "fillsubgraph+.cpp".

First note that this object posses similarties with the GraphDynaCluster object used previously for infering the trajectories, with the difference that the GraphManipulator object does not possess any methods and attributes related to the graph inference; It possesses attributes and methods to read a already created graph, to manipulate sub-graphs, to create sorted collections of sub-graphs with supervised learning methods, etc....
Second, note this object comprises a large diversity of attributes and methods. This is probably an error : this object should be split in various objects.

Todo:
redesign this object and the GraphDynaCluster object used for the graph inference so that they share attributes and methods from a commun herited parent object

Definition at line 28 of file graphCharac+.hh.


Member Function Documentation

void GraphManipulator::AddMTtoSubGraph int    subGraph,
int    kMT,
float    seuilDiv,
int    firstSample,
int    nb_samples
[private]
 

Method to load a sub-graph in order to perform after a matching procedure.

Parameters:
subGraph  index of the sub-graph to load (reference graph 1, candidate graph 2)
kMT  MT class index
seuilDiv  divergence treshold to consider
firstSample  first time sample of the graph example
nb_samples  number of samples of the time-window

Definition at line 806 of file fillsubgraph+.cpp.

void GraphManipulator::EraseMemLearn int    posNeg
 

Method to replace by a flat distribution the current multinomial estimated distribution of the similairty model parameters. As the distributions are stored in the ParaSearch object, its method 'ErasePdf(..)' is called.

In other words, this methods sets to 1 all the hyperparameters of the dirichlet model related to either the positive or negative semantic learning.

Parameters:
posNeg  erase multinomial distribution related to the positive '1' or negative '-1' semantic

Definition at line 625 of file fillsubgraph+.cpp.

void GraphManipulator::FixLearnedWeights int    posOrNeg,
bool    meanCalcul,
float    factorReducList
 

This method updates the parameter vector used in the parametric similarity model, with the estimated parameters which were learned interactively.

This method updates the parameter relative either to the positive or to the negative semantic. By this method, a couple of paramters are also updated

Parameters:
posOrNeg  parameter vector relative either to the positive '1' or to the negative '-1' semantic
meanCalcul  mean calculation '1' or Kullback-Leibler divergence '0' used in the matching calculation
factorReducList  This factor is used to reduce the collection of sub-graphs by factorReducList times

Definition at line 90 of file fillsubgraph+.cpp.

void GraphManipulator::FixWeights float    weightMTinTLDiff,
float    TL1TL2Div,
float    flowDiff,
float    divDiff,
float    MIDiff,
float    divMTaMTbCost,
float    timeDiff,
bool    meanCalcul
 

This method introduce in the similarity model a given parameter vector. This method fixes also another parameter specific to the matching calculus.

Parameters:
weightMTinTLDiff  parameter weighting the population of each nodes
TL1TL2Div  parameter weighting the nodes' distribution
flowDiff  parameter weighting the flow of pixels exchanged between nodes
divDiff  parameter weighting the change in time of the nodes' distribution
MIDiff  parameter weighting the intra-node change in time
divMTaMTbCost  parameter weighting the interaction of the 2 MT classes (only if 2 MT class are considered);
timeDiff  parameter weighting the time lattice on which the sub-graph is defined
meanCalcul  mean calculation '1' or Kullback-Leibler divergence '0' used in the matching calculation

Definition at line 81 of file fillsubgraph+.cpp.

void GraphManipulator::InitParaLearn int    a,
int    b
 

Memory allocation and initialization of ParaSearch objects related to the positive or/and negative semantic.

The ParaSearch object is used for the estimation of the parameter vector of the similarity model. This method is called once at the first iteration

Parameters:
a  if a='1' the memory allocation and initialization is done for a positive semantic
b  if b='1' the memory allocation and initialization is done for a negative semantic

Definition at line 397 of file fillsubgraph+.cpp.

float GraphManipulator::Learn int    posOrNeg,
int    interestkMTa,
int    interestkMTb,
int    interestfirstSample
 

Method to 1) calculate, after that the user has fed the system with a positive or negative example, the current estimate of the similarity model parameter vector by calling the ParaSearch method 'MMSEestim(...)'; and 2) calculate the posterior probabilities assigned to each sub-graph candidate and to update the posterior sorted collection of sub-graphs.

The method runs sequentially the following steps :

  • 1) The new estimate of the the similarity model parameter vector is performed with the new user's example
  • 2) The similarity between sub-graphs are updated with the new parameter vector and the maximum of similiraty function is calculated (calculating the range on which the similarity function takes its values)
  • 3)After a normalisation step the costs assigned to the sub-graphs matching are converted to probabilities
  • 4)Then, the likelihood probabilities relative to the positive and negative semantic are updates and the posterior probabilities are infered by Bayes rule.
  • 5)The posterior sub-graph collection is resorted accordingto the new probabilities
  • 6) The relevance mesures are updated
Parameters:
posOrNeg  learning done for either a positive '1' or negative '-1' example
interestkMTa  index of the MT class provided as an example
interestkMTb  index of a second MT class provided as an example (only in the case when 2 MT class are considered per sub-graph)
interestfirstSample  first time sample index of the graph example

Definition at line 452 of file fillsubgraph+.cpp.

void GraphManipulator::LearnRefGraph int    posOrNeg
 

Method calling the 'Learn(..)' method to learn with the as an example the first (positive example) or the last (negative example) element of the current sorted collection of sub-graphs.

This method is only used once to learn with the first positive example provided by the user.

Parameters:
learning  done for either a positive '1' or negative '-1' example

Definition at line 439 of file fillsubgraph+.cpp.

float GraphManipulator::Match int    posOrNeg,
int    minSample,
int    maxSample,
int    nbMiniBranches
 

This method performs the matching of a collection of sub-graphes with a reference sub-graph according to the currently defined similarity model parameter vector.

The algorithm runs sequentially the following steps :

  • 1) First a new collection of SearchTree object is created.
    NB : We focuse either on the positive or on the negative semantic (with the parameter 'posOrNeg').

    Then, the matching procedure is performed for each sub-graph candidate, one after the other within a loop. All the possible sub-graphs included in the graph part defined by the user (with the input parameters :'minSample' and 'maxSample') are candidates to be matched with the reference sub-graph. The matching loop is controlled with a while (all the candidates have not been tested) conditions.

  • 2) The matching object MatchCost object is then initialisated with a sub-graph candidate. If an a posteriori sub-graph collection was previously inferred, only candidates belonging to this list are matched with the reference graph.
    NB : Note that if 2 MT graphs are considered per sub-graph, then for the first matching procedure, only the most likely MT graph associations are preselected according to their rank in the collection. Moreover, 2 identical MT class can not be associated.
  • 3) The matching is performed with this candidate using a method of the MatchCost object called 'InexactMatchCost(...)'.
    NB : Note that a single collection of subgraph is used explictly. The latter is the a posteriori sub-graph collection. For the 2 collections related to the positive and negative semantics, 2 collections of search-tree are saved instead.
  • 4) The index are incremented to focuse on a next sub-graph candidate and the algorithm goes back to step 2). If all the candidates have been matched, the loop is broke and the program exits the method.
    NB: The result produced by this method is only a collection of search-trees
Parameters:
posOrNeg  matching done for either a positive '1' or negative '-1' example
minSample  Minimum sample time considered in the graph
maxSample  Maximum sample time considered in the graph
nbMiniBranches  number of branches considered in the search tree
Returns:
minimum match-cost among all the sub-graphs candidates

Definition at line 123 of file fillsubgraph+.cpp.

void GraphManipulator::PrintAPostList  
 

method to print on the standard output the sorted a posteriori collection of sub-graphs.

used only duringthe developpement of the code !!! not usefull anymore

Definition at line 632 of file fillsubgraph+.cpp.

void GraphManipulator::ReadGraphVersion3 char *    path,
char *    pathTime
 

method for reading a graph in format 2 and for reading a file containing the time delay between the different time samples specific to the graph.

Parameters:
path  Graph file name at format 2 (c.f. Documentation on the "Inference of a graph of dynamic clusters trajectories")
pathTime  Text file name containing, on one line and separated by a white space, the time delay between the different time samples specific to the graph

Definition at line 27 of file readholegraph.cpp.

void GraphManipulator::SaveSortedList int    a,
int    b
 

Method used to save the a posteriori collection of sub-graphs after a learning step and before beginning a matching procedure which selects candidates of this list. This method is also used to save a sub-graph collection after a matching procedure with a positive example.

The case of saving a sub-graph collection after a matching procedure with a positive example, is only usefull for the preselection of likely MT assocaitions when considering simultaneously 2 MT class per sub-graph.

  • if input parameters are (a=1,b=1), the a posteriori collection is saved.
  • if input parameters are (a=1,b=0), the collection, resulting from the matching of all possible sub-graphs with the first class of a positive graph example comprising 2 MT classes, is saved.
  • if input parameters are (a=0,b=1), the collection, resulting from the matching of all possible sub-graphs with the second class of a positive graph example comprising 2 MT classes, is saved

Definition at line 352 of file fillsubgraph+.cpp.

void GraphManipulator::ScaleParaLearnForSG int    a,
int    b,
bool    scale
 

Initialization of ParaSearch objects related to the positive or/and negative semantic.

The ParaSearch object is used for the estimation of the parameter vector of the similarity model.

Parameters:
a  if a='1' the memory allocation and initialization is done for a positive semantic
b  if b='1' the memory allocation and initialization is done for a negative semantic
scale  true if the range on which the matching costs take their values has to be update

Definition at line 420 of file fillsubgraph+.cpp.


The documentation for this class was generated from the following files:
Generated on Thu Feb 17 11:03:19 2005 for Interactive Learning of Sub-Graphs Semantics by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002