www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/@mdev_local/CreateAlternativeModels.m

    function [mdev,OK] = CreateAlternativeModels(mdev,varargin)
%CreateAlternativeModels make a series of alternative models and select the best
%
% This option makes alternative response feature models for each response
% feature
%   mdev= CreateAlternativeModels(mdev,Models,Criteria);
%     Models   list of  models (from model template)
%     Criteria Selection criteria for best model
%
% This option makes alternative local models as well as alternative
% response feature models
%   mdev= CreateAlternativeModels(mdev,LocalModels,LocalCriteria,GlobalModels,GlobalCriteria);
%     LocalModels    list of local models
%     LocalCriteria  'Two-Stage RMSE'
%     GlobalModels   list of global models (from model template)
%     GlobalCriteria Selection criteria for best model
%


%  Copyright 2000-2006 The MathWorks, Inc. and Ford Global Technologies, Inc.

% break best model to make creating altenerative models 'safe'
best= BMIndex(mdev);
mdev= BestModel(mdev,0);
if length(varargin)==4

    % use global list for current local model
    [mdev,OK] = iMakeGlobal(mdev,varargin{3:4});
    if best
        MakeTwoStage(info(mdev),best==2);
    end
    
    presp= Parent(mdev);
    presp.CreateAlternativeModels(varargin{:});
else
    [mdev,OK] = iMakeGlobal(mdev,varargin{:});
    if best
        MakeTwoStage(info(mdev),best==2);
    end
end

mdev= info(mdev);


function [mdev,OK] = iMakeGlobal(mdev,varargin)

ch= children(mdev);
OK = true;
for i = 1:numChildren(mdev)
    % just use global mlist
    [mdevCH,OK] = CreateAlternativeModels(ch(i).info,varargin{:});
    if ~OK
        break
    end
end
mdev= info(mdev);