Home > Mateda2.0 > knowledge_extraction > Individuals_entropy.m

Individuals_entropy

PURPOSE ^

SYNOPSIS ^

function S_H = Individuals_entropy(Inds,Card,laplace)

DESCRIPTION ^

 function S_H = Individuals_entropy(Inds,Card,laplace)

 Population_entropy: This function calculates the accumulated entropy  for all
                     the variables in a given set of individual. It can be
                     the whole population or the selected individuals.

 INPUT
 Inds: Population or selected individuals. It is obtained from Cache{1,gen}
       or Cache{2,gen} respectively
 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
 S_H: The accumulate entropy value.

 Example:
 Pop = Cache{1,1};
 Inds_sel = Cache{2,1}; 
 S_H_pop = Individuals_entropy(Inds,Card,1);
 S_H_sel = Individuals_entropy(Inds_sel,Card,1);

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function S_H = Individuals_entropy(Inds,Card,laplace)
0002 %
0003 % function S_H = Individuals_entropy(Inds,Card,laplace)
0004 %
0005 % Population_entropy: This function calculates the accumulated entropy  for all
0006 %                     the variables in a given set of individual. It can be
0007 %                     the whole population or the selected individuals.
0008 %
0009 % INPUT
0010 % Inds: Population or selected individuals. It is obtained from Cache{1,gen}
0011 %       or Cache{2,gen} respectively
0012 % Card: Cardinalities of the variables
0013 % laplace: Determines wether or not Laplace correction is used in the computation
0014 % of the probabilities. laplace=1 (It is used), otherwise  it is not.
0015 %
0016 % OUTPUT
0017 % S_H: The accumulate entropy value.
0018 %
0019 % Example:
0020 % Pop = Cache{1,1};
0021 % Inds_sel = Cache{2,1};
0022 % S_H_pop = Individuals_entropy(Inds,Card,1);
0023 % S_H_sel = Individuals_entropy(Inds_sel,Card,1);
0024 %
0025 % Last version 5/11/08. Carlos Echegoyen (carlos.echegoyen@ehu.es)
0026 
0027 num_vars = size(Inds,2);
0028 
0029 S_H = 0;
0030 
0031 for i=1:num_vars
0032     min = 0;
0033     max = Card(i)-1;
0034     S_H = S_H + entropy(Inds(:,i),min,max,laplace);
0035 end

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