File Exchange

image thumbnail

Fisher Linear Dicriminant Analysis

version 1.1.0.0 (3.04 KB) by Sergios Petridis
find the discriminative susbspace for samples using fisher linear dicriminant analysis

6 Downloads

Updated 14 Jun 2016

View Version History

View License

Scope:
Given a number of samples, each one represented by a point in the R^d dimensional space, together with a label associated to each sample, this function returns a d x matrix of size n x d that allows to represent each sample by a point in a R^n dimensional space, so that points of different labels are still distinguishable (classification problem)

The implemented function supports two variations of the Fisher criterion, one based on generalised eigenvalues (ratio trace criterion) and another based on an iterative solution of a standard eigenvalue problem (trace ratio criterion). The later implementation, is based on

Lei-Hong Zhang, Li-zhi Liao and Michael K. Ng, "Fast Algorithms for the generalised foley-sammon discriminant analysis", SIAM Journal on Matrix Analysis and Applications, vol 31, p.1584, 2010

which also provides a good analysis of the criteria.

A further variant allows to orient the subspace found by the trace ratio criterion according to the ration trace criterion.

An optional PCA-like preprocessing is available to increase robustness, when the number of features is larger to the number of samples

Options:

Syntax [ V, eigvalueSum ] = fld( X, L, n, crit, qrf, r, e, M )

Input arguments:
X: the s x d samples matrix (s samples x d features each )
L: the s x 1 labels matrix
n: the dimension the subspace required
Optional arguments:
crit: 1 (ratio trace criterion - default)
2 (trace ratio criterion)
3 (tr criterion for subspace + rt criterion for axis)
qrf: preprocess with qr decomposition, for robustness (default value: false)
r: the regularisation parameter (default value: 0)
e: epsilon value to end iterations for tr criterion (defaut value: 0.001)
M: maximum number of iterations for tr criterion (defaut value: 100)

Output:
V: the optimal fiher ( n x d ) orthonormal matrix
ratio: the sum of generalised eigenvalues or the optimal value of the trace ratio
% eigvals: the eigenvalues of the (B - r * W) matrix

Cite As

Sergios Petridis (2021). Fisher Linear Dicriminant Analysis (https://www.mathworks.com/matlabcentral/fileexchange/38950-fisher-linear-dicriminant-analysis), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (1)

bufferoverflow

http://archive.ics.uci.edu/ml/datasets/Gisette I tried on this dataset and it gave a bunch of errors.
[X1,eigenValueSum1]=fld(gisette_data,gisette_label,2)

On train_data from the datset folder.

Error using eigs/checkInputs/LUfactorB (line 1001)
B is singular.
Unable to compute the specified eigenvalues because infinite eigenvalue(s) exist

Error in eigs/checkInputs (line 839)
[LB,UB,ppB,qqB,dgB] = LUfactorB;

Error in eigs (line 94)
[A,Amatrix,isrealprob,issymA,n,B,classAB,k,eigs_sigma,whch, ...

Error in fld>ratio_trace_criterion (line 180)
[V, eigvalue] = eigs( Nmat, Dmat, n, 'LM', OPTS );

Error in fld (line 144)
[V, eigvalueSum ] = ratio_trace_criterion( Nmat, Dmat, n );

Any thoughts?

MATLAB Release Compatibility
Created with R2010a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired: Direct LDA and PCA+LDA

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!