杠杆点选样本的算法.txt
来自「窗口移动多项式平滑演示程序。。。二维数据模拟程序」· 文本 代码 · 共 50 行
TXT
50 行
function [XSelected,XRest,vSelectedRowIndex]=LevSamplePartition(X,Num)
% LevSamplePartition selects the samples XSelected which uniformly distributed in the exprimental data X's space
% Input
% X:the matrix of the sample spectra
% Num:the number of the sample spectra you want select
% Output
% XSelected:the sample spectras was selected from the X
% XRest:the sample spectras remain int the X after select
% vSelectedRowIndex:the row index of the selected sample in the X matrix
% Programmer: zhimin zhang @ central south university on Nov 1 ,2007
% Reference: Y. Wang, D.J. Veltkamp and B.R. Kowalski, Anal. Chem., 63 (1991) 2750-2756.
[nRow,nCol]=size(X);
vAllSample=1:nRow;
Xtemp=X;
for i=1:Num
mHatMatrix=Xtemp*pinv(Xtemp);
[vMax,vIndex] = max(mHatMatrix);
[nMax,nIndex] = max(vMax);
vSelectedRowIndex(i)=vAllSample(vIndex(nIndex));
vCorrent=X(vAllSample(vIndex(nIndex)),:);
vAllSample=setdiff(vAllSample,vSelectedRowIndex);
Xtemp=[];
for j=1:length(vAllSample)
Xtemp(j,:)=Schmidt(vCorrent,X(vAllSample(j),:)) ;
end
end
for i=1:length(vSelectedRowIndex)
XSelected(i,:)=X(vSelectedRowIndex(i),:);
end
for i=1:length(vAllSample)
XRest(i,:)=X(vAllSample(i),:);
end
--
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?