Home > Mateda2.0 > sampling > MOAGeneratePopulation.m

MOAGeneratePopulation

PURPOSE ^

[NewPop] = MOAGeneratePopulation(NumbVar,model,AuxPop,AuxFunVal,Card,sampling_params)

SYNOPSIS ^

function [NewPop] = MOAGeneratePopulation(NumbVar,model,Card,AuxPop,AuxFunVal,sampling_params)

DESCRIPTION ^

  [NewPop] =  MOAGeneratePopulation(NumbVar,model,AuxPop,AuxFunVal,Card,sampling_params)
 MOAGeneratePopulation:         Samples a population of individuals from a Markov network
                                usin Gibbs Sampling 
 INPUTS
 NumbVar: Number of variables
 model: Markov network model containing the structure (model{1} = Cliques)
        and the parameters (model{2} = Tables)
 Card: Vector with the dimension of all the variables. 
 AuxPop: Auxiliary (selected) population (May be use for partial sampling or resampling)
 AuxFunVal: Evaluation of the data set (required for some sampling algorithms, not for this one)
 sampling_params{1}(1) = PopSize: Number of generated individuals 
 sampling_params{1}(2) = GibbSteps: Number of Gibbs sampling steps 
 OUTPUTS
 NewPop: Sampled individuals

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [NewPop] = MOAGeneratePopulation(NumbVar,model,Card,AuxPop,AuxFunVal,sampling_params)
0002 %  [NewPop] =  MOAGeneratePopulation(NumbVar,model,AuxPop,AuxFunVal,Card,sampling_params)
0003 % MOAGeneratePopulation:         Samples a population of individuals from a Markov network
0004 %                                usin Gibbs Sampling
0005 % INPUTS
0006 % NumbVar: Number of variables
0007 % model: Markov network model containing the structure (model{1} = Cliques)
0008 %        and the parameters (model{2} = Tables)
0009 % Card: Vector with the dimension of all the variables.
0010 % AuxPop: Auxiliary (selected) population (May be use for partial sampling or resampling)
0011 % AuxFunVal: Evaluation of the data set (required for some sampling algorithms, not for this one)
0012 % sampling_params{1}(1) = PopSize: Number of generated individuals
0013 % sampling_params{1}(2) = GibbSteps: Number of Gibbs sampling steps
0014 % OUTPUTS
0015 % NewPop: Sampled individuals
0016 %
0017 % Last version 8/26/2008. Roberto Santana (roberto.santana@ehu.es)
0018 
0019 PopSize = cell2num(sampling_params{1}(1)); 
0020 GibbSteps = cell2num(sampling_params{1}(2)); 
0021 
0022 Cliques = model{1};
0023 Tables = model{2};
0024 
0025 for i=1:PopSize
0026  RandomInd = (fix(rand(1,NumbVar).*Card));
0027  NewPop(i,:) = MOAGenerateIndividual(RandomInd,Cliques,Tables,Card,GibbSteps);
0028 end,
0029 
0030 
0031

Generated on Fri 04-Dec-2009 13:38:29 by m2html © 2003