简体   繁体   English

部署PCA的gabor滤波器组中的功能减少

[英]feature reduction within gabor filter banks deploying PCA

Using Matlab, I'm working with Gabor filter bank, with different orientations and scales, I got a huge no.of features by the no.of used filters. 使用Matlab,我正在使用Gabor滤波器组,具有不同的方向和比例,通过使用的滤波器数量,我获得了大量的功能。 with the total number of training data, I want to deploy the PCA to reduce the features number, but I don't know how to begin and which function to use, plz help. 根据培训数据的总数,我想部署PCA来减少功能部件的数量,但是我不知道如何开始以及使用哪个功能,请帮助。

If you want to use PCA in order to reduce the number of features Matlab makes everything available to you 如果您想使用PCA来减少功能数量, Matlab将为您提供所有可用功能

A little bit more basic version: 基本版本:

%% some data points for 2 features
X = [1,1,1, 2,2,2, 3,3,3 ; 1,2,3, 2,3,4, 3,4,5];
numX = size(X,2);

%% PCA
covX = zeros(2,2); % sample covariance
meanX = mean(X,2); % sample mean
for k = 1:numX
    covX = covX + (X(:,k) - meanX) * (X(:,k) - meanX)';
end
covX = covX / (numX - 1);

% essential part of PCA:
[V,D] = eig(covX);

PCA示例

Now feature reduction by PCA usually means to interpret the directions of highest variance (corresponding to diagonal entries in D ) as most discriminative ones. 现在,通过PCA进行特征约简通常意味着将方差最大的方向(与D对角线条目相对应)解释为最具区分性的方向。 So you can use just a few columns of V to reweight your features to a smaller subset of largest variation. 因此,您可以仅使用V的几列来将特征重新加权为最大变化的较小子集。

Maybe a little bit off your question but quite important in my view: Deploying PCA is not always the best choice to reduce the number of features since the directions of largest variance are not always the most discriminating directions! 也许您的问题有些疑问,但在我看来非常重要:部署PCA并非总是减少功能部件数量的最佳选择,因为方差最大的方向并不总是最具区分性的方向! Furthermore, you still have to compute all your features and just reduce the number for classification (which hopefully saves you from overfitting problems). 此外,您仍然必须计算所有特征,而只是减少分类的数量(希望可以避免过度拟合的问题)。 So maybe you want to consider other feature selection methods as well. 因此,也许您也想考虑其他特征选择方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM