Fullsearch

From Eigenvector Documentation Wiki

Jump to: navigation, search

Contents

Purpose

Exhaustive Search Algorithm.

Synopsis

[desgn,fval] = fullsearch(fun,X,Nx_sub,P1,P2, ...);

Description

FULLSEARCH selects the Nx_sub variables in the M by Nx matrix X that minimizes fun. This can be used for variable selection. The algorithm should only be used for small problems because calculation time increases significantly with the size of the problem. fun is the name of the function (defined as a character string of an inline object) to be minimized. The function is called with the FEVAL function as follows: feval(fun,X,P1,P2,....), where X is the first argument for fun and P1, P2, ... the additional arguments of fun.

The output desgn is a matrix (class "logical") with the same size as X (M by Nx) with 1's where the variables where selected and 0's otherwise. Output fval has the M corresponding values of the objective function sorted in ascending order.

Inputs

  • fun = name of the function, a character string of an inline object.
  • X = input data.
  • Nx_sub = subset of original variables in X; Nx_sub < Nx.
  • P1, P2 ... = parameters for fun.

Outputs

  • desgn = logical matrix, M by Nx, with 1's for selected variables and 0's otherwise.
  • fval = values of the objective function sorted in ascending order.

Examples

find which 2 of 3 variables minimizes the inline function g:

   x = [0:10]';
   x = [x x.^2 randn(11,1)*10];
   y = x*[1 1 0]';
   g = inline('sum((y-x*(x\y)).^2)');
   [d,fv] = fullsearch(g,x,2,y);

find the 2 variables that minimize the cross-validation error for PCR, noting that the output from CROSSVAL is a vector and g should return a scalar

   load plsdatad
   x = xblock1.data;
   y = yblock1.data;
   g = inline('min(getfield(crossval(x,y,''pcr'',{''con'' 3},1,0),''press'')))','x','y');
   [d,fv] = fullsearch(g,x,2,y);  %takes a while if Nx_sub is > 2

See Also

calibsel, crossval, genalg

Views
Personal tools