www.gusucode.com > mbcmodels 工具箱 matlab 源码程序 > mbcmodels/@xreggpr/modelproperties.m

    function p = modelproperties(m,p)
%modelproperties model properties for command-line
%
%   p = modelproperties(m,p)

%  Copyright 2015-2015 The MathWorks, Inc.

ID = getType(m);
[p,OK] = PersistentStore(p,ID);
if ~OK
    p = addprop(p,'KernelFunction',...
        @( m ) m.Kernel,...
        @( m,v ) iSetKernel( m, v ),...
        'enum',classreg.learning.modelparams.GPParams.BuiltInKernelFunctions,...
        'Kernel function');
    
    p = addprop(p,'BasisFunction',...
        @( m ) m.Basis,...
        @( m,v ) iSetBasis( m, v ),...
        'enum',classreg.learning.modelparams.GPParams.BuiltInBasisFunctions,...
        'Explicit basis function');

    p = addprop(p,'Threshold',...
        @( m ) m.LargeScale.Threshold,...
        @( m,v ) iSetThreshold( m, v ),...
        'int',[1,Inf],...
        'Threshold to switch to large data fitting algorithm');    

    p = addprop(p,'ActiveSetSize',...
        @( m ) m.LargeScale.ActiveSetSize,...
        @( m,v ) iSetActiveSetSize( m, v ),...
        'int',[1,Inf],...
        'Active set size');    
    
    p = addprop(p,'ActiveSetMethod',...
        @( m ) m.LargeScale.ActiveSetMethod,...
        @( m,v ) iSetActiveMethod( m, v ),...
        'enum', classreg.learning.modelparams.GPParams.BuiltInActiveSetMethods,...
        'Large scale active set method');        
    p = addprop(p,'FitMethod',...
        @( m ) m.LargeScale.FitMethod,...
        @( m,v ) iSetFitMethod( m, v ),...
        'enum',{'SD','FIC','SR'},...
        'Large data fit method');    
    p = addprop(p,'PredictMethod',...
        @( m ) m.LargeScale.PredictMethod,...
        @( m,v ) iSetPredictMethod( m, v ),...
        'enum',classreg.learning.modelparams.GPParams.BuiltInPredictMethods,...
        'Large data predict method');    
   
    p = modelproperties(m.xregmodel,p);
    
    PersistentStore(p,ID);
end


function m = iSetKernel( m, v )

m.Kernel = v;
% Need to reset the model so that it will fit correctly
m = reset( m );

function m = iSetBasis( m, v )

m.Basis = v;
% Need to reset the model so that it will fit correctly
m = reset( m );


function m = iSetThreshold( m, v )

m.LargeScale.Threshold = v;
% Need to reset the model so that it will fit correctly
m = reset( m );

function m = iSetActiveSetSize( m, v )

m.LargeScale.ActiveSetSize = v;
% Need to reset the model so that it will fit correctly
m = reset( m );


function m = iSetActiveMethod( m, v )

m.LargeScale.ActiveMethod = v;
% Need to reset the model so that it will fit correctly
m = reset( m );


function m = iSetFitMethod( m, v )

m.LargeScale.FitMethod = v;
% Need to reset the model so that it will fit correctly
m = reset( m );

function m = iSetPredictMethod( m, v )

m.LargeScale.PredictMethod = v;
% Need to reset the model so that it will fit correctly
m = reset( m );