资源简介
近红外光谱数据预处理的算法,包括mcs\msc\snv\sg等一些预处理算法
代码片段和文件信息
function F=carspls(XyAfoldmethodnum)
%+++ CARS: Competitive Adaptive Reweighted Sampling method for variable selection.
%+++ X: The data matrix of size m x p
%+++ y: The reponse vector of size m x 1
%+++ A: the maximal principle to extract.
%+++ fold: the group number for cross validation.
%+++ num: the number of Monte Carlo Sampling runs.
%+++ method: pretreatment method.
%+++ Hongdong Li Dec.15 2008.
%+++ Advisor: Yizeng Liang yizeng_liang@263.net
%+++ lhdcsu@gmail.com
%+++ Ref: Hongdong Li Yizeng Liang Qingsong Xu Dongsheng Cao Key
% wavelengths screening using competitive adaptive reweighted sampling
% method for multivariate calibration Anal Chim Acta 2009 648(1):77-84
tic;
%+++ Initial settings.
if nargin<6;num=50;end;
if nargin<5;method=‘center‘;end;
if nargin<4;fold=5;end;
if nargin<3;A=2;end;
%+++ Initial settings.
[MxNx]=size(X);
A=min([Mx Nx A]);
index=1:Nx;
ratio=0.9;
r0=1;
r1=2/Nx;
Vsel=1:Nx;
Q=floor(Mx*ratio);
W=zeros(Nxnum);
Ratio=zeros(1num);
%+++ Parameter of exponentially decreasing function.
b=log(r0/r1)/(num-1); a=r0*exp(b);
%+++ Main Loop
for iter=1:num
perm=randperm(Mx);
Xcal=X(perm(1:Q):); ycal=y(perm(1:Q)); %+++ Monte-Carlo Sampling.
PLS=pls(Xcal(:Vsel)ycalAmethod); %+++ PLS model
w=zeros(Nx1);coef=PLS.coef_origin(1:end-1end);
w(Vsel)=coef;W(:iter)=w;
w=abs(w); %+++ weights
[wsindexw]=sort(-w); %+++ sort weights
ratio=a*exp(-b*(iter+1)); %+++ Ratio of retained variables.
Ratio(iter)=ratio;
K=round(Nx*ratio);
w(indexw(K+1:end))=0; %+++ Eliminate some variables with small coefficients.
Vsel=randsample(NxNxtruew); %+++ Reweighted Sampling from the pool of retained variables.
Vsel=unique(Vsel);
fprintf(‘The %dth variable sampling finished.\n‘iter); %+++ Screen output.
end
%+++ Cross-Validation to choose an optimal subset;
RMSEP=zeros(1num);
Q2_max=zeros(1num);
Rpc=zeros(1num);
for i=1:num
vsel=find(W(:i)~=0);
CV=plscvfold(X(:vsel)yAfoldmethod0);
RMSEP(i)=CV.RMSECV;
Q2_max(i)=CV.Q2_max;
Rpc(i)=CV.optPC;
fprintf(‘The %d/%dth subset finished.\n‘inum);
end
[RminindexOPT]=min(RMSEP);
Q2_max=max(Q2_max);
%+++ save results;
time=toc;
%+++ output
F.W=W;
F.time=time;
F.cv=RMSEP;
F.Q2_max=Q2_max;
F.minRMSECV=Rmin;
F.iterOPT=indexOPT;
F.optPC=Rpc(indexOPT);
Ft.ratio=Ratio;
F.vsel=find(W(:indexOPT)~=0)‘;
function sel=weightsampling_in(w)
%Bootstrap sampling
%2007.9.6H.D. Li.
w=w/sum(w);
N1=length(w);
min_sec(1)=0; max_sec(1)=w(1);
for j=2:N1
max_sec(j)=sum(w(1:j));
min_sec(j)=sum(w(1:j-1));
end
% figure;plot(max_sec‘r‘);hold on;plot(min_sec);
for i=1:N1
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3796 2014-11-18 15:43 Functions\Data processing.m
文件 3401 2014-03-06 17:18 Functions\carspls.m
文件 1936 2014-03-10 15:03 Functions\deriv.m
文件 955 2014-03-06 17:20 Functions\genfact.m
文件 1146 2014-03-06 17:20 Functions\grampoly.m
文件 3472 2014-11-12 22:07 Functions\ks.m
文件 3038 2014-03-06 17:18 Functions\mcs.m
文件 2311 2014-03-06 17:19 Functions\msc.m
文件 1950 2014-11-11 19:32 Functions\pls.m
文件 1728 2014-03-06 17:18 Functions\pls_nipals.m
文件 2720 2014-11-11 19:36 Functions\plscvfold.m
文件 790 2014-03-06 17:18 Functions\pretreat.m
文件 2561 2014-06-03 14:45 Functions\smooth.m
文件 918 2014-11-06 17:28 Functions\snv.m
文件 451 2014-03-06 17:18 Functions\tp.m
文件 1218 2014-03-06 17:20 Functions\weight.m
文件 1312 2014-11-18 02:51 license.txt
相关资源
- 图说Kepserver Data Exchange Client实现双P
- IMX214 datasheet
- FERET人脸数据库转化为MAT文件
- A2005data.rar
- datalogic读码器设置操作手册
- IMX6SDLRM.pdf
- Array Signal Processing: Concepts and Techniqu
- 大数据技术原理与应用第二版林子雨
- OV10633 Datasheet
- getdatagraphdigitizer破解版
- Big Data and Machine Learning in Quantitative
- Allwinner_F1C200s_Datasheet_V1.0.pdf
- MV-S103182-00_Datasheet for 88E6045 and 88E604
- NT96658DATASHEET
- 三级数据库题库
- EEG Signal processing
- QCA9563 datasheet
- Data Analysis A Bayesian Tutorial
-
Principles_of_Distributed_Databa
se_Systems_ - 中国科学院大学 陈世敏老师的大数据
- sentiment_data.rar
- FDC2214数据手册 中文翻译版
- Data clustering algorithm and application
- Long-TermWi-Fifingerprintingdatasetandsuppor.r
- SPSS的hayes process插件
- 算法和数据结构:基本工具箱Kurt Me
- 数据不均衡问题经典文献《Learning f
- SensorArraySignalProcessing.pdf
- 格科微GC0403数据手册Datasheet
- High-Dimensional Probability: An Introduction
评论
共有 条评论