Main Content

postFitStatistics

厳密ガウス過程回帰モデルの当てはめ統計量の計算

構文

loores = postFitStatistics(gprMdl)
[loores,neff] = postFitStatistics(gprMdl)

説明

loores = postFitStatistics(gprMdl) は、学習済みガウス過程回帰 (GPR) モデルの leave-one-out 残差 loores を返します。

[loores,neff] = postFitStatistics(gprMdl) は、有効なパラメーターの数 neff も返します。

入力引数

すべて展開する

ガウス過程回帰モデル。RegressionGP オブジェクトとして指定します。

出力引数

すべて展開する

Leave-one-out 残差。n 行 1 列の行列として返されます。n は、学習データに含まれている観測値の数です。

有効なパラメーターの数。n 行 1 列の行列として返されます。n は、学習データに含まれている観測値の数です。

すべて展開する

標本データを生成します。

rng(0,'twister'); % For reproducibility
n = 1500;
x = linspace(-10,10,n)';
y = sin(3*x).*cos(3*x) + sin(2*x).*cos(2*x) + sin(x) + cos(x) + 0.2*randn(n,1);

近似と予測に厳密法を使用して、GPR モデルを当てはめます。

gprMdl = fitrgp(x,y,'Basis','linear','FitMethod','exact',...
'PredictMethod','exact','KernelFunction','matern52');

学習済みモデルの leave-one-out 残差と有効なパラメーターの数を計算します。

[loores,neff] = postFitStatistics(gprMdl);

学習済みのモデルを使用して、応答を予測します。

ypred = resubPredict(gprMdl);

真の応答と予測応答をプロットし、近似に含まれている有効なパラメーターの数を表示します。

figure()
plot(x,y,'r.');
hold on;
plot(x,ypred,'b'); 
xlabel('x');
ylabel('y');
legend('Data','GPR prediction','Location','Best');
title(['Effective number of parameters = ',num2str(neff)]);
hold off

Figure contains an axes object. The axes object with title Effective number of parameters = 94.7514, xlabel x, ylabel y contains 2 objects of type line. One or more of the lines displays its values using only markers These objects represent Data, GPR prediction.

leave-one-out 残差をプロットします。

figure()
plot(x,loores,'r.-');
xlabel('x');
ylabel('leave-one-out residuals');

Figure contains an axes object. The axes object with xlabel x, ylabel leave-one-out residuals contains an object of type line.

ヒント

  • 当てはめ統計量を計算できるのは、PredictMethod'exact' の場合だけです。

  • FitMethod'exact' の場合、postFitStatistics では基底関数の固定係数がデータから推定されるということを考慮します。

  • FitMethod'exact' 以外の場合、postFitStatistics では基底関数の固定係数を既知として扱います。

  • PredictMethodFitMethod のすべてのオプションについて、postFitStatistics では推定したカーネル パラメーターとノイズ標準偏差を既知として扱います。

バージョン履歴

R2015b で導入