Home > Mateda2.0 > learning > LearnMargProdModel.m

# LearnMargProdModel

## PURPOSE

[model] = LearnMargProdModel(k,NumbVar,Card,SelPop,AuxFunVal,learning_params)

## SYNOPSIS

function [model] = LearnMargProdModel(k,NumbVar,Card,SelPop,AuxFunVal,learning_params)

## DESCRIPTION

     [model] = LearnMargProdModel(k,NumbVar,Card,SelPop,AuxFunVal,learning_params)
     LearnMargProdModel:     Learns a marginal product model using affinity
                             propagation on the matrix of mutual information
     INPUTS
     k: Current generation
     NumbVar: Number of variables
     Card: Vector with the dimension of all the variables.
     SelPop:  Population from which the model is learned
     AuxFunVal: Evaluation of the data set (required for some learning algorithms, not for this one)
     learning_params{1}(1) = sizeconstraint: Maximum size of the cliques in
                                             the factorization
     OUTPUTS
     model: Markov network model containing the structure (model{1} = Cliques)
            and the parameters (model{2} = Tables)

     Last version 8/26/2008. Roberto Santana (roberto.santana@ehu.es)

## CROSS-REFERENCE INFORMATION

This function calls:

- FactAffinityElim [Cliques,deep]=FactAffinityElim(MI,vars,sizeconstraint,p,deep)
- FindMargProb [UnivProb,BivProb]=FindMargProb(SelPop,NumbVar,Card)
- LearnFDAParameters [Tables] = LearnFDAParameters(Cliques,SelPop,NumbVar,Card)
- IntMutualInfFromMargProb [MI]=IntMutualInfFromMargProb(NumbVar,Card,UnivProb,BivProb)

This function is called by:

## SOURCE CODE

    0001 function [model] = LearnMargProdModel(k,NumbVar,Card,SelPop,AuxFunVal,learning_params)
    0002 % [model] = LearnMargProdModel(k,NumbVar,Card,SelPop,AuxFunVal,learning_params)
    0003 % LearnMargProdModel:     Learns a marginal product model using affinity
    0004 %                         propagation on the matrix of mutual information
    0005 % INPUTS
    0006 % k: Current generation
    0007 % NumbVar: Number of variables
    0008 % Card: Vector with the dimension of all the variables.
    0009 % SelPop:  Population from which the model is learned
    0010 % AuxFunVal: Evaluation of the data set (required for some learning algorithms, not for this one)
    0011 % learning_params{1}(1) = sizeconstraint: Maximum size of the cliques in
    0012 %                                         the factorization
    0013 % OUTPUTS
    0014 % model: Markov network model containing the structure (model{1} = Cliques)
    0015 %        and the parameters (model{2} = Tables)
    0016 %
    0017 % Last version 8/26/2008. Roberto Santana (roberto.santana@ehu.es)
    0018
    0019         sizeconstraint =  cell2num(learning_params{1}(1));
    0020
    0021         % Univariate and Bivariate probabilities are learned
    0022         [UnivProb,BivProb]= FindMargProb(SelPop,NumbVar,Card);
    0023
    0024        % The Matrix of Mutual information is learned
    0025          MI = IntMutualInfFromMargProb(NumbVar,Card,UnivProb,BivProb);
    0026
    0027          %[idx,cent] = kmeans(MI,NumbVar/3,'Distance','correlation');
    0028
    0029
    0030          % The cliques are learned from the matrix of mutual information
    0031          auxperm = randperm(NumbVar);
    0032          [Cliques,auxval]=FactAffinityElim(MI(auxperm,auxperm),auxperm,sizeconstraint,median(MI(auxperm)),1);
    0033          %[Cliques,auxval]=FactAffinityElim(MI,[1:NumbVar],sizeconstraint,median(MI),1)
    0034
    0035          % The parameters of the model are learned
    0036          [Tables] = LearnFDAParameters(Cliques,SelPop,NumbVar,Card);
    0037
    0038
    0039      model{1} = Cliques;
    0040      model{2} = Tables;
    0041
    0042      return;
    0043
    0044
    0045