-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
97 changed files
with
4,246 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Oops, something went wrong.