Direct LDA and PCA+LDA

版本 1.1.0.0 (6.8 KB) 作者: Vipin Vijayan
Implementation of LDA, Direct LDA and PCA+LDA. See description for details.
4.2K 次下载
更新时间 2013/4/19

查看许可证

This implements the algorithm described in
Hua Yu and Jie Yang "A direct LDA algorithm for high-dimensional data -
with application to face recognition"
Read it. It's short.

Basically what we have here is LDA (linear discriminant analysis), Direct LDA, which does LDA but better (basically when your within class scatter matrix, Sw, is singular, it does not throw away the null space of Sw, which contains most of the discriminating information), and PCA+LDA, which does PCA on the data and then does LDA on the dimensionally reduced data.

There is also an implementation of PCA (principal component analysis) using eigendecomposition and another using SVD in here.

INPUT

X : nt x n where nt examples of feature vectors of size n
y : vector of size nt of class labels
eg:
X = [2 3 4 2; 8 2 3 4; 3 9 2 3; 8 4 2 3; 9 9 2 8];
y = [3; 2; 4; 3; 2];
k : the number of features we want at the end

method : either pcalda or directlda
if method = directlda then we are maximizing |A'*Sb*A|/|A'*Sw*A| except
that the null space of Sw, which apparently has the most discriminating
information, is not thrown away
if method = pcalda then we are maximizing |A'*St*A|/|A'*Sw*A|

m :
if method = directlda then m = the no. dims. we want from the Sb scatter matrix
if method = pcalda then m = the no. of dims. we want from the pca part
if method = pcalda and m = inf, then this is just regular lda

OUTPUT

A : the projection A which maximizes between class / within class scatter
T : transformation that spheres the data, for classification/comparison

In the demo, I compared this to http://www.mathworks.com/matlabcentral/fileexchange/38950-fischer-linear-dicriminant-analysis for checking correctness.

引用格式

Vipin Vijayan (2024). Direct LDA and PCA+LDA (https://www.mathworks.com/matlabcentral/fileexchange/41379-direct-lda-and-pca-lda), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2011b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Dimensionality Reduction and Feature Extraction 的更多信息
致谢

参考作品: Fisher Linear Dicriminant Analysis

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.1.0.0

Minor update to fix output argument order.

1.0.0.0