www.gusucode.com > mbcmodels 工具箱 matlab 源码程序 > mbcmodels/@localmulti/pUpdateR2.m
function [L,Params] = pUpdateR2(L,Params) %PUPDATER2 update R2 statistics for Neural network models % % [L,Params] = pUpdateR2(L,Params) % This function is called from mdev_local/checkmodel % Copyright 2007 The MathWorks, Inc. if any(strcmp(L.Select,{'R^2','RMSE'})) && ~isempty(get(L,'ytrans')) % update only required if selection statistic is R2 mdls = get(L.xregmulti,'models'); IsNNet = cellfun(@(m) isa(m,'xregnnet') && pNeedsR2Update(m),mdls); if any(IsNNet) % there are some nnet models needing updating IndNN = find(IsNNet); for i=IndNN % update nnet models so another update is not required mdls{i} = xregnnet(mdls{i}); end L.xregmulti = set(L.xregmulti,'models',mdls); nf = nfactors(L); L.SelectionStatistic(IndNN) = NaN; for i=1:size(Params,2) b = Params(:,i); % remove selection statistics for nnets indexSelStats = b(2)+2+2*nf+3; b(indexSelStats+IndNN) = NaN; Params(:,i) = b; end end end