Home > Mateda2.0 > knowledge_extraction > Generations_entropy.m

# Generations_entropy

## PURPOSE

function H_gens = Generations_entropy(inds_gens,Card,laplace)

## SYNOPSIS

function H_gens = Generations_entropy(inds_gens,Card,laplace)

## DESCRIPTION

     function H_gens = Generations_entropy(inds_gens,Card,laplace)

     Generations_entropy: Calculates the entropy accumulated by a
                          set of individuals (population or selected individual)
                          at each generation of the EDA.
     INPUT
     inds_gens{maxgen} = A cell array with the population or the selected
                         individual at each generation. It is obtained from
                         Cache{1,:} or Cache{2,:}
     Card: Cardinalities of the variables
     laplace: Determines wether or not Laplace correction is used in the computation
     of the probabilities. Laplace=1 (It is used), otherwise  it is not.

     OUTPUT
     H_gens: It is an array with the calculated entropies at each generation.

     Example:
     for i=1:maxgen
       inds_gens{i}=Cache{1,i};
     end
     H_gens = Generations_entropy(inds_gens,Card,0);
     X = [1,maxgen]
     plot(X,H_gens);

     Last version 5/11/08. Carlos Echegoyen (carlos.echegoyen@ehu.es)

## CROSS-REFERENCE INFORMATION

This function calls:

- Individuals_entropy

This function is called by:

- FitnessMeasuresComp %%%%%%%%%%%%%%% COMPUTATION OF FITNESS RELATED MEASURES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

## SOURCE CODE

    0001 function H_gens = Generations_entropy(inds_gens,Card,laplace)
    0002 % function H_gens = Generations_entropy(inds_gens,Card,laplace)
    0003 %
    0004 % Generations_entropy: Calculates the entropy accumulated by a
    0005 %                      set of individuals (population or selected individual)
    0006 %                      at each generation of the EDA.
    0007 % INPUT
    0008 % inds_gens{maxgen} = A cell array with the population or the selected
    0009 %                     individual at each generation. It is obtained from
    0010 %                     Cache{1,:} or Cache{2,:}
    0011 % Card: Cardinalities of the variables
    0012 % laplace: Determines wether or not Laplace correction is used in the computation
    0013 % of the probabilities. Laplace=1 (It is used), otherwise  it is not.
    0014 %
    0015 % OUTPUT
    0016 % H_gens: It is an array with the calculated entropies at each generation.
    0017 %
    0018 %
    0019 % Example:
    0020 % for i=1:maxgen
    0021 %   inds_gens{i}=Cache{1,i};
    0022 % end
    0023 % H_gens = Generations_entropy(inds_gens,Card,0);
    0024 % X = [1,maxgen]
    0025 % plot(X,H_gens);
    0026 %
    0027 % Last version 5/11/08. Carlos Echegoyen (carlos.echegoyen@ehu.es)
    0028
    0029 max_gen = size(inds_gens,2);
    0030
    0031 for i=1:max_gen
    0032     H_gens(i) = Individuals_entropy(inds_gens{i},Card,laplace);
    0033 end