covlinard.m
来自「高斯过程在回归和分类问题中的应用」· M 代码 · 共 36 行
M
36 行
function [A, B] = covLINard(logtheta, x, z);% Linear covariance function with Automatic Relevance Determination (ARD). The% covariance function is parameterized as:%% k(x^p,x^q) = x^p'*inv(P)*x^q%% where the P matrix is diagonal with ARD parameters ell_1^2,...,ell_D^2, where% D is the dimension of the input space. The hyperparameters are:%% logtheta = [ log(ell_1)% log(ell_2)% .% log(ell_D) ]%% Note that there is no bias term; use covConst to add a bias.%% For more help on design of covariance functions, try "help covFunctions".%% (C) Copyright 2006 by Carl Edward Rasmussen (2006-03-24)if nargin == 0, A = 'D'; return; end % report number of parametersell = exp(logtheta);x = x*diag(1./ell);if nargin == 2 A = x*x';elseif nargout == 2 % compute test set covariances z = z*diag(1./ell); A = sum(z.*z,2); B = x*z';else % compute derivative matrices A = -2*x(:,z)*x(:,z)';end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?