Home > lib > fisher_ld.m

fisher_ld

PURPOSE ^

[W_star]/[W_star, lambdas] =

SYNOPSIS ^

function [W_star, varargout] = fisher_ld(data, flag_sphere, flag_modified_s_b, P)

DESCRIPTION ^

 [W_star]/[W_star, lambdas] = 
   fisher_ld(data, flag_sphere=1, flag_modified_s_b=0, P=0)
 
 Calculates Fisher's Linear Discriminant vectors (loadings):

 Inputs
   data: structure with the following:
     .X: dataset with rows as observations and columns as features;
     .classes: column vector with corresponding classes (0-based)
   flag_sphere = 0: forces S_W to be the identity.
   flag_modified_s_b: see calculate_scatters()

 If either data or pieces is passed, the scatter matrixes will be
 calculated.

 If data is passed, the rank of S_W will be tested, and if it is lower
 than the dimensionality of the problem (i.e., number of features), PCA
 will be run first to project the data onto a space where the within-class 
 scatter matrix (say S_W_PCA) will be non-singular and then the obtained
 LDA loadings will be projected back to the original space.

 Fisher's Linear Discriminant according to R. O. Duda, Pattern
 Classification.

 The reference puts the equation to solve:

 S_B*w = lambda*S_W*w 

 There are rank(S_B) (at most no_classes-1) different w's.

    [V,D] = EIG(A,B) produces a diagonal matrix D of generalized
    eigenvalues and a full matrix V whose columns are the
    corresponding eigenvectors so that A*V = B*V*D.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Thu 18-Feb-2010 12:47:47 by m2html © 2003