Skip to content

Commit

Permalink
Added meanZeroDerObs, likGaussDerObs and infExactDerObs
Browse files Browse the repository at this point in the history
  • Loading branch information
kimsoohwan committed Jul 2, 2014
1 parent cc53185 commit 5d408bf
Show file tree
Hide file tree
Showing 29 changed files with 812 additions and 484 deletions.
4 changes: 2 additions & 2 deletions cov/covDiff/covDiff.m → cov/covDerObs/covDerObs.m
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
function K = covDiff(f_handles, hyp, x, xd, z, i)
function K = covDerObs(f_handles, hyp, x, xd, z, i)

%% function name convention
% cov: covariance function
% Diff: differentiable w.r.t input coordinates or take derivative observations
% DerObs: differentiable w.r.t input coordinates or take derivative observations
% Bwise: block maxtrix-wised version

%% input/output arguments
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
function K = covMaterniso3Diff(hyp, x, z, i, xd)
function K = covMaterniso3DerObs(hyp, x, z, i)

if nargin<1, K = '2'; return; end % report number of parameters
if nargin<3, z = []; end % make sure, z exists
if nargin<4, i = 0; end % derivative index
if nargin<5, xd = []; end % derivative inputs
dg = strcmp(z,'diag') && numel(z)>0; % determine mode

% x, xd
if dg
xd = [];
else
der_mask = x(:, 1) ~= 0;
xd = x( der_mask, 2:end);
x = x(~der_mask, 2:end);
end

% call FDI template
f_handles.FF = {@covMaterniso, 3};
f_handles.FD = {@covMaterniso3FD};
f_handles.DD = {@covMaterniso3DD};
K = covDiff(f_handles, hyp, x, xd, z, i);
K = covDerObs(f_handles, hyp, x, xd, z, i);
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
function K = covSEisoDiff(hyp, x, z, i, xd)
function K = covSEisoDerObs(hyp, x, z, i)

if nargin<1, K = '2'; return; end % report number of parameters
if nargin<3, z = []; end % make sure, z exists
if nargin<4, i = 0; end % derivative index
if nargin<5, xd = []; end % derivative inputs
dg = strcmp(z,'diag') && numel(z)>0; % determine mode

% x, xd
if dg
xd = [];
else
der_mask = x(:, 1) ~= 0;
xd = x( der_mask, 2:end);
x = x(~der_mask, 2:end);
end

% call FDI template
f_handles.FF = {@covSEiso};
f_handles.FD = {@covSEisoFD};
f_handles.DD = {@covSEisoDD};
K = covDiff(f_handles, hyp, x, xd, z, i);
K = covDerObs(f_handles, hyp, x, xd, z, i);
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
function K = covSparseisoDiff(hyp, x, z, i, xd)
function K = covSparseisoDerObs(hyp, x, z, i)

if nargin<1, K = '2'; return; end % report number of parameters
if nargin<3, z = []; end % make sure, z exists
if nargin<4, i = 0; end % derivative index
if nargin<5, xd = []; end % derivative inputs
dg = strcmp(z,'diag') && numel(z)>0; % determine mode

% x, xd
if dg
xd = [];
else
der_mask = x(:, 1) ~= 0;
xd = x( der_mask, 2:end);
x = x(~der_mask, 2:end);
end

% call FDI template
f_handles.FF = {@covSparseiso};
f_handles.FD = {@covSparseisoFD};
f_handles.DD = {@covSparseisoDD};
K = covDiff(f_handles, hyp, x, xd, z, i);
K = covDerObs(f_handles, hyp, x, xd, z, i);
106 changes: 0 additions & 106 deletions cov/covDiff/covDiff.backup

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,27 +1,35 @@
function K = covMaterniso3DiffUnstable(hyp, x, z, i, xd, f_Bwise)
function K = covMaterniso3DerObsUnstable(hyp, x, z, i, f_Bwise)

%% function name convention
% cov: covariance function
% Matern: Matern
% iso: isotropic
% Diff: differentiable w.r.t input coordinates or take derivative observations
% DerObs: differentiable w.r.t input coordinates or take derivative observations
% Unstable: cannot handle divide-by-zero

%% input/output arguments
% hyp: [1x2] hyperparameters, hyp = [log(ell), log(sigma_f)]
% x: [nxd] first function input vectors
% z: [nsxd] second function input vectors, default: [] meaning z = x
% i: partial deriavtive coordiante w.r.t hyperparameters, default: 0
% xd: [ndxd] first derivative input vectors
% f_Bwise: true: block matrix-wised version, false: coeffient-wised version
% K: [nnxns] covariance, nn = n + nd*d
% hyp: [1x2] hyperparameters, hyp = [log(ell), log(sigma_f)]
% x: [nx(d+1)] first function/derivative input vectors
% z: [nsxd] second function input vectors, default: [] meaning z = x
% i: partial deriavtive coordiante w.r.t hyperparameters, default: 0
% f_Bwise: true: block matrix-wised version, false: coeffient-wised version
% K: [nnxns] covariance, nn = n + nd*d

%% default parameters
if nargin < 2, K = '2'; return; end % report number of parameters
if nargin < 3, z = []; end % make sure, z exists
if nargin < 4, i = 0; end
if nargin < 5, xd = []; end
if nargin < 6, f_Bwise = true; end
if nargin < 5, f_Bwise = true; end
dg = strcmp(z,'diag') && numel(z)>0; % determine mode

% x, xd
if dg
xd = [];
else
der_mask = x(:, 1) ~= 0;
xd = x( der_mask, 2:end);
x = x(~der_mask, 2:end);
end

%% component functions

Expand Down Expand Up @@ -56,9 +64,9 @@

% call
if f_Bwise
K = covisoDiffBwiseUnstable(f_handles, hyp, x, xd, z, i);
K = covisoDerObsBwiseUnstable(f_handles, hyp, x, xd, z, i);
else
K = covisoDiffCwiseUnstable(f_handles, hyp, x, xd, z, i);
K = covisoDerObsCwiseUnstable(f_handles, hyp, x, xd, z, i);
end

%% sub component function
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,35 @@
function K = covSEisoDiffUnstable(hyp, x, z, i, xd, f_Bwise)
function K = covSEisoDerObsUnstable(hyp, x, z, i, f_Bwise)

%% function name convention
% cov: covariance function
% SE: squared exponential
% iso: isotropic
% Diff: differentiable w.r.t input coordinates or take derivative observations
% DerObs: differentiable w.r.t input coordinates or take derivative observations
% Unstable: cannot handle divide-by-zero

%% input/output arguments
% hyp: [1x2] hyperparameters, hyp = [log(ell), log(sigma_f)]
% x: [nxd] first function input vectors
% z: [nsxd] second function input vectors, default: [] meaning z = x
% i: partial deriavtive coordiante w.r.t hyperparameters, default: 0
% xd: [ndxd] first derivative input vectors
% f_Bwise: true: block matrix-wised version, false: coeffient-wised version
% K: [nnxns] covariance, nn = n + nd*d
% hyp: [1x2] hyperparameters, hyp = [log(ell), log(sigma_f)]
% x: [nx(d+1)] first function/derivative input vectors
% z: [nsxd] second function input vectors, default: [] meaning z = x
% i: partial deriavtive coordiante w.r.t hyperparameters, default: 0
% f_Bwise: true: block matrix-wised version, false: coeffient-wised version
% K: [nnxns] covariance, nn = n + nd*d

%% default parameters
if nargin < 2, K = '2'; return; end % report number of parameters
if nargin < 3, z = []; end % make sure, z exists
if nargin < 4, i = 0; end
if nargin < 5, xd = []; end
if nargin < 6, f_Bwise = true; end
if nargin < 5, f_Bwise = true; end
dg = strcmp(z,'diag') && numel(z)>0; % determine mode

% x, xd
if dg
xd = [];
else
der_mask = x(:, 1) ~= 0;
xd = x( der_mask, 2:end);
x = x(~der_mask, 2:end);
end

%% component functions

Expand Down Expand Up @@ -51,9 +59,9 @@

% call
if f_Bwise
K = covisoDiffBwiseUnstable(f_handles, hyp, x, xd, z, i);
K = covisoDerObsBwiseUnstable(f_handles, hyp, x, xd, z, i);
else
K = covisoDiffCwiseUnstable(f_handles, hyp, x, xd, z, i);
K = covisoDerObsCwiseUnstable(f_handles, hyp, x, xd, z, i);
end

%% sub component function
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,35 @@
function K = covSparseisoDiffUnstable(hyp, x, z, i, xd, f_Bwise)
function K = covSparseisoDerObsUnstable(hyp, x, z, i, f_Bwise)

%% function name convention
% cov: covariance function
% Sparse: sparse
% iso: isotropic
% Diff: differentiable w.r.t input coordinates or take derivative observations
% DerObs: differentiable w.r.t input coordinates or take derivative observations
% Unstable: cannot handle divide-by-zero

%% input/output arguments
% hyp: [1x2] hyperparameters, hyp = [log(ell), log(sigma_f)]
% x: [nxd] first function input vectors
% z: [nsxd] second function input vectors, default: [] meaning z = x
% i: partial deriavtive coordiante w.r.t hyperparameters, default: 0
% xd: [ndxd] first derivative input vectors
% f_Bwise: true: block matrix-wised version, false: coeffient-wised version
% K: [nnxns] covariance, nn = n + nd*d
% hyp: [1x2] hyperparameters, hyp = [log(ell), log(sigma_f)]
% x: [nx(d+1)] first function/derivative input vectors
% z: [nsxd] second function input vectors, default: [] meaning z = x
% i: partial deriavtive coordiante w.r.t hyperparameters, default: 0
% f_Bwise: true: block matrix-wised version, false: coeffient-wised version
% K: [nnxns] covariance, nn = n + nd*d

%% default parameters
if nargin < 2, K = '2'; return; end % report number of parameters
if nargin < 3, z = []; end % make sure, z exists
if nargin < 4, i = 0; end
if nargin < 5, xd = []; end
if nargin < 6, f_Bwise = true; end
if nargin < 5, f_Bwise = true; end
dg = strcmp(z,'diag') && numel(z)>0; % determine mode

% x, xd
if dg
xd = [];
else
der_mask = x(:, 1) ~= 0;
xd = x( der_mask, 2:end);
x = x(~der_mask, 2:end);
end

%% component functions

Expand Down Expand Up @@ -56,9 +64,9 @@

% call
if f_Bwise
K = covisoDiffBwiseUnstable(f_handles, hyp, x, xd, z, i);
K = covisoDerObsBwiseUnstable(f_handles, hyp, x, xd, z, i);
else
K = covisoDiffCwiseUnstable(f_handles, hyp, x, xd, z, i);
K = covisoDerObsCwiseUnstable(f_handles, hyp, x, xd, z, i);
end

%% sub component function
Expand Down
Loading

0 comments on commit 5d408bf

Please sign in to comment.