Home > Mateda2.0 > sampling > SampleBN.m

# SampleBN

## PURPOSE

[NewPop] = SampleBN(NumbVar,bnet,Card,AuxPop,AuxFunVal,sampling_params)

## SYNOPSIS

function[NewPop] = SampleBN(NumbVar,bnet,Card,AuxPop,AuxFunVal,sampling_params)

## DESCRIPTION

     [NewPop] = SampleBN(NumbVar,bnet,Card,AuxPop,AuxFunVal,sampling_params)
     SampleBN:    Samples PopSize individuals from the Bayesian network bnet
     INPUTS
     NumbVar: Number of variables
     bnet: Bayesian network
     PopSize: Number of individuals to be generated
     Card: Cardinality of 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
     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] = SampleBN(NumbVar,bnet,Card,AuxPop,AuxFunVal,sampling_params)
    0002 % [NewPop] = SampleBN(NumbVar,bnet,Card,AuxPop,AuxFunVal,sampling_params)
    0003 % SampleBN:    Samples PopSize individuals from the Bayesian network bnet
    0004 % INPUTS
    0005 % NumbVar: Number of variables
    0006 % bnet: Bayesian network
    0007 % PopSize: Number of individuals to be generated
    0008 % Card: Cardinality of the variables
    0009 % AuxPop: Auxiliary (selected) population (May be use for partial sampling or resampling)
    0010 % AuxFunVal: Evaluation of the data set (required for some sampling
    0011 % algorithms, not for this one)
    0012 % sampling_params{1}(1) = PopSize: Number of generated individuals
    0013 % OUTPUTS
    0014 % NewPop: Sampled individuals
    0015 %
    0016 % Last version 8/26/2008. Roberto Santana (roberto.santana@ehu.es)
    0017
    0018 PopSize = cell2num(sampling_params{1}(1));
    0019 for i=1:PopSize
    0020  NewPop(i,:) = cell2num(sample_bnet(bnet))-1;
    0021 end
    0022