Skip to content

Commit

Permalink
Merge repo ivm as a sub-directory
Browse files Browse the repository at this point in the history
  • Loading branch information
lawrennd committed May 28, 2015
2 parents a37f2b5 + ab6c5cd commit 70629a2
Show file tree
Hide file tree
Showing 97 changed files with 4,246 additions and 0 deletions.
70 changes: 70 additions & 0 deletions gpmivm/demClassificationOneIvm1.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
% 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







66 changes: 66 additions & 0 deletions gpmivm/demClassificationTwoIvm1.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
% DEMCLASSIFICATIONTWOIVM1 IVM for classification on a data-set sampled from a GP

% IVM

% Fix seeds
randn('seed', 1e5);
rand('seed', 1e5);

dataSetName = 'classificationTwo';
experimentNo = 1;

% load data
[X, y] = mapLoadData(dataSetName);


% Set up model
options = ivmOptions;
options.display = 2;
options.numActive = 200;
options.kern = {'rbf', 'white'};

model = ivmCreate(size(X, 1), size(y, 2), X, y, options);

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







60 changes: 60 additions & 0 deletions gpmivm/demEP1.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
% DEMEP1 Demonstrate Expectation propagation on a toy data set..

% IVM

% Fix seeds
randn('seed', 1e5);
rand('seed', 1e5);

dataSetName = 'classificationOne';
experimentNo = 2;

% load data
[X, y] = mapLoadData(dataSetName);




options = ivmOptions;
options.kern = {'mlp', 'white'};
options.display = 2;
options.numActive = 100;

model = ivmCreate(size(X, 1), size(y, 2), X, y, options);

if options.display > 1
ivm3dPlot(model, 'ivmContour', i);
end
for i= 1:4
model = ivmSelectPoints(model, options.display);
% Plot the data.
if options.display > 1
ivm3dPlot(model, 'ivmContour', i);
end
model = ivmOptimiseKernel(model, options.display, options.kernIters);
end
if options.display > 1
ivm3dPlot(model, 'ivmContour', i);
end
% display active points.
model = ivmSelectPoints(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


80 changes: 80 additions & 0 deletions gpmivm/demOrderedOneIvm1.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
% DEMORDEREDONEIVM1 Run a demonstration of the ordered categories noise model (linear data).

% IVM
% Fix seeds
randn('seed', 1e5);
rand('seed', 1e5);

dataSetName = 'orderedOne';
experimentNo = 1;

% load data
[X, y] = mapLoadData(dataSetName);



% Set up model
options = ivmOptions;
options.noise = 'ordered';
% Learn the noise model for the ordered categorical case.
options.noiseIters = 100;
options.display = 2;
% Use a kernel consisting of an RBF ard kernel, a linear ard kernel and a
% bias term.
options.kern = {'rbfard', 'linard', 'bias', 'white'};


model = ivmCreate(size(X, 1), size(y, 2), X, y, options);

% Constrain the ARD parameters in the RBF and linear kernels to be the same.
model.kern = cmpndTieParameters(model.kern, {[3, 6], [4, 7]});
% Do some plotting
if options.display > 1
ivm3dPlot(model, 'ivmContour', i);
end
for i = 1:options.extIters
% Select active set.
model = ivmOptimiseIvm(model, options.display);
if options.display > 1
ivm3dPlot(model, 'ivmContour', i);
end
% Optimise the noise model.
model = ivmOptimiseNoise(model, options.display, options.noiseIters);

% Select active set.
model = ivmOptimiseIvm(model, options.display);
if options.display > 1
ivm3dPlot(model, 'ivmContour', i);
end
% Optimise kernel parameters
model = ivmOptimiseKernel(model, options.display, options.kernIters);
end
% Select active set.
model = ivmOptimiseIvm(model, options.display);
if options.display > 1
ivm3dPlot(model, 'ivmContour', i);
end
% Display active points
model = ivmOptimiseIvm(model, options.display);
% Display parameters of end 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







72 changes: 72 additions & 0 deletions gpmivm/demOrderedTwoIvm1.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
% DEMORDEREDTWOIVM1 Run a demonstration of the ordered categories noise model (circular data).

% IVM

randn('seed', 1e5);
rand('seed', 1e5);

dataSetName = 'orderedTwo';
experimentNo = 1;

% load data
[X, y] = mapLoadData(dataSetName);


% Set up model
options = ivmOptions;
options.noise = 'ordered';
% Learn the noise model for the ordered categorical case.
options.noiseIters = 100;
options.display = 2;
% Use a kernel consisting of an RBF ard kernel, a linear ard kernel and a
% bias term.
options.kern = {'rbfard', 'linard', 'bias', 'white'};

model = ivmCreate(size(X, 1), size(y, 2), X, y, options);

% Constrain the ARD parameters in the RBF and linear kernels to be the same.
model.kern = cmpndTieParameters(model.kern, {[3, 6], [4, 7]});
% Do some plotting
if options.display > 1
ivm3dPlot(model, 'ivmContour', i);
end
for i = 1:options.extIters
% Select active set.
model = ivmOptimiseIvm(model, options.display);
if options.display > 1
ivm3dPlot(model, 'ivmContour', i);
end
% Optimise the noise model.
model = ivmOptimiseNoise(model, options.display, options.noiseIters);

% Select active set.
model = ivmOptimiseIvm(model, options.display);
if options.display > 1
ivm3dPlot(model, 'ivmContour', i);
end
% Optimise kernel parameters
model = ivmOptimiseKernel(model, options.display, options.kernIters);
end
% Select active set.
model = ivmOptimiseIvm(model, options.display);
if options.display > 1
ivm3dPlot(model, 'ivmContour', i);
end
% Display active points
model = ivmOptimiseIvm(model, options.display);
% Display parameters of end 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
File renamed without changes.
Loading

0 comments on commit 70629a2

Please sign in to comment.