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

    function p = double(m)
%double GPM parameters

%  Copyright 2015-2015 The MathWorks, Inc.

if isfitted(m)
    %Extract parameters from stats RegressionGP object
    
    % Sigma, Kernels Beta ActiveSet
    logML = m.LogML;
    s = m.StatsGPR.Sigma;
    k = m.StatsGPR.KernelInformation.KernelParameters;
    beta = m.StatsGPR.Beta;
    if ~all(m.StatsGPR.IsActiveSetVector)
        % only store active set if there are some inactive
        nActive = nnz(m.StatsGPR.IsActiveSetVector);
        a = find(m.StatsGPR.IsActiveSetVector);
    else
        nActive = Inf;
        a = [];
    end

elseif iscell(m.StatsGPR)
    % extract info from Name/Value pair cell array
    logML = m.LogML;
    s = m.StatsGPR{2};
    k = m.StatsGPR{4};
    beta = m.StatsGPR{6};
    if length(m.StatsGPR)>6
        nActive = length(m.StatsGPR{8});
        a = m.StatsGPR{8};
    else
        nActive = Inf;
        a = [];
    end
else
    % model not fitted
    logML = Inf;
    s = Inf;
    k = [];
    beta = [];
    nActive = Inf;
    a = [];
end

% store lengths so we can reconstruct
p = [5+length(k)              % end position of kernel parameters
    5+length(k)+length(beta)  % end position of beta
    5+length(k)+length(beta)+nActive  % end of active set indices
    logML
    s
    k
    beta
    a];