forked from lawrennd/ivm
/
ivmCreate.m
81 lines (65 loc) · 1.97 KB
/
ivmCreate.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
function model = ivmCreate(inputDim, outputDim, X, y, options);
% IVMCREATE Create a IVM model with the IVM sparse approximaiton.
% The IVM stands for Informative Vector Machine. The IVM is a
% sparse Gaussian process approximation which uses information
% theoretic criteria for selection of an active set. Unlike most
% sparse Gaussian process methods (but like the SVM) the IVM is a
% compression scheme. In other words the IVM can be recreated using
% only those data points considered to be 'informative vectors'. We
% refer to these points as the active set.
%
% FORMAT
% DESC creates a Gaussian process model structure using the IVM
% approximation. The default parameter settings as specified by the
% options vector. This function replaces the deprecated ivm function.
% ARG q : input data dimension.
% ARG d : the number of processes (i.e. output data dimension).
% ARG X : the input data matrix.
% ARG y : the target (output) data.
% ARG options : options structure as defined by ivmOptions.m.
% RETURN model : model structure containing the IVM.
%
% SEEALSO : ivmOptions, modelCreate
%
% COPYRIGHT : Neil D. Lawrence, 2005, 2006, 2007
% IVM
model.type = 'ivm';
model.terminate = 0;
model.epUpdate = 0;
model.d = options.numActive;
model.X = X;
model.y = y;
model.m = [];
model.beta = [];
model.nu = zeros(size(y));
model.g = zeros(size(y));
if isstruct(options.kern)
model.kern = options.kern;
else
model.kern = kernCreate(model.X, options.kern);
end
model.varSigma = zeros(size(y));
model.mu = zeros(size(y));
model.I = [];
model.J = [];
if isstruct(options.noise)
model.noise = options.noise;
else
model.noise = noiseCreate(options.noise, model.y);
end
if model.noise.spherical
model.Sigma.M = [];
model.Sigma.L = [];
else
for i = 1:size(y, 2)
model.Sigma(i).M = [];
model.Sigma(i).L = [];
end
end
model.selectionCriterion = options.selectionCriterion;
switch options.selectionCriterion
case 'none'
numData = size(X, 1);
model.I = (1:numData);
otherwise
end