⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pca.m

📁 最新的模式识别分类工具箱,希望对朋友们有用!
💻 M
字号:
function [features, targets, UW] = PCA(features, targets, dimension, region)%Reshape the data points using the principal component analysis%Inputs:%	train_features	- Input features%	train_targets	- Input targets%	dimension		- Number of dimensions for the output data points%	region			- Decision region vector: [-x x -y y number_of_points]%%Outputs%	features			- New features%	targets			- New targets%	UW					- Reshape martix%  mf					- Reshape means[r,c] = size(features);if (r < dimension),   disp('Required dimension is larger than the data dimension.')   disp(['Will use dimension ' num2str(r)])   dimension = r;end%Calculate cov matrix and the PCA matrixesQ			= (features * features')/c;[V, D]	                = eig(Q);W			= V(:,r-dimension+1:r)';U			= Q*W'*inv(W*Q*W');%Calculate new featuresUW			= U*W;features = UW*features;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -