資源簡介
偏最小二乘算法的matlab程序,主成分提取準則中的交叉有效性準則的調(diào)用函數(shù)。
代碼片段和文件信息
function?[presscumpressrmsecvrmsec]?=?crossval(xyrmcvmlvsplititermcoutosc);
%CROSSVAL?Cross-validation?for?PCA?PLS?and?PCR
%??This?function?does?cross-validation?for?regression
%??and?principal?components?analysis?models?by?several
%??different?methods?including:
%???leave-one-out???????????????(‘loo‘)
%???venetian?blind??????????????(‘vet‘)?
%???continuous?blocks???????????(‘con‘)?
%???repeated?random?test?sets???(‘rnd‘)?
%
%??The?inputs?are?the?scaled?predictor?variable?matrix?(x)?
%??predicted?variable?(y?not?needed?for?PCA?models)?regression?method
%??or?PCA?(rm)?which?can?be:
%???PLS?via?NIPALS?algorithm?(‘nip‘)???(Old?slow?way?of?doing?PLS)
%???PLS?via?SIMPLS?algorithm?(‘sim‘)???(New?fast?way?of?doing?PLS)
%???PCR??????????????????????(‘pcr‘)
%???MLR??????????????????????(‘mlr‘)
%???PCA??????????????????????(‘pca‘)???
%
%??cross-validation?method?(cvm?as?described?above)?number?of?latent?
%??variables?or?principal?components?to?calculate?(lv)?number?of
%??sections?to?split?the?data?into?(split?needed?for?‘vet‘?‘con‘
%??and?‘rnd‘?cross?validations)?number?of?iterations?(iter?needed
%??for?‘rnd‘)?an?optional?variable?which?suppresses?mean?centering
%??of?the?subsets?when?set?to?0?(mc)?an?optional?variable?which
%??supresses?the?output?when?set?to?0?(out)?and?an?optional?variable
%??which?specifies?the?number?of?orthogonal?signal?correction?components
%??to?use?(osc)?which?can?be?a?three?element?vector?which?specifies
%??number?of?components?iterations?and?tolerance?(osc?=?[nocompitertol]).?
%
%??The?outputs?are?the?predictive?residual?error
%??sum?of?squares?(press)?for?each?subset?and?the?cumulative
%??PRESS?(cumpress).?Note?that?for?multivariate?y?the?press
%??output?is?grouped?by?output?variable?i.e.?all?of?the?PRESS?values
%??for?the?first?variable?are?followed?by?all?of?the?PRESS?values
%??for?the?second?variable?etc.?Optional?outputs?are?the?root?mean
%??square?error?of?cross-validation?(rmsecv)?and?root?mean?square
%??error?of?(rmsec).?
%
%I/O:?[presscumpressrmsecvrmsec]?=?crossval(xyrmcvmlvsplititermcoutosc);
%?
%??Some?examples?of?how?you?might?call?CROSSVAL?are:
%???[presscumpress]?=?crossval(xy‘mlr‘‘loo‘);
%???[presscumpress]?=?crossval(xy‘nip‘‘loo‘10);
%???[presscumpress]?=?crossval(xy‘pcr‘‘vet‘103);
%???[presscumpress]?=?crossval(xy‘nip‘‘con‘105);
%???[presscumpress]?=?crossval(xy‘sim‘‘rnd‘10320);
%
%??To?suppress?mean?centering?in?the?first?two?cases:
%???[presscumpress]?=?crossval(xy‘mlr‘‘loo‘[][][]0);
%???[presscumpress]?=?crossval(xy‘nip‘‘loo‘10[][]0);
%
%??To?add?orthogonal?signal?correction?with?2?components:
%???[presscumpress]?=?crossval(xy‘sim‘‘vet‘103[][][]2);
%???[presscumpress]?=?crossval(xy‘pcr‘‘con‘103[][][]2);
%?
%??For?use?with?PCA?you?might?call?CROSSVAL?like:
%???[presscumpress]?=?crossval(x[]‘pca‘‘loo‘10);
%???[presscumpress]?=?crossval(x
- 上一篇:OFDM誤碼率
- 下一篇:偏最小二乘算法多輸入單輸出系統(tǒng)
評論
共有 條評論