-
Notifications
You must be signed in to change notification settings - Fork 3
/
build_continuous_objective_fcn.m
58 lines (43 loc) · 2.6 KB
/
build_continuous_objective_fcn.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
function funObj = build_continuous_objective_fcn(OptState, GPModel, trainx, trainy)
if strcmp(GPModel.kern.type, 'histIntKern') && isfield(GPModel.kern,'KFunc_byInd')
kernMM = @(ww) GPModel.kern.KFunc_byInd(OptState.I, OptState.I, ww);
kernMN = @(ww) GPModel.kern.KFunc_byInd(OptState.I, 1:GPModel.n, ww);
funObj = @(hh) nvf_fixedSIS_pyHistMatchKern(hh, ...
kernMM, ...
kernMN, ...
trainy, ...
GPModel.m,...
GPModel.do_var_cost);
elseif strcmp(GPModel.kern.type, 'histIntKern')
iXcell = GPModel.kern.cellDataPrepFunc(trainx(OptState.I,:));
Xcell = GPModel.kern.cellDataPrepFunc(trainx);
funObj = @(hh) sparse_nmll_fixedSIS_pyHistMatchKern_lowMem(hh, ...
GPModel.kern.KFunc, ...
GPModel.kern.dKFunc_dkernhyp, ...
iXcell,...
Xcell,...
trainy, ...
GPModel.m,...
GPModel.n);
elseif strcmp(GPModel.kern.type, 'preComputedKern')
funObj = @(hh) nvf_fixedSIS_preComputedKern(hh, ...
trainx, ...
trainy, ...
OptState.I, ...
GPModel.do_var_cost);
elseif strcmp(GPModel.kern.type, 'SQExpKern')
all_pd_cache = prepare_all_pd_cache(trainx, OptState.I);
funObj = @(hh) nvf_fixedSIS(hh, ...
GPModel.kern.diagKFunc,...
GPModel.kern.KFunc, ...
GPModel.kern.dKFunc_dkernhyp, ...
trainx, ...
trainy, ...
OptState.I, ...
GPModel.n, ...
GPModel.do_var_cost, ...
all_pd_cache);
else
error('Unsupported kernel');
end
end