Evaluation function - gpols_evaluate.m

Syntax:
newpopu = gpols_evaluate(popu,ixv,X,Y,Q,opte);

 newpopu Structure (population) Resulted population (with fitness values)
 popu Structure (population) Population
 ixv Vector of integers Indexes of individuals must be evaluated
 X Matrix of reals (np x nr) Input data for evaluation
 Y Vector of reals (np x 1) Output data for evaluation
 Q Vector of reals (np x 1) Optional weighting vector for X and Y
 opte Vector (4 x 1 or 1 x 4) Options vector


This function evaluates the individuals of population. It determines the linear parameters, applies OLS to eliminate subtrees, and evaluates the fintess-value of resulted individuals (trees).

The popu is the population variable, which contains the individuals must be evaluated.

The ixv contains the indexes of individuals which must be evaluated. If. e.g. ixv = [1 2 5 6] then it means that the 1-th, 2-nd, 5-th, and 6-th member of population will be evaluated.

The X is regression matrix and the Y is the desired output vector. The terminal nodes of trees refer to X, the estimated output is compared to Y.

If Q vector is used, than the LS estimation problem modifies to ET·diag(Q)·E, where E = Y - Ye, Ye is the estimated output, Ye = X·Θ.

The opte contains some parameters:
opte(1:2): a1 and a2 parameters of tree-size penalty function if they are zeros then the penalty is not used,
opt(3): OLS threshold value (0-1 or integer greater than 1),
opt(4): set 1 if you want polynomial evaluation, else 0.

Example:

%Evaluate the population
opte(1) = 0.2;
opte(2) = 30;
opte(3) = 0.02;
opte(4) = 0;
popu = gpn_evaluate(popu,[1:50],X,Y,[],opte);
%Fitness values (min, mean and max)
v = [];
for i = 1:50,
  v = [v, popu.chrom{i}.fitness];
end
[min(v) mean(v) max(v)]