资源简介
高斯过程回归源码 及结果展示
代码片段和文件信息
% Calculates for xstar x-coordinates the bestEstimate and the 95%
% confidence interval (bounds) for a Gaussian process regression.
% Mark Ebden July 2008
%
% Inputs:
% k - a handle to the covariance function
% Xy - the training data x- and y-coordinates
% theta - the GP parameters to be passed to the covariance function
% (e.g. length scale periodicity etc.
% sigma_n - the noise (optional -- default 0)
% NOTE: sigma_n should be left as zero if k *already* includes the noise term as I usually do.
% xstar - specify the x-coordinates to solve for (optional -- default is
% to let the algorithm choose them)
% graphing - produce a plot of results (optional)
% Default is to plot the results unless the function outputs were asked for
%
% Outputs:
% xstar - x-coordinates (default 100 are chosen)
% K - covariance matrix among training data
% V - variance at each xstar
function [xstar bestEstimate bounds K V] = calcGP (k X y theta sigma_n xstar graphing)
if nargin < 7
if nargout == 0
graphing = 1;
else
graphing = 0;
end
end
if nargin < 6 || ~any(xstar)
r2 =(max(X)-min(X));
N = 1e3; % How many points to use
z = .5; % How much to extend the time series on either side (e.g. .5 is 50% extension on left and on right)
xstar = (0:N)/N * (z*2+1)*r2 + min(X)-r2*z;
end
if nargin < 5
sigma_n = 0;
end
if nargin < 4
theta = [1 0 1 0];
end
% a) Initializations
meany = mean(y); y = y - meany;
n = size(X1); lx = length(xstar);
K = zeros(n); kstar = zeros(n1);
for i = 1:n
for j = 1:n
K(ij) = k (X(i)X(j)theta);
end
end
fstarbar = zeros(lx1); V = zeros(lx1);
% b) One-off calculations
diags = max(1e3*eps sigma_n^2); % beef up the diagonal if sigma_n = 0
L = chol (K + diags*eye(n)‘lower‘);
alpha = L‘\(L\y);
logpyX = -y‘*alpha/2 - sum(log(diag(L))) - n*log(2*pi)/2; % Log marginal likelihood
% c) xstar loop
for q = 1:lx
for i = 1:n
kstar(i) = k (X(i)xstar(q)theta);
end
kstar
% Mean of prediction
fstarbar(q) = kstar‘ * alpha;
% Variance of prediction
v = L\kstar;
ystar_noise = sigma_n^2; % recall f* has no noise itself (Algorithm 2.1 on p 19 of H152)
V(q) = k (xstar(q)xstar(q)theta) - v‘*v + ystar_noise;
end
bounds = [fstarbar+1.96*sqrt(V) fstarbar-1.96*sqrt(V)]+meany;
bestEstimate = fstarbar+meany;
% d) Output
if graphing == 1
figure hold on
stdRegion (xstarbounds)
plot (xstarbestEstimate‘k‘)
plot (Xy+meany‘b+‘)
end
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2919 2012-10-27 12:15 gaussian\GPtutorial.m
文件 2043 2011-03-31 11:51 gaussian\GPtutorialFcn.m
文件 509 2011-02-03 12:23 gaussian\hypSample.m
文件 1436 2010-11-09 18:03 gaussian\k_GP.m
文件 599 2012-10-27 12:16 gaussian\stdRegion.m
文件 2551 2012-04-27 14:23 gaussian\calcGP.m
目录 0 2014-03-13 15:35 gaussian
----------- --------- ---------- ----- ----
10057 7
- 上一篇:六足机器人控制程序
- 下一篇:PS2+ arduino+接线图+源码
相关资源
- opencv_imgproc249d.dll
- 基于gprs的udp连接stm32程序代码
- wince + gprs拨号详细文档
- GPRS程序-源代码
- 单片机与GPRS模块通信需要做的工作
- 人体姿态检测及数据传输系统设计
- GPRS系统中的RLC层性能分析梁轶群
- GPRS模块EC20应用程序
- GPRS几种状态的分析
- 基于stm32f10x 的SIM800C通信源代码。整套
- SIM800C-模块电路原理图+PCB+封装测试成
- 基于单片机和GPRS的矿区铁路道口监测
- GPRS数据传输模块的设计与实现
- 单片机控制MC55模块实现远程无线数据
- 双向通信渔船测报仪系统电路模块
- GPRS模块GA6和STM32F103C8T6单片机上移植
- 可直接替换M26的GPRS模块Air208M
- stm32F1+gprs的IAP远程升级,app的adc数据
- GTP协议中文版
- AstarPathfindingProject_V4.2.15
- 西门子GPRS模块MC55数据手册
- win7 DriverforGPRS.zip
- 高斯过程回归源码含实验数据
- GPRS模块 AT指令配置连接服务器 单片机
- GPRS模块GA6和STM32F103C8T6单片机上移植
- GPRS模块实现的接打电话和收发短信
- GPS及WIFI、GPRS基站定位坐标源码
- 拨号——重拨——接听-挂断电话
- GPRS DTU源代码
- A9G中文手册
评论
共有 条评论