Be the first to rate this file! 34 Downloads (last 30 days) File Size: 1.95 KB File ID: #33768

Linear Discriminant Analysis Code

by Muhammet

 

14 Nov 2011 (Updated 16 Nov 2011)

this function converts data from its original space to LDA space.

| Watch this File

File Information
Description

% [sLDA WLDA M WPCA]=mylda(data,class,n)
% this function written by muhammet balcilar
% yildiz technical university computer engineering department
% istanbul turkiye 2011

% this function convert data from its original space to LDA space
% if number of data samples is less than number of diamension, PCA is
% implemented for reducing number of diamension to #samples-1.
% after PCA, LDA is implemented for reducing diamention to n.

% data is consist of M rows(sample size), N cols(dimensions)
% class is consist of M rows(sample size), 1 cols , each element of class
% is shows class number of each data sample
% (class number must be integer 1 to classsize)
% n is the number of outputs data diamensions.(optionally)
% sLDA is consist of M rows(sample size) n cols(new dimensions)
% WPCA is translate matrix which convert to original space to PCA space
% M is the mean vector of training set
% WLDA is the translate matrix which convert to original space to LDA space
% exaple: there are 4 samples which have 5 diamensions.first two samples
% are member of class 1 others are member of class 2.
% Train= [5.6,5.7,5.5,5.7 5.6;
% 5.7,5.3,5.1,5.0 5.2;
% 10.6,9.9,10.4,10.7 10.2;
% 10.7,9.8,9.9,10 10];
% Class=[1;1;2;2];
% [sLDA WLDA M WPCA]=mylda(Train,Class)
% Test= [4.9 5.5 4.8 5.7 5];
% LDATEST = (Test-M)*WPCA*WLDA

Required Products MATLAB
MATLAB release MATLAB 7.6 (R2008a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
19 Nov 2011 Muhammet

this program runs with multi class too.

Please login to add a comment or rating.
Updates
16 Nov 2011

output parameters are changed

Tag Activity for this File
Tag Applied By Date/Time
lda Muhammet 14 Nov 2011 09:59:09
linear discriminant Muhammet 14 Nov 2011 09:59:09
multi class Muhammet 19 Nov 2011 01:59:26

Contact us at files@mathworks.com