forked from lawrennd/ivm
/
demClassificationOneIvm1.m
70 lines (50 loc) · 1.53 KB
/
demClassificationOneIvm1.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
% DEMCLASSIFICATIONIVM1 Test IVM code on a toy feature selection.
% IVM
% Fix seeds
randn('seed', 1e5);
rand('seed', 1e5);
dataSetName = 'classificationOne';
experimentNo = 1;
% load data
[X, y] = mapLoadData(dataSetName);
% Set up model
options = ivmOptions;
options.display = 2;
options.numActive = 100;
% Use a combination of an MLP and linear ARD kernel.
options.kern = {'mlpard', 'linard', 'white'};
model = ivmCreate(size(X, 1), size(y, 2), X, y, options);
% Constrain the ARD parameters in the MLP and linear kernels to be the same.
model.kern = cmpndTieParameters(model.kern, {[4, 7], [5, 8]});
if options.display > 1
ivm3dPlot(model, 'ivmContour', i);
end
for i = 1:options.extIters;
% Select the active set.
model = ivmOptimiseIvm(model, options.display);
% Plot the data.
if options.display > 1
ivm3dPlot(model, 'ivmContour', i);
end
% Optimise the kernel parameters.
model = ivmOptimiseKernel(model, options.display, options.kernIters);
end
model = ivmOptimiseIvm(model, options.display);
if options.display > 1
ivm3dPlot(model, 'ivmContour', i);
end
% display active points.
model = ivmOptimiseIvm(model, options.display);
% Display the final model.
ivmDisplay(model);
% Save the results.
capName = dataSetName;;
capName(1) = upper(capName(1));
[kern, noise, ivmInfo] = ivmDeconstruct(model);
save(['dem' capName num2str(experimentNo) '.mat'], ...
'kern', ...
'noise', ...
'ivmInfo');
if exist('printDiagram') & printDiagram
ivmPrintPlot(model, 'ivmContour', [], [], [], capName, experimentNo);
end