• 大小: 11KB
    文件类型: .m
    金币: 1
    下载: 0 次
    发布日期: 2021-06-05
  • 语言: Matlab
  • 标签: LDA,Matlab  

资源简介

LDA( Linear Discriminant Analysis),很不错

资源截图

代码片段和文件信息

function [eigvector eigvalue elapse] = LDA(gndoptionsdata)
% LDA: Linear Discriminant Analysis 
%
%       [eigvector eigvalue] = LDA(gnd options data)

%             Input:
%               data  - Data matrix. Each row vector of fea is a data point.
%               gnd   - Colunm vector of the label information for each
%                       data point. 
%               options - Struct value in Matlab. The fields in options
%                         that can be set:
%
%                            Regu  -  1: regularized solution 
%                                        a* = argmax (a‘X‘WXa)/(a‘X‘Xa+ReguAlpha*I) 
%                                     0: solve the sinularity problem by SVD 
%                                     Default: 0 
%
%                         ReguAlpha -  The regularization parameter. Valid
%                                      when Regu==1. Default value is 0.1. 
%
%                            ReguType  -  ‘Ridge‘: Tikhonov regularization
%                                         ‘Custom‘: User provided
%                                                   regularization matrix
%                                          Default: ‘Ridge‘ 
%                        regularizerR  -   (nFea x nFea) regularization
%                                          matrix which should be provided
%                                          if ReguType is ‘Custom‘. nFea is
%                                          the feature number of data
%                                          matrix
%                        Fisherface     -  1: Fisherface approach
%                                             PCARatio = nSmp - nClass
%                                          Default: 0
%
%                            PCARatio     -  The percentage of principal
%                                            component kept in the PCA
%                                            step. The percentage is
%                                            calculated based on the
%                                            eigenvalue. Default is 1
%                                            (100% all the non-zero
%                                            eigenvalues will be kept.
%                                            If PCARatio > 1 the PCA step
%                                            will keep exactly PCARatio principle
%                                            components (does not exceed the
%                                            exact number of non-zero components).  
%                           
%
%             Output:
%               eigvector - Each column is an embedding function for a new
%                           data point (row vector) x  y = x*eigvector
%                           will be the embedding result of x.
%               eigvalue  - The sorted eigvalue of LDA eigen-problem. 
%               elapse    - Time spent on different steps 
%
%    Exampl

评论

共有 条评论

相关资源