From ab43248ea118ef0b8131efee5bec019f30ed825a Mon Sep 17 00:00:00 2001 From: Neil Lawrence Date: Thu, 28 May 2015 21:51:56 +0100 Subject: [PATCH] Move files into noise. --- gpmnoise/cmpndNoise3dPlot.m | 21 ---- gpmnoise/cmpndNoiseDisplay.m | 24 ---- gpmnoise/cmpndNoiseExpandParam.m | 31 ----- gpmnoise/cmpndNoiseExtractParam.m | 54 --------- gpmnoise/cmpndNoiseGradVals.m | 35 ------ gpmnoise/cmpndNoiseGradientParam.m | 37 ------ gpmnoise/cmpndNoiseLikelihood.m | 25 ---- gpmnoise/cmpndNoiseLogLikelihood.m | 25 ---- gpmnoise/cmpndNoiseNuG.m | 25 ---- gpmnoise/cmpndNoiseOut.m | 27 ----- gpmnoise/cmpndNoiseParamInit.m | 39 ------- gpmnoise/cmpndNoisePointPlot.m | 20 ---- gpmnoise/cmpndNoiseSites.m | 28 ----- gpmnoise/gaussianNoise3dPlot.m | 25 ---- gpmnoise/gaussianNoiseDisplay.m | 32 ----- gpmnoise/gaussianNoiseExpandParam.m | 24 ---- gpmnoise/gaussianNoiseExtractParam.m | 41 ------- gpmnoise/gaussianNoiseGradVals.m | 31 ----- gpmnoise/gaussianNoiseGradientParam.m | 37 ------ gpmnoise/gaussianNoiseLikelihood.m | 25 ---- gpmnoise/gaussianNoiseLogLikelihood.m | 30 ----- gpmnoise/gaussianNoiseNuG.m | 28 ----- gpmnoise/gaussianNoiseOut.m | 23 ---- gpmnoise/gaussianNoiseParamInit.m | 41 ------- gpmnoise/gaussianNoisePointPlot.m | 35 ------ gpmnoise/gaussianNoiseSites.m | 29 ----- gpmnoise/mgaussianNoise3dPlot.m | 21 ---- gpmnoise/mgaussianNoiseDisplay.m | 35 ------ gpmnoise/mgaussianNoiseExpandParam.m | 25 ---- gpmnoise/mgaussianNoiseExtractParam.m | 44 ------- gpmnoise/mgaussianNoiseGradVals.m | 45 ------- gpmnoise/mgaussianNoiseGradientParam.m | 42 ------- gpmnoise/mgaussianNoiseLikelihood.m | 30 ----- gpmnoise/mgaussianNoiseLogLikelihood.m | 35 ------ gpmnoise/mgaussianNoiseOut.m | 25 ---- gpmnoise/mgaussianNoiseParamInit.m | 40 ------- gpmnoise/mgaussianNoisePointPlot.m | 20 ---- gpmnoise/ncnmNoise3dPlot.m | 23 ---- gpmnoise/ncnmNoiseDisplay.m | 36 ------ gpmnoise/ncnmNoiseExpandParam.m | 30 ----- gpmnoise/ncnmNoiseExtractParam.m | 33 ------ gpmnoise/ncnmNoiseGradVals.m | 78 ------------- gpmnoise/ncnmNoiseGradientParam.m | 71 ------------ gpmnoise/ncnmNoiseLikelihood.m | 50 -------- gpmnoise/ncnmNoiseLogLikelihood.m | 53 --------- gpmnoise/ncnmNoiseNuG.m | 33 ------ gpmnoise/ncnmNoiseOut.m | 23 ---- gpmnoise/ncnmNoiseParamInit.m | 62 ---------- gpmnoise/ncnmNoisePointPlot.m | 26 ----- gpmnoise/ncnmNoiseSites.m | 9 -- gpmnoise/negNoiseGradientParam.m | 13 --- gpmnoise/negNoiseLogLikelihood.m | 13 --- gpmnoise/ngaussNoise3dPlot.m | 21 ---- gpmnoise/ngaussNoiseDisplay.m | 31 ----- gpmnoise/ngaussNoiseExpandParam.m | 24 ---- gpmnoise/ngaussNoiseExtractParam.m | 41 ------- gpmnoise/ngaussNoiseGradVals.m | 25 ---- gpmnoise/ngaussNoiseGradientParam.m | 37 ------ gpmnoise/ngaussNoiseLikelihood.m | 19 --- gpmnoise/ngaussNoiseLogLikelihood.m | 19 --- gpmnoise/ngaussNoiseNuG.m | 10 -- gpmnoise/ngaussNoiseOut.m | 20 ---- gpmnoise/ngaussNoiseParamInit.m | 33 ------ gpmnoise/ngaussNoisePointPlot.m | 20 ---- gpmnoise/ngaussNoiseSites.m | 10 -- gpmnoise/noise3dPlot.m | 27 ----- gpmnoise/noiseCreate.m | 55 --------- gpmnoise/noiseDisplay.m | 17 --- gpmnoise/noiseExpandParam.m | 30 ----- gpmnoise/noiseExpectationLogLikelihood.m | 21 ---- gpmnoise/noiseExtractParam.m | 47 -------- gpmnoise/noiseGradVals.m | 33 ------ gpmnoise/noiseGradX.m | 8 -- gpmnoise/noiseGradientParam.m | 44 ------- gpmnoise/noiseLikelihood.m | 18 --- gpmnoise/noiseLogLikelihood.m | 29 ----- gpmnoise/noiseOut.m | 19 --- gpmnoise/noiseParamInit.m | 28 ----- gpmnoise/noisePointPlot.m | 29 ----- gpmnoise/noiseReadFromFID.m | 18 --- gpmnoise/noiseReadParamsFromFID.m | 27 ----- gpmnoise/noiseTest.m | 142 ----------------------- gpmnoise/noiseUpdateNuG.m | 31 ----- gpmnoise/noiseUpdateSites.m | 31 ----- gpmnoise/noiseWriteParamsToFID.m | 22 ---- gpmnoise/noiseWriteToFID.m | 19 --- gpmnoise/orderedGradX.m | 12 -- gpmnoise/orderedNoise3dPlot.m | 32 ----- gpmnoise/orderedNoiseDisplay.m | 37 ------ gpmnoise/orderedNoiseExpandParam.m | 25 ---- gpmnoise/orderedNoiseExtractParam.m | 42 ------- gpmnoise/orderedNoiseGradVals.m | 76 ------------ gpmnoise/orderedNoiseGradientParam.m | 87 -------------- gpmnoise/orderedNoiseLikelihood.m | 55 --------- gpmnoise/orderedNoiseLogLikelihood.m | 51 -------- gpmnoise/orderedNoiseOut.m | 33 ------ gpmnoise/orderedNoiseParamInit.m | 45 ------- gpmnoise/orderedNoisePointPlot.m | 42 ------- gpmnoise/orderedNoiseUpdateParams.m | 14 --- gpmnoise/probit3dPlot.m | 10 -- gpmnoise/probitNoise3dPlot.m | 31 ----- gpmnoise/probitNoiseDisplay.m | 35 ------ gpmnoise/probitNoiseExpandParam.m | 25 ---- gpmnoise/probitNoiseExtractParam.m | 40 ------- gpmnoise/probitNoiseGradVals.m | 32 ----- gpmnoise/probitNoiseGradientParam.m | 30 ----- gpmnoise/probitNoiseLikelihood.m | 23 ---- gpmnoise/probitNoiseLogLikelihood.m | 24 ---- gpmnoise/probitNoiseOut.m | 24 ---- gpmnoise/probitNoiseParamInit.m | 42 ------- gpmnoise/probitNoisePointPlot.m | 36 ------ gpmnoise/scaleNoiseDisplay.m | 18 --- gpmnoise/scaleNoiseExpandParam.m | 8 -- gpmnoise/scaleNoiseOut.m | 12 -- gpmnoise/scaleNoiseParamInit.m | 26 ----- gpmnoise/scaleNoiseSites.m | 13 --- 116 files changed, 3692 deletions(-) delete mode 100644 gpmnoise/cmpndNoise3dPlot.m delete mode 100644 gpmnoise/cmpndNoiseDisplay.m delete mode 100644 gpmnoise/cmpndNoiseExpandParam.m delete mode 100644 gpmnoise/cmpndNoiseExtractParam.m delete mode 100644 gpmnoise/cmpndNoiseGradVals.m delete mode 100644 gpmnoise/cmpndNoiseGradientParam.m delete mode 100644 gpmnoise/cmpndNoiseLikelihood.m delete mode 100644 gpmnoise/cmpndNoiseLogLikelihood.m delete mode 100644 gpmnoise/cmpndNoiseNuG.m delete mode 100644 gpmnoise/cmpndNoiseOut.m delete mode 100644 gpmnoise/cmpndNoiseParamInit.m delete mode 100644 gpmnoise/cmpndNoisePointPlot.m delete mode 100644 gpmnoise/cmpndNoiseSites.m delete mode 100644 gpmnoise/gaussianNoise3dPlot.m delete mode 100644 gpmnoise/gaussianNoiseDisplay.m delete mode 100644 gpmnoise/gaussianNoiseExpandParam.m delete mode 100644 gpmnoise/gaussianNoiseExtractParam.m delete mode 100644 gpmnoise/gaussianNoiseGradVals.m delete mode 100644 gpmnoise/gaussianNoiseGradientParam.m delete mode 100644 gpmnoise/gaussianNoiseLikelihood.m delete mode 100644 gpmnoise/gaussianNoiseLogLikelihood.m delete mode 100644 gpmnoise/gaussianNoiseNuG.m delete mode 100644 gpmnoise/gaussianNoiseOut.m delete mode 100644 gpmnoise/gaussianNoiseParamInit.m delete mode 100644 gpmnoise/gaussianNoisePointPlot.m delete mode 100644 gpmnoise/gaussianNoiseSites.m delete mode 100644 gpmnoise/mgaussianNoise3dPlot.m delete mode 100644 gpmnoise/mgaussianNoiseDisplay.m delete mode 100644 gpmnoise/mgaussianNoiseExpandParam.m delete mode 100644 gpmnoise/mgaussianNoiseExtractParam.m delete mode 100644 gpmnoise/mgaussianNoiseGradVals.m delete mode 100644 gpmnoise/mgaussianNoiseGradientParam.m delete mode 100644 gpmnoise/mgaussianNoiseLikelihood.m delete mode 100644 gpmnoise/mgaussianNoiseLogLikelihood.m delete mode 100644 gpmnoise/mgaussianNoiseOut.m delete mode 100644 gpmnoise/mgaussianNoiseParamInit.m delete mode 100644 gpmnoise/mgaussianNoisePointPlot.m delete mode 100644 gpmnoise/ncnmNoise3dPlot.m delete mode 100644 gpmnoise/ncnmNoiseDisplay.m delete mode 100644 gpmnoise/ncnmNoiseExpandParam.m delete mode 100644 gpmnoise/ncnmNoiseExtractParam.m delete mode 100644 gpmnoise/ncnmNoiseGradVals.m delete mode 100644 gpmnoise/ncnmNoiseGradientParam.m delete mode 100644 gpmnoise/ncnmNoiseLikelihood.m delete mode 100644 gpmnoise/ncnmNoiseLogLikelihood.m delete mode 100644 gpmnoise/ncnmNoiseNuG.m delete mode 100644 gpmnoise/ncnmNoiseOut.m delete mode 100644 gpmnoise/ncnmNoiseParamInit.m delete mode 100644 gpmnoise/ncnmNoisePointPlot.m delete mode 100644 gpmnoise/ncnmNoiseSites.m delete mode 100644 gpmnoise/negNoiseGradientParam.m delete mode 100644 gpmnoise/negNoiseLogLikelihood.m delete mode 100644 gpmnoise/ngaussNoise3dPlot.m delete mode 100644 gpmnoise/ngaussNoiseDisplay.m delete mode 100644 gpmnoise/ngaussNoiseExpandParam.m delete mode 100644 gpmnoise/ngaussNoiseExtractParam.m delete mode 100644 gpmnoise/ngaussNoiseGradVals.m delete mode 100644 gpmnoise/ngaussNoiseGradientParam.m delete mode 100644 gpmnoise/ngaussNoiseLikelihood.m delete mode 100644 gpmnoise/ngaussNoiseLogLikelihood.m delete mode 100644 gpmnoise/ngaussNoiseNuG.m delete mode 100644 gpmnoise/ngaussNoiseOut.m delete mode 100644 gpmnoise/ngaussNoiseParamInit.m delete mode 100644 gpmnoise/ngaussNoisePointPlot.m delete mode 100644 gpmnoise/ngaussNoiseSites.m delete mode 100644 gpmnoise/noise3dPlot.m delete mode 100644 gpmnoise/noiseCreate.m delete mode 100644 gpmnoise/noiseDisplay.m delete mode 100644 gpmnoise/noiseExpandParam.m delete mode 100644 gpmnoise/noiseExpectationLogLikelihood.m delete mode 100644 gpmnoise/noiseExtractParam.m delete mode 100644 gpmnoise/noiseGradVals.m delete mode 100644 gpmnoise/noiseGradX.m delete mode 100644 gpmnoise/noiseGradientParam.m delete mode 100644 gpmnoise/noiseLikelihood.m delete mode 100644 gpmnoise/noiseLogLikelihood.m delete mode 100644 gpmnoise/noiseOut.m delete mode 100644 gpmnoise/noiseParamInit.m delete mode 100644 gpmnoise/noisePointPlot.m delete mode 100644 gpmnoise/noiseReadFromFID.m delete mode 100644 gpmnoise/noiseReadParamsFromFID.m delete mode 100644 gpmnoise/noiseTest.m delete mode 100644 gpmnoise/noiseUpdateNuG.m delete mode 100644 gpmnoise/noiseUpdateSites.m delete mode 100644 gpmnoise/noiseWriteParamsToFID.m delete mode 100644 gpmnoise/noiseWriteToFID.m delete mode 100644 gpmnoise/orderedGradX.m delete mode 100644 gpmnoise/orderedNoise3dPlot.m delete mode 100644 gpmnoise/orderedNoiseDisplay.m delete mode 100644 gpmnoise/orderedNoiseExpandParam.m delete mode 100644 gpmnoise/orderedNoiseExtractParam.m delete mode 100644 gpmnoise/orderedNoiseGradVals.m delete mode 100644 gpmnoise/orderedNoiseGradientParam.m delete mode 100644 gpmnoise/orderedNoiseLikelihood.m delete mode 100644 gpmnoise/orderedNoiseLogLikelihood.m delete mode 100644 gpmnoise/orderedNoiseOut.m delete mode 100644 gpmnoise/orderedNoiseParamInit.m delete mode 100644 gpmnoise/orderedNoisePointPlot.m delete mode 100644 gpmnoise/orderedNoiseUpdateParams.m delete mode 100644 gpmnoise/probit3dPlot.m delete mode 100644 gpmnoise/probitNoise3dPlot.m delete mode 100644 gpmnoise/probitNoiseDisplay.m delete mode 100644 gpmnoise/probitNoiseExpandParam.m delete mode 100644 gpmnoise/probitNoiseExtractParam.m delete mode 100644 gpmnoise/probitNoiseGradVals.m delete mode 100644 gpmnoise/probitNoiseGradientParam.m delete mode 100644 gpmnoise/probitNoiseLikelihood.m delete mode 100644 gpmnoise/probitNoiseLogLikelihood.m delete mode 100644 gpmnoise/probitNoiseOut.m delete mode 100644 gpmnoise/probitNoiseParamInit.m delete mode 100644 gpmnoise/probitNoisePointPlot.m delete mode 100644 gpmnoise/scaleNoiseDisplay.m delete mode 100644 gpmnoise/scaleNoiseExpandParam.m delete mode 100644 gpmnoise/scaleNoiseOut.m delete mode 100644 gpmnoise/scaleNoiseParamInit.m delete mode 100644 gpmnoise/scaleNoiseSites.m diff --git a/gpmnoise/cmpndNoise3dPlot.m b/gpmnoise/cmpndNoise3dPlot.m deleted file mode 100644 index 4608ef08..00000000 --- a/gpmnoise/cmpndNoise3dPlot.m +++ /dev/null @@ -1,21 +0,0 @@ -function gX = cmpndNoise3dPlot(noise, X) - -% CMPNDNOISE3DPLOT Draws a 3D or contour plot for the CMPND noise model. -% FORMAT -% DESC draws a 3D or contour plot for the compound noise model. -% ARG noise : the noise structure for which the plot is required. -% ARG plotType : string containing the name of the plotting function (for example mesh, contour). -% ARG X : the input X data in the form of a 'mesh' matrix. -% ARG Y : the input Y data in the form of a 'mesh' matrix. -% ARG mu : the input mean in the form of a 'mesh' matrix. -% ARG varSigma : the input variance in the form of a 'mesh' matrix. -% ARG P1, P2, P3 ... : optional additional arguments for the given plot type. -% RETURN h : the gradients of the diagonal with respect to each element -% of X. The returned matrix has the same dimensions as X. -% -% SEEALSO : cmpndNoiseParamInit, noise3dPlot, -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - diff --git a/gpmnoise/cmpndNoiseDisplay.m b/gpmnoise/cmpndNoiseDisplay.m deleted file mode 100644 index 31bc1cdc..00000000 --- a/gpmnoise/cmpndNoiseDisplay.m +++ /dev/null @@ -1,24 +0,0 @@ -function cmpndNoiseDisplay(noise, varargin) - - -% CMPNDNOISEDISPLAY Display parameters of the CMPND noise. -% FORMAT -% DESC displays the parameters of the compound -% noise and the noise type to the console. -% ARG noise : the noise to display. -% -% FORMAT does the same as above, but indents the display according -% to the amount specified. -% ARG noise : the noise to display. -% ARG spacing : how many spaces to indent the display of the noise by. -% -% SEEALSO : cmpndNoiseParamInit, modelDisplay, noiseDisplay -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -for i = 1:length(noise.comp) - noiseDisplay(noise.comp{i}, varargin{:}); -end diff --git a/gpmnoise/cmpndNoiseExpandParam.m b/gpmnoise/cmpndNoiseExpandParam.m deleted file mode 100644 index 136ece60..00000000 --- a/gpmnoise/cmpndNoiseExpandParam.m +++ /dev/null @@ -1,31 +0,0 @@ -function noise = cmpndNoiseExpandParam(noise, params) - - -% CMPNDNOISEEXPANDPARAM Create noise structure from CMPND noise's parameters. -% FORMAT -% DESC returns a compound noise structure filled with the -% parameters in the given vector. This is used as a helper function to -% enable parameters to be optimised in, for example, the NETLAB -% optimisation functions. -% ARG noise : the noise structure in which the parameters are to be -% placed. -% ARG param : vector of parameters which are to be placed in the -% noise structure. -% RETURN noise : noise structure with the given parameters in the -% relevant locations. -% -% SEEALSO : cmpndNoiseParamInit, cmpndNoiseExtractParam, noiseExpandParam -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -params = params*noise.paramGroups'; -startVal = 1; -endVal = 0; -for i = 1:length(noise.comp) - endVal = endVal + noise.comp{i}.nParams; - noise.comp{i} = noiseExpandParam(noise.comp{i}, params(1, startVal:endVal)); - startVal = endVal + 1; -end diff --git a/gpmnoise/cmpndNoiseExtractParam.m b/gpmnoise/cmpndNoiseExtractParam.m deleted file mode 100644 index a2194b8c..00000000 --- a/gpmnoise/cmpndNoiseExtractParam.m +++ /dev/null @@ -1,54 +0,0 @@ -function [params, names] = cmpndNoiseExtractParam(noise) - - -% CMPNDNOISEEXTRACTPARAM Extract parameters from the CMPND noise structure. -% FORMAT -% DESC extracts parameters from the compound -% noise structure into a vector of parameters for optimisation. -% ARG noise : the noise structure containing the parameters to be -% extracted. -% RETURN param : vector of parameters extracted from the noise. If -% the field 'transforms' is not empty in the noise structure, the -% parameters will be transformed before optimisation (for example -% positive only parameters could be logged before being returned). -% -% FORMAT -% DESC extracts parameters and parameter names from the compound -% noise structure. -% ARG noise : the noise structure containing the parameters to be -% extracted. -% RETURN param : vector of parameters extracted from the noise. If -% the field 'transforms' is not empty in the noise structure, the -% parameters will be transformed before optimisation (for example -% positive only parameters could be logged before being returned). -% RETURN names : cell array of strings containing names for each -% parameter. -% -% SEEALSO cmpndNoiseParamInit, cmpndNoiseExpandParam, noiseExtractParam, scg, conjgrad -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 -% -% NOISE - - -params = zeros(1, noise.nParams); -if nargout > 1 - names = cell(1, noise.nParams); -end -startVal = 1; -endVal = 0; -for i = 1:length(noise.comp) - endVal = endVal + noise.comp{i}.nParams; - if nargout < 2 - params(1, startVal:endVal) = noiseExtractParam(noise.comp{i}); - else - [params(1, startVal:endVal), names(startVal:endVal)] = noiseExtractParam(noise.comp{i}); - end - startVal = endVal + 1; -end -paramGroups = noise.paramGroups; -for i = 1:size(paramGroups, 2) - ind = find(paramGroups(:, i)); - paramGroups(ind(2:end), i) = 0; -end -params = params*paramGroups; diff --git a/gpmnoise/cmpndNoiseGradVals.m b/gpmnoise/cmpndNoiseGradVals.m deleted file mode 100644 index 7ddc456f..00000000 --- a/gpmnoise/cmpndNoiseGradVals.m +++ /dev/null @@ -1,35 +0,0 @@ -function [dlnZ_dmu, dlnZ_dvs] = cmpndNoiseGradVals(noise, mu, varsigma, y) - - -% CMPNDNOISEGRADVALS Gradient of CMPND noise log Z with respect to input mean and variance. -% FORMAT -% DESC computes the gradient of the compound -% noise with respect to the input mean and the input variance. -% ARG noise : noise structure for which gradients are being -% computed. -% ARG mu : mean input locations with respect to which gradients are -% being computed. -% ARG varSigma : variance input locations with respect to which -% gradients are being computed. -% ARG y : noise model output observed values associated with the given points. -% RETURN dlnZ_dmu : the gradient of log Z with respect to the input mean. -% RETURN dlnZ_dvs : the gradient of log Z with respect to the input variance. -% -% SEEALSO cmpndNoiseParamInit, cmpndNoiseGradientParam, noiseGradVals, -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -startVal = 1; -endVal = 0; -dlnZ_dmu = zeros(size(mu)); -dlnZ_dvs = zeros(size(varsigma)); -for i = 1:length(noise.comp) - fhandle = str2func([noise.comp{i}.type 'NoiseGradVals']); - [dlnZ_dmu(:, i), dlnZ_dvs(:, i)] = fhandle(noise.comp{i}, ... - mu(:, i), ... - varsigma(:, i), ... - y(:, i)); -end diff --git a/gpmnoise/cmpndNoiseGradientParam.m b/gpmnoise/cmpndNoiseGradientParam.m deleted file mode 100644 index 0ec530c7..00000000 --- a/gpmnoise/cmpndNoiseGradientParam.m +++ /dev/null @@ -1,37 +0,0 @@ -function g = cmpndNoiseGradientParam(noise, mu, varsigma, y) - - -% CMPNDNOISEGRADIENTPARAM Gradient of CMPND noise's parameters. -% FORMAT -% DESC computes the gradient of the log Z of the compound noise model with respect to the of functions with respect to the -% compound -% noise's parameters. -% ARG noise : the noise structure for which the gradients are being -% computed. -% ARG mu : the input means for which the gradients are being computed. -% ARG varSigma : the input variances for which the gradients are being computed. -% ARG y : the target values for the noise model. -% RETURN g : gradients of the log Z with respect to -% the noise parameters. The ordering of the vector should match -% that provided by the function noiseExtractParam. -% -% -% SEEALSO cmpndNoiseParamInit, cmpndnoiseGradVals, noiseGradientParam -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -g = zeros(1, noise.nParams); -startVal = 1; -endVal = 0; -for i = 1:length(noise.comp) - endVal = endVal + noise.comp{i}.nParams; - g(1, startVal:endVal) = noiseGradientParam(noise.comp{i}, ... - mu(:, i), ... - varsigma(:, i), ... - y(:, i)); - startVal = endVal + 1; -end -g = g*noise.paramGroups; diff --git a/gpmnoise/cmpndNoiseLikelihood.m b/gpmnoise/cmpndNoiseLikelihood.m deleted file mode 100644 index 4cbe836c..00000000 --- a/gpmnoise/cmpndNoiseLikelihood.m +++ /dev/null @@ -1,25 +0,0 @@ -function L = cmpndNoiseLikelihood(noise, mu, varsigma, y) - - -% CMPNDNOISELIKELIHOOD Likelihood of the data under the CMPND noise model. -% FORMAT -% DESC returns the likelihood of a data set under the compound noise model. -% ARG noise : the noise structure for which the likelihood is required. -% ARG mu : input mean locations for the likelihood. -% ARG varSigma : input variance locations for the likelihood. -% ARG y : target locations for the likelihood. -% -% SEEALSO : cmpndNoiseParamInit, cmpndNoiseLogLikelihood, noiseLikelihood -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -L = zeros(size(mu)); -for i = 1:length(noise.comp) - L(:, i) = noiseLikelihood(noise.comp{i},... - mu(:, i), ... - varsigma(:, i), ... - y(:, i)); -end diff --git a/gpmnoise/cmpndNoiseLogLikelihood.m b/gpmnoise/cmpndNoiseLogLikelihood.m deleted file mode 100644 index 340b6cf8..00000000 --- a/gpmnoise/cmpndNoiseLogLikelihood.m +++ /dev/null @@ -1,25 +0,0 @@ -function L = cmpndNoiseLogLikelihood(noise, mu, varsigma, y) - - -% CMPNDNOISELOGLIKELIHOOD Log likelihood of the data under the CMPND noise model. -% FORMAT -% DESC returns the log likelihood of a data set under the compound noise model. -% ARG noise : the noise structure for which the log likelihood is required. -% ARG mu : input mean locations for the log likelihood. -% ARG varSigma : input variance locations for the log likelihood. -% ARG y : target locations for the log likelihood. -% -% SEEALSO : cmpndNoiseParamInit, cmpndNoiseLikelihood, noiseLogLikelihood -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -L = 0; -for i = 1:length(noise.comp) - L = L + noiseLogLikelihood(noise.comp{i}, ... - mu(:, i), ... - varsigma(:, i), ... - y(:, i)); -end diff --git a/gpmnoise/cmpndNoiseNuG.m b/gpmnoise/cmpndNoiseNuG.m deleted file mode 100644 index e71e5ca0..00000000 --- a/gpmnoise/cmpndNoiseNuG.m +++ /dev/null @@ -1,25 +0,0 @@ -function [g, nu] = cmpndNoiseNuG(noise, mu, varSigma, y) - -% CMPNDNOISENUG Update nu and g parameters associated with compound noise model. - -% NOISE - -% NOISE - - -g = zeros(size(mu)); -nu = zeros(size(g)); -for i = 1:length(noise.comp) - [g(:, i), nu(:, i)] = ... - noiseUpdateNuG(noise.comp{i}, ... - mu(:, i), varSigma(:, i), ... - y(:, i)); - if any(nu(:, i)< 0) - if noise.comp{i}.logconcave - warning('nu less than zero in log concave model.') - else - fprintf('nu less than zero\n') - end - end -end - diff --git a/gpmnoise/cmpndNoiseOut.m b/gpmnoise/cmpndNoiseOut.m deleted file mode 100644 index 50cf4964..00000000 --- a/gpmnoise/cmpndNoiseOut.m +++ /dev/null @@ -1,27 +0,0 @@ -function y = cmpndNoiseOut(noise, mu, varsigma) - - -% CMPNDNOISEOUT Compute the output of the CMPND noise given the input mean and variance. -% FORMAT -% DESC computes the ouptut for the compound -% noise given input mean and variances. -% ARG noise : the noise structure for which the output is computed. -% ARG mu : the input mean values. -% ARG varSigma : the input variance values. -% RETURN y : the output from the noise model. -% -% SEEALSO : cmpndNoiseParamInit, noiseOut, noiseCreate, -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -y = zeros(size(mu)); -for i = 1:length(noise.comp) - fhandle = str2func([noise.comp{i}.type 'NoiseOut']); - y(:, i) = fhandle(noise.comp{i},... - mu(:, i), ... - varsigma(:, i)); -end - diff --git a/gpmnoise/cmpndNoiseParamInit.m b/gpmnoise/cmpndNoiseParamInit.m deleted file mode 100644 index 14bb6285..00000000 --- a/gpmnoise/cmpndNoiseParamInit.m +++ /dev/null @@ -1,39 +0,0 @@ -function noise = cmpndNoiseParamInit(noise, y) - -% CMPNDNOISEPARAMINIT CMPND noise parameter initialisation. -% The compound noise model is a wrapper noise model for allowing each output -% of a the model to have a different noise model. -% -% SEEALSO : cmpndKernParamInit -% -% FORMAT -% DESC initialises the compound -% noise structure with some default parameters. -% ARG noise : the noise structure which requires initialisation. -% RETURN noise : the noise structure with the default parameters placed in. -% -% SEEALSO : noiseCreate, noiseParamInit -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -if nargin > 1 - if length(noise.comp) ~= size(y, 2) - error('Number of noise components must match y''s dimensions') - end -end -noise.nParams = 0; -for i = 1:length(noise.comp) - if nargin > 1 - noise.comp{i} = noiseParamInit(noise.comp{i}, y(:, i)); - else - noise.comp{i}.numProcess=1; - noise.comp{i} = noiseParamInit(noise.comp{i}); - end - noise.nParams = noise.nParams + noise.comp{i}.nParams; -end -noise.paramGroups = speye(noise.nParams); -% This is a bit of a hack. -noise.missing=0; diff --git a/gpmnoise/cmpndNoisePointPlot.m b/gpmnoise/cmpndNoisePointPlot.m deleted file mode 100644 index 6c9715c7..00000000 --- a/gpmnoise/cmpndNoisePointPlot.m +++ /dev/null @@ -1,20 +0,0 @@ -function h = cmpndNoisePointPlot(noise, X, y, fontName, fontSize, markerSize, lineWidth) - -% CMPNDNOISEPOINTPLOT Plot the data-points for the CMPND noise model. -% FORMAT -% DESC plots the data point locations for the compound -% noise structure. -% ARG noise : the noise structure which is to be plotted. -% ARG X : input locations to be plotted. -% ARG y : target locations to be plotted. -% ARG fontName : name of any fonts to be used. -% ARG fontSize : size of any fonts to be used. -% ARG markerSize : size of the makers to be used. -% ARG lineWidth : size of any lines to be plotted. -% -% SEEALSO : cmpndNoiseParamInit, noisePointPlot -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - diff --git a/gpmnoise/cmpndNoiseSites.m b/gpmnoise/cmpndNoiseSites.m deleted file mode 100644 index 4ec2208f..00000000 --- a/gpmnoise/cmpndNoiseSites.m +++ /dev/null @@ -1,28 +0,0 @@ -function [m, beta] = cmpndNoiseSites(noise, g, nu, mu, varSigma, y) - -% CMPNDNOISESITES Site updates for compound noise model. - -% NOISE - -% NOISE - - -m = zeros(size(g)); -beta = zeros(size(m)); -for i = 1:length(noise.comp) - [m(:, i), beta(:, i)] = ... - noiseUpdateSites(noise.comp{i}, ... - g(:, i), nu(:, i), ... - mu(:, i), varSigma(:, i), ... - y(:, i)); - - if any(beta(:, i)<0) - if noise.comp{i}.logconcave - error('Beta less than zero for log concave model.') - else - indices = find(beta(:, i) < 0); - beta(indices, i) = 1e-6; - fprintf('Beta less than zero .... fixing to 1e-6.\n') - end - end -end diff --git a/gpmnoise/gaussianNoise3dPlot.m b/gpmnoise/gaussianNoise3dPlot.m deleted file mode 100644 index c6baeb58..00000000 --- a/gpmnoise/gaussianNoise3dPlot.m +++ /dev/null @@ -1,25 +0,0 @@ -function h = gaussianNoise3dPlot(noise, plotType, CX, CY, CZ, CZVar, varargin) - -% GAUSSIANNOISE3DPLOT Draws a 3D or contour plot for the GAUSSIAN noise model. -% FORMAT -% DESC draws a 3D or contour plot for the Gaussian noise model. -% ARG noise : the noise structure for which the plot is required. -% ARG plotType : string containing the name of the plotting function (for example mesh, contour). -% ARG X : the input X data in the form of a 'mesh' matrix. -% ARG Y : the input Y data in the form of a 'mesh' matrix. -% ARG mu : the input mean in the form of a 'mesh' matrix. -% ARG varSigma : the input variance in the form of a 'mesh' matrix. -% ARG P1, P2, P3 ... : optional additional arguments for the given plot type. -% RETURN h : the gradients of the diagonal with respect to each element -% of X. The returned matrix has the same dimensions as X. -% -% SEEALSO : gaussianNoiseParamInit, noise3dPlot, -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -CZ = (CZ+noise.bias); -fhandle = str2func(plotType); -h = fhandle(CX, CY, CZ, varargin{:}); diff --git a/gpmnoise/gaussianNoiseDisplay.m b/gpmnoise/gaussianNoiseDisplay.m deleted file mode 100644 index 31b88f80..00000000 --- a/gpmnoise/gaussianNoiseDisplay.m +++ /dev/null @@ -1,32 +0,0 @@ -function gaussianNoiseDisplay(noise, spacing) - -% GAUSSIANNOISEDISPLAY Display parameters of the GAUSSIAN noise. -% FORMAT -% DESC displays the parameters of the Gaussian -% noise and the noise type to the console. -% ARG noise : the noise to display. -% -% FORMAT does the same as above, but indents the display according -% to the amount specified. -% ARG noise : the noise to display. -% ARG spacing : how many spaces to indent the display of the noise by. -% -% SEEALSO : gaussianNoiseParamInit, modelDisplay, noiseDisplay -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -if nargin > 1 - spacing = repmat(32, 1, spacing); -else - spacing = []; -end -spacing = char(spacing); -for i = 1:noise.numProcess - fprintf(spacing); - fprintf('Gaussian bias on process %d: %2.4f\n', i, noise.bias(i)) -end -fprintf(spacing); -fprintf('Gaussian noise: %2.4f\n', noise.sigma2); diff --git a/gpmnoise/gaussianNoiseExpandParam.m b/gpmnoise/gaussianNoiseExpandParam.m deleted file mode 100644 index 0d8d23c3..00000000 --- a/gpmnoise/gaussianNoiseExpandParam.m +++ /dev/null @@ -1,24 +0,0 @@ -function noise = gaussianNoiseExpandParam(noise, params) - -% GAUSSIANNOISEEXPANDPARAM Create noise structure from GAUSSIAN noise's parameters. -% FORMAT -% DESC returns a Gaussian noise structure filled with the -% parameters in the given vector. This is used as a helper function to -% enable parameters to be optimised in, for example, the NETLAB -% optimisation functions. -% ARG noise : the noise structure in which the parameters are to be -% placed. -% ARG param : vector of parameters which are to be placed in the -% noise structure. -% RETURN noise : noise structure with the given parameters in the -% relevant locations. -% -% SEEALSO : gaussianNoiseParamInit, gaussianNoiseExtractParam, noiseExpandParam -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -noise.bias = params(1:end-1); -noise.sigma2 = params(end); diff --git a/gpmnoise/gaussianNoiseExtractParam.m b/gpmnoise/gaussianNoiseExtractParam.m deleted file mode 100644 index 2727b812..00000000 --- a/gpmnoise/gaussianNoiseExtractParam.m +++ /dev/null @@ -1,41 +0,0 @@ -function [params, names] = gaussianNoiseExtractParam(noise) - -% GAUSSIANNOISEEXTRACTPARAM Extract parameters from the GAUSSIAN noise structure. -% FORMAT -% DESC extracts parameters from the Gaussian -% noise structure into a vector of parameters for optimisation. -% ARG noise : the noise structure containing the parameters to be -% extracted. -% RETURN param : vector of parameters extracted from the noise. If -% the field 'transforms' is not empty in the noise structure, the -% parameters will be transformed before optimisation (for example -% positive only parameters could be logged before being returned). -% -% FORMAT -% DESC extracts parameters and parameter names from the Gaussian -% noise structure. -% ARG noise : the noise structure containing the parameters to be -% extracted. -% RETURN param : vector of parameters extracted from the noise. If -% the field 'transforms' is not empty in the noise structure, the -% parameters will be transformed before optimisation (for example -% positive only parameters could be logged before being returned). -% RETURN names : cell array of strings containing names for each -% parameter. -% -% SEEALSO gaussianNoiseParamInit, gaussianNoiseExpandParam, noiseExtractParam, scg, conjgrad -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -params = [noise.bias noise.sigma2]; - - -if nargout > 1 - for i = 1:noise.numProcess - names{i} = ['bias ' num2str(i)]; - end - names{i+1} = ['sigma^2 ' num2str(i)]; -end diff --git a/gpmnoise/gaussianNoiseGradVals.m b/gpmnoise/gaussianNoiseGradVals.m deleted file mode 100644 index d4a23628..00000000 --- a/gpmnoise/gaussianNoiseGradVals.m +++ /dev/null @@ -1,31 +0,0 @@ -function [dlnZ_dmu, dlnZ_dvs] = gaussianNoiseGradVals(noise, mu, varsigma, y) - -% GAUSSIANNOISEGRADVALS Gradient of GAUSSIAN noise log Z with respect to input mean and variance. -% FORMAT -% DESC computes the gradient of the Gaussian -% noise with respect to the input mean and the input variance. -% ARG noise : noise structure for which gradients are being -% computed. -% ARG mu : mean input locations with respect to which gradients are -% being computed. -% ARG varSigma : variance input locations with respect to which -% gradients are being computed. -% ARG y : noise model output observed values associated with the given points. -% RETURN dlnZ_dmu : the gradient of log Z with respect to the input mean. -% RETURN dlnZ_dvs : the gradient of log Z with respect to the input variance. -% -% SEEALSO gaussianNoiseParamInit, gaussianNoiseGradientParam, noiseGradVals, -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -D = size(y, 2); -nu = 1./(noise.sigma2+varsigma); -dlnZ_dmu = zeros(size(nu)); -for i = 1:D - dlnZ_dmu(:, i) = y(:, i) - mu(:, i) - noise.bias(i); -end -dlnZ_dmu = dlnZ_dmu.*nu; -dlnZ_dvs = 0.5*(dlnZ_dmu.*dlnZ_dmu - nu); diff --git a/gpmnoise/gaussianNoiseGradientParam.m b/gpmnoise/gaussianNoiseGradientParam.m deleted file mode 100644 index 6b2ec95a..00000000 --- a/gpmnoise/gaussianNoiseGradientParam.m +++ /dev/null @@ -1,37 +0,0 @@ -function g = gaussianNoiseGradientParam(noise, mu, varsigma, y) - -% GAUSSIANNOISEGRADIENTPARAM Gradient of GAUSSIAN noise's parameters. -% FORMAT -% DESC computes the gradient of the log Z of the Gaussian noise model with respect to the of functions with respect to the -% Gaussian -% noise's parameters. -% ARG noise : the noise structure for which the gradients are being -% computed. -% ARG mu : the input means for which the gradients are being computed. -% ARG varSigma : the input variances for which the gradients are being computed. -% ARG y : the target values for the noise model. -% RETURN g : gradients of the log probability with respect to -% the noise parameters. The ordering of the vector should match -% that provided by the function noiseExtractParam. -% -% -% SEEALSO gaussianNoiseParamInit, gaussiannoiseGradVals, noiseGradientParam -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -D = size(y, 2); -u = zeros(size(y)); - -for i = 1:D - mu(:, i) = mu(:, i) + noise.bias(i); -end - -u = y - mu; -nu = 1./(varsigma+noise.sigma2); -u = u.*nu; -gbias = sum(u, 1); -gsigma2 = -0.5*sum(sum(nu - u.*u, 1)); -g = [gbias gsigma2]; diff --git a/gpmnoise/gaussianNoiseLikelihood.m b/gpmnoise/gaussianNoiseLikelihood.m deleted file mode 100644 index 24af5b33..00000000 --- a/gpmnoise/gaussianNoiseLikelihood.m +++ /dev/null @@ -1,25 +0,0 @@ -function L = gaussianNoiseLikelihood(noise, mu, varsigma, y) - -% GAUSSIANNOISELIKELIHOOD Likelihood of the data under the GAUSSIAN noise model. -% FORMAT -% DESC returns the likelihoods for data points under the Gaussian noise model. -% ARG noise : the noise structure for which the likelihood is required. -% ARG mu : input mean locations for the likelihood. -% ARG varSigma : input variance locations for the likelihood. -% ARG y : target locations for the likelihood. -% -% SEEALSO : gaussianNoiseParamInit, gaussianNoiseLogLikelihood, noiseLikelihood -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -N = size(y, 1); -D = size(y, 2); -varsigma = varsigma + noise.sigma2; -for i = 1:D - mu(:, i) = mu(:, i) + noise.bias(i); -end -arg = (mu - y)./sqrt(varsigma); -L = (2*pi*varsigma).^(-1/2).*exp( - .5*arg.*arg); diff --git a/gpmnoise/gaussianNoiseLogLikelihood.m b/gpmnoise/gaussianNoiseLogLikelihood.m deleted file mode 100644 index fae461f7..00000000 --- a/gpmnoise/gaussianNoiseLogLikelihood.m +++ /dev/null @@ -1,30 +0,0 @@ -function L = gaussianNoiseLogLikelihood(noise, mu, varsigma, y) - -% GAUSSIANNOISELOGLIKELIHOOD Log likelihood of the data under the GAUSSIAN noise model. -% FORMAT -% DESC returns the log likelihood of a data set under the Gaussian noise model. -% ARG noise : the noise structure for which the log likelihood is required. -% ARG mu : input mean locations for the log likelihood. -% ARG varSigma : input variance locations for the log likelihood. -% ARG y : target locations for the log likelihood. -% -% SEEALSO : gaussianNoiseParamInit, gaussianNoiseLikelihood, noiseLogLikelihood -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -N = size(mu, 1); -D = size(mu, 2); -varsigma = varsigma + noise.sigma2; -for i = 1:D - mu(:, i) = mu(:, i) + noise.bias(i); -end -arg = (y - mu); -arg = arg.*arg./varsigma; - -L = - 0.5*sum(sum(log(varsigma))) ... - - 0.5*sum(sum(arg)) ... - - 0.5*N*D*log(2*pi); - diff --git a/gpmnoise/gaussianNoiseNuG.m b/gpmnoise/gaussianNoiseNuG.m deleted file mode 100644 index 7fa85399..00000000 --- a/gpmnoise/gaussianNoiseNuG.m +++ /dev/null @@ -1,28 +0,0 @@ -function [g, nu] = gaussianNoiseNuG(noise, mu, varSigma, y) - -% GAUSSIANNOISENUG Compute nu and g for GAUSSIAN noise model. -% FORMAT -% DESC computes the values nu and g for the Gaussian noise given the mean and variance inputs as well as the output of the noise model. -% ARG noise : the noise structure for which the nu and g are computed. -% ARG mu : input mean to the noise model. -% ARG varSigma : input variance to the noise model. -% ARG y : target output for the noise model. -% RETURN g : the vector g, which is the gradient of log Z with respect to the input mean. -% ARG y : target output for the noise model. -% RETURN nu : the vector nu, see equation 10 of "Extensions of the Informative Vector Machine". -% -% SEEALSO : gaussianNoiseParamInit, noiseUpdateNuG, noiseCreate -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -D = size(y, 2); -nu = 1./(noise.sigma2+varSigma); -g = zeros(size(nu)); -for i = 1:D - g(:, i) = y(:, i) - mu(:, i) - ... - noise.bias(i); -end -g = g.*nu; diff --git a/gpmnoise/gaussianNoiseOut.m b/gpmnoise/gaussianNoiseOut.m deleted file mode 100644 index 270b9514..00000000 --- a/gpmnoise/gaussianNoiseOut.m +++ /dev/null @@ -1,23 +0,0 @@ -function y = gaussianNoiseOut(noise, mu, varsigma) - -% GAUSSIANNOISEOUT Compute the output of the GAUSSIAN noise given the input mean and variance. -% FORMAT -% DESC computes the ouptut for the Gaussian -% noise given input mean and variances. -% ARG noise : the noise structure for which the output is computed. -% ARG mu : the input mean values. -% ARG varSigma : the input variance values. -% RETURN y : the output from the noise model. -% -% SEEALSO : gaussianNoiseParamInit, noiseOut, noiseCreate -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -D = size(mu, 2); -y = zeros(size(mu)); -for i = 1:D - y(:, i) = mu(:, i) + noise.bias(i); -end diff --git a/gpmnoise/gaussianNoiseParamInit.m b/gpmnoise/gaussianNoiseParamInit.m deleted file mode 100644 index aee87345..00000000 --- a/gpmnoise/gaussianNoiseParamInit.m +++ /dev/null @@ -1,41 +0,0 @@ -function noise = gaussianNoiseParamInit(noise, y) - -% GAUSSIANNOISEPARAMINIT GAUSSIAN noise parameter initialisation. -% The Gaussian noise model is the standard noise model used for -% regression tasks. The input mean and variance is converted to an -% output mean and variance by first adding a bias to the mean and then -% adding a stored variance to the input variance. -% -% SEEALSO : mgaussianParamInit -% -% FORMAT -% DESC initialises the Gaussian -% noise structure with some default parameters. -% ARG noise : the noise structure which requires initialisation. -% RETURN noise : the noise structure with the default parameters placed in. -% -% SEEALSO : noiseCreate, noiseParamInit -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -if nargin > 1 - noise.bias = mean(y); - noise.numProcess = size(y, 2); -else - noise.bias = zeros(1, noise.numProcess); -end - -noise.sigma2 = 1e-6; - -noise.transforms.index = noise.numProcess+1; -noise.transforms.type = optimiDefaultConstraint('positive');; -noise.nParams = 1 + noise.numProcess; - -% Can handle missing values? -noise.missing = 0; - -% Noise model leads to constant value of beta. -noise.spherical = 1; diff --git a/gpmnoise/gaussianNoisePointPlot.m b/gpmnoise/gaussianNoisePointPlot.m deleted file mode 100644 index ecbf9bd4..00000000 --- a/gpmnoise/gaussianNoisePointPlot.m +++ /dev/null @@ -1,35 +0,0 @@ -function h = gaussianNoisePointPlot(noise, X, y, fontName, fontSize, ... - markerSize, lineWidth) - -% GAUSSIANNOISEPOINTPLOT Plot the data-points for the GAUSSIAN noise model. -% FORMAT -% DESC plots the data point locations for the Gaussian -% noise structure. -% ARG noise : the noise structure which is to be plotted. -% ARG X : input locations to be plotted. -% ARG y : target locations to be plotted. -% ARG fontName : name of any fonts to be used. -% ARG fontSize : size of any fonts to be used. -% ARG markerSize : size of the makers to be used. -% ARG lineWidth : size of any lines to be plotted. -% -% SEEALSO : gaussianNoiseParamInit, noisePointPlot -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -h = plot3(X(:, 1), X(:, 2), y, 'r.', 'erasemode', 'xor', 'markerSize', markerSize, 'linewidth', lineWidth); - -minVals = min([X y]); -maxVals = max([X y]); - -spans = maxVals - minVals; -gaps = spans*.05; - -prop = {'xlim', 'ylim', 'zlim'}; -for i = 1:3 - set(gca, prop{i}, [minVals(i)-gaps(i) maxVals(i)+gaps(i)]); -end -hold on diff --git a/gpmnoise/gaussianNoiseSites.m b/gpmnoise/gaussianNoiseSites.m deleted file mode 100644 index ae8ce2d9..00000000 --- a/gpmnoise/gaussianNoiseSites.m +++ /dev/null @@ -1,29 +0,0 @@ -function [m, beta] = gaussianNoiseSites(noise, g, nu, mu, varSigma, y) - -% GAUSSIANNOISESITES Update the site parameters for the GAUSSIAN noise mode. -% FORMAT -% DESC updates the site parameters for the Gaussian -% noise model. -% ARG noise : the noise structure for which the site parameters are to -% be updated. -% ARG g : values of g as retuned by gaussianNoiseNuG. -% ARG nu : values of nu as retuned by gaussianNoiseNuG. -% ARG mu : the mean value of the Gaussian input to the noise structure. -% ARG varSigma : the variance of the Gaussian input to the noise structure. -% ARG y : the target value. -% RETURN m : the site mean parameters. -% RETURN beta : the site precision parameters. -% -% SEEALSO : gaussianNoiseParamInit, noiseUpdateSites -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - -N = size(y, 1); -D = length(noise.bias); -beta = zeros(N, D); -for i = 1:size(y, 2) - m(:, i) = y(:, i) - noise.bias(i); -end -beta = repmat(1./noise.sigma2, N, D); diff --git a/gpmnoise/mgaussianNoise3dPlot.m b/gpmnoise/mgaussianNoise3dPlot.m deleted file mode 100644 index beb96a22..00000000 --- a/gpmnoise/mgaussianNoise3dPlot.m +++ /dev/null @@ -1,21 +0,0 @@ -function gX = mgaussianNoise3dPlot(noise, X) - -% MGAUSSIANNOISE3DPLOT Draws a 3D or contour plot for the MGAUSSIAN noise model. -% FORMAT -% DESC draws a 3D or contour plot for the multiple output Gaussian noise model. -% ARG noise : the noise structure for which the plot is required. -% ARG plotType : string containing the name of the plotting function (for example mesh, contour). -% ARG X : the input X data in the form of a 'mesh' matrix. -% ARG Y : the input Y data in the form of a 'mesh' matrix. -% ARG mu : the input mean in the form of a 'mesh' matrix. -% ARG varSigma : the input variance in the form of a 'mesh' matrix. -% ARG P1, P2, P3 ... : optional additional arguments for the given plot type. -% RETURN h : the gradients of the diagonal with respect to each element -% of X. The returned matrix has the same dimensions as X. -% -% SEEALSO : mgaussianNoiseParamInit, noise3dPlot, -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - diff --git a/gpmnoise/mgaussianNoiseDisplay.m b/gpmnoise/mgaussianNoiseDisplay.m deleted file mode 100644 index 291046a8..00000000 --- a/gpmnoise/mgaussianNoiseDisplay.m +++ /dev/null @@ -1,35 +0,0 @@ -function mgaussianNoiseDisplay(noise, spacing) - - -% MGAUSSIANNOISEDISPLAY Display parameters of the MGAUSSIAN noise. -% FORMAT -% DESC displays the parameters of the multiple output Gaussian -% noise and the noise type to the console. -% ARG noise : the noise to display. -% -% FORMAT does the same as above, but indents the display according -% to the amount specified. -% ARG noise : the noise to display. -% ARG spacing : how many spaces to indent the display of the noise by. -% -% SEEALSO : mgaussianNoiseParamInit, modelDisplay, noiseDisplay -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -if nargin > 1 - spacing = repmat(32, 1, spacing); -else - spacing = []; -end -spacing = char(spacing); - -for i = 1:noise.numProcess - fprintf(spacing) - fprintf('MGaussian bias on process %d: %2.4f\n', i, noise.bias(i)) - fprintf(spacing) - fprintf('MGaussian variance on process %d: %2.4f\n', i, noise.sigma2(i)) -end - diff --git a/gpmnoise/mgaussianNoiseExpandParam.m b/gpmnoise/mgaussianNoiseExpandParam.m deleted file mode 100644 index 4d1cff24..00000000 --- a/gpmnoise/mgaussianNoiseExpandParam.m +++ /dev/null @@ -1,25 +0,0 @@ -function noise = mgaussianNoiseExpandParam(noise, params) - - -% MGAUSSIANNOISEEXPANDPARAM Create noise structure from MGAUSSIAN noise's parameters. -% FORMAT -% DESC returns a multiple output Gaussian noise structure filled with the -% parameters in the given vector. This is used as a helper function to -% enable parameters to be optimised in, for example, the NETLAB -% optimisation functions. -% ARG noise : the noise structure in which the parameters are to be -% placed. -% ARG param : vector of parameters which are to be placed in the -% noise structure. -% RETURN noise : noise structure with the given parameters in the -% relevant locations. -% -% SEEALSO : mgaussianNoiseParamInit, mgaussianNoiseExtractParam, noiseExpandParam -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -noise.bias = params(1:noise.numProcess); -noise.sigma2 = params(noise.numProcess+1:end); diff --git a/gpmnoise/mgaussianNoiseExtractParam.m b/gpmnoise/mgaussianNoiseExtractParam.m deleted file mode 100644 index 6a36cb7d..00000000 --- a/gpmnoise/mgaussianNoiseExtractParam.m +++ /dev/null @@ -1,44 +0,0 @@ -function [params, names] = mgaussianNoiseExtractParam(noise) - - -% MGAUSSIANNOISEEXTRACTPARAM Extract parameters from the MGAUSSIAN noise structure. -% FORMAT -% DESC extracts parameters from the multiple output Gaussian -% noise structure into a vector of parameters for optimisation. -% ARG noise : the noise structure containing the parameters to be -% extracted. -% RETURN param : vector of parameters extracted from the noise. If -% the field 'transforms' is not empty in the noise structure, the -% parameters will be transformed before optimisation (for example -% positive only parameters could be logged before being returned). -% -% FORMAT -% DESC extracts parameters and parameter names from the multiple output Gaussian -% noise structure. -% ARG noise : the noise structure containing the parameters to be -% extracted. -% RETURN param : vector of parameters extracted from the noise. If -% the field 'transforms' is not empty in the noise structure, the -% parameters will be transformed before optimisation (for example -% positive only parameters could be logged before being returned). -% RETURN names : cell array of strings containing names for each -% parameter. -% -% SEEALSO mgaussianNoiseParamInit, mgaussianNoiseExpandParam, noiseExtractParam, scg, conjgrad -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 -% -% NOISE - - -params = [noise.bias noise.sigma2]; - - -if nargout > 1 - for i = 1:noise.numProcess - names{i} = ['bias ' num2str(i)]; - end - for i = noise.numProcess+1:2*noise.numProcess - names{i} = ['sigma^2 ' num2str(i)]; - end -end diff --git a/gpmnoise/mgaussianNoiseGradVals.m b/gpmnoise/mgaussianNoiseGradVals.m deleted file mode 100644 index 34cd01db..00000000 --- a/gpmnoise/mgaussianNoiseGradVals.m +++ /dev/null @@ -1,45 +0,0 @@ -function [dlnZ_dmu, dlnZ_dvs] = mgaussianNoiseGradVals(noise, mu, varsigma, y) - - -% MGAUSSIANNOISEGRADVALS Gradient of MGAUSSIAN noise log Z with respect to input mean and variance. -% FORMAT -% DESC computes the gradient of the multiple output Gaussian -% noise with respect to the input mean and the input variance. -% ARG noise : noise structure for which gradients are being -% computed. -% ARG mu : mean input locations with respect to which gradients are -% being computed. -% ARG varSigma : variance input locations with respect to which -% gradients are being computed. -% ARG y : noise model output observed values associated with the given points. -% RETURN dlnZ_dmu : the gradient of log Z with respect to the input mean. -% RETURN dlnZ_dvs : the gradient of log Z with respect to the input variance. -% -% SEEALSO mgaussianNoiseParamInit, mgaussianNoiseGradientParam, noiseGradVals, -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -D = size(y, 2); -nu = zeros(size(y)); -dlnZ_dmu = zeros(size(y)); -for i = 1:D - nu(:, i) = 1./(noise.sigma2(i)+varsigma(:, i)); - dlnZ_dmu(:, i) = y(:, i) - mu(:, i) - noise.bias(i); -end -dlnZ_dmu = dlnZ_dmu.*nu; -dlnZ_dvs = -.5*nu+.5*dlnZ_dmu.*dlnZ_dmu; - -% Remove missing values. -dlnZ_dmu(find(isnan(y))) = 0; -dlnZ_dvs(find(isnan(y))) = 0; -%/~ -if any(isnan(dlnZ_dmu)) - warning('dlnZ_dmu is NaN') -end -if any(isnan(dlnZ_dvs)) - warning('dlnZ_dvs is NaN') -end -%~/ diff --git a/gpmnoise/mgaussianNoiseGradientParam.m b/gpmnoise/mgaussianNoiseGradientParam.m deleted file mode 100644 index ee18685e..00000000 --- a/gpmnoise/mgaussianNoiseGradientParam.m +++ /dev/null @@ -1,42 +0,0 @@ -function g = mgaussianNoiseGradientParam(noise, mu, varsigma, y) - - -% MGAUSSIANNOISEGRADIENTPARAM Gradient of MGAUSSIAN noise's parameters. -% FORMAT -% DESC computes the gradient of the log Z of the multiple output Gaussian noise model with respect to the of functions with respect to the -% multiple output Gaussian -% noise's parameters. -% ARG noise : the noise structure for which the gradients are being -% computed. -% ARG mu : the input means for which the gradients are being computed. -% ARG varSigma : the input variances for which the gradients are being computed. -% ARG y : the target values for the noise model. -% RETURN g : gradients of the log Z with respect to -% the noise parameters. The ordering of the vector should match -% that provided by the function noiseExtractParam. -% -% -% SEEALSO mgaussianNoiseParamInit, mgaussiannoiseGradVals, noiseGradientParam -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -D = size(y, 2); -u = zeros(size(y)); -nu = zeros(size(y)); -for i = 1:D - mu(:, i) = mu(:, i) + noise.bias(i); - nu(:, i) = 1./(varsigma(:, i) + noise.sigma2(i)); -end - -u = y - mu; - -% Remove unlabelled points from the gradient. -u(find(isnan(y))) = 0; -nu(find(isnan(y)))= 0; -u = u.*nu; -gbias = sum(u, 1); -gsigma2 = -.5*sum(nu - u.*u, 1); -g = [gbias gsigma2]; diff --git a/gpmnoise/mgaussianNoiseLikelihood.m b/gpmnoise/mgaussianNoiseLikelihood.m deleted file mode 100644 index 8cc7660c..00000000 --- a/gpmnoise/mgaussianNoiseLikelihood.m +++ /dev/null @@ -1,30 +0,0 @@ -function L = mgaussianNoiseLikelihood(noise, mu, varsigma, y) - - -% MGAUSSIANNOISELIKELIHOOD Likelihood of the data under the MGAUSSIAN noise model. -% FORMAT -% DESC returns the likelihood of a data set under the multiple output Gaussian noise model. -% ARG noise : the noise structure for which the likelihood is required. -% ARG mu : input mean locations for the likelihood. -% ARG varSigma : input variance locations for the likelihood. -% ARG y : target locations for the likelihood. -% -% SEEALSO : mgaussianNoiseParamInit, mgaussianNoiseLogLikelihood, noiseLikelihood -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -N = size(y, 1); -D = size(y, 2); -for i = 1:D - varsigma(:, i) = varsigma(:, i) + noise.sigma2(i); - mu(:, i) = mu(:, i) + noise.bias(i); -end -arg = (mu - y)./sqrt(varsigma); - -L = (2*pi*varsigma).^(-1/2).*exp( - .5*arg.*arg); - -% Set likelihood of unlabelled points to 1. -L(find(isnan(y)) = 1; diff --git a/gpmnoise/mgaussianNoiseLogLikelihood.m b/gpmnoise/mgaussianNoiseLogLikelihood.m deleted file mode 100644 index 3ada3708..00000000 --- a/gpmnoise/mgaussianNoiseLogLikelihood.m +++ /dev/null @@ -1,35 +0,0 @@ -function L = mgaussianNoiseLogLikelihood(noise, mu, varsigma, y) - - -% MGAUSSIANNOISELOGLIKELIHOOD Log likelihood of the data under the MGAUSSIAN noise model. -% FORMAT -% DESC returns the log likelihood of a data set under the multiple output Gaussian noise model. -% ARG noise : the noise structure for which the log likelihood is required. -% ARG mu : input mean locations for the log likelihood. -% ARG varSigma : input variance locations for the log likelihood. -% ARG y : target locations for the log likelihood. -% -% SEEALSO : mgaussianNoiseParamInit, mgaussianNoiseLikelihood, noiseLogLikelihood -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -N = size(mu, 1); -D = size(mu, 2); -for i = 1:D - varsigma(:, i) = varsigma(:, i) + noise.sigma2(i); - mu(:, i) = mu(:, i) + noise.bias(i); -end -arg = (y - mu); -arg = arg.*arg./varsigma; - -% Remove unlabelled data from likelihood. -arg = arg(:); -unlabelled = find(isnan(arg)); -arg(unlabelled) = []; -varsigma(unlabelled) = []; -L = - 0.5*sum(sum(log(varsigma))) ... - - 0.5*sum(sum(arg)) ... - - 0.5*N*D*log(2*pi); diff --git a/gpmnoise/mgaussianNoiseOut.m b/gpmnoise/mgaussianNoiseOut.m deleted file mode 100644 index d836c15f..00000000 --- a/gpmnoise/mgaussianNoiseOut.m +++ /dev/null @@ -1,25 +0,0 @@ -function y = mgaussianNoiseOut(noise, mu, varsigma) - - -% MGAUSSIANNOISEOUT Compute the output of the MGAUSSIAN noise given the input mean and variance. -% FORMAT -% DESC computes the ouptut for the multiple output Gaussian -% noise given input mean and variances. -% ARG noise : the noise structure for which the output is computed. -% ARG mu : the input mean values. -% ARG varSigma : the input variance values. -% RETURN y : the output from the noise model. -% -% SEEALSO : mgaussianNoiseParamInit, noiseOut, noiseCreate, -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -D = size(mu, 2); -y = zeros(size(mu)); -for i = 1:D - y(:, i) = mu(:, i) + noise.bias(i); -end - diff --git a/gpmnoise/mgaussianNoiseParamInit.m b/gpmnoise/mgaussianNoiseParamInit.m deleted file mode 100644 index 8a08a74b..00000000 --- a/gpmnoise/mgaussianNoiseParamInit.m +++ /dev/null @@ -1,40 +0,0 @@ -function noise = mgaussianNoiseParamInit(noise, y) - - -% MGAUSSIANNOISEPARAMINIT MGAUSSIAN noise parameter initialisation. -% This noise model is simply a Gaussian noise that allows different -% variances when multiple outputs are used. -% -% SEEALSO : gaussianNoiseParamInit -% -% FORMAT -% DESC initialises the multiple output Gaussian -% noise structure with some default parameters. -% ARG noise : the noise structure which requires initialisation. -% RETURN noise : the noise structure with the default parameters placed in. -% -% SEEALSO : noiseCreate, noiseParamInit -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -if nargin > 1 - noise.numProcess = size(y, 2); - noise.bias = zeros(1, noise.numProcess); - for i = 1:size(y, 2) - noise.bias(i) = mean(y(find(~isnan(y(:, i))), i)); - end - noise.sigma2 = repmat(1e-6, 1, noise.numProcess); -else - noise.bias = zeros(1, noise.numProcess); - noise.sigma2 = repmat(1e-6, 1, noise.numProcess); -end -noise.nParams = 2*noise.numProcess; - -% Can handle missing values? -noise.missing = 1; - -noise.transforms.index = [noise.numProcess+1:noise.nParams]; -noise.transforms.type = 'exp'; diff --git a/gpmnoise/mgaussianNoisePointPlot.m b/gpmnoise/mgaussianNoisePointPlot.m deleted file mode 100644 index 62bcb6b7..00000000 --- a/gpmnoise/mgaussianNoisePointPlot.m +++ /dev/null @@ -1,20 +0,0 @@ -function h = mgaussianNoisePointPlot(noise, X, y, fontName, fontSize, markerSize, lineWidth) - -% MGAUSSIANNOISEPOINTPLOT Plot the data-points for the MGAUSSIAN noise model. -% FORMAT -% DESC plots the data point locations for the multiple output Gaussian -% noise structure. -% ARG noise : the noise structure which is to be plotted. -% ARG X : input locations to be plotted. -% ARG y : target locations to be plotted. -% ARG fontName : name of any fonts to be used. -% ARG fontSize : size of any fonts to be used. -% ARG markerSize : size of the makers to be used. -% ARG lineWidth : size of any lines to be plotted. -% -% SEEALSO : mgaussianNoiseParamInit, noisePointPlot -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - diff --git a/gpmnoise/ncnmNoise3dPlot.m b/gpmnoise/ncnmNoise3dPlot.m deleted file mode 100644 index 1d7c120a..00000000 --- a/gpmnoise/ncnmNoise3dPlot.m +++ /dev/null @@ -1,23 +0,0 @@ -function h = ncnmNoise3dPlot(noise, plotType, CX, CY, CZ, CZVar, varargin) - -% NCNMNOISE3DPLOT Draw a 3D or contour plot for the NCNM noise model. -% FORMAT -% DESC draws a contour plot of outputs for the null category noise -% model. -% ARG noise : structure containing the noise model. -% ARG plotType : the type of plot to create (typically 'ncnmContour'). -% ARG X : input X locations for showing contours. -% ARG Y : input Y locations for showing contours. -% ARG Z : input means to the null category noise model. -% ARG CZVar : input variances to the null category noise model. -% ARG P1, P2, ... : optional input arguments to the plot type. -% RETURN H : handle to contour lines. - -% NOISE - -if nargout > 0 - h = feval(plotType, CX, CY, CZ, varargin{:}); -else - feval(plotType, CX, CY, CZ, varargin{:}); -end - diff --git a/gpmnoise/ncnmNoiseDisplay.m b/gpmnoise/ncnmNoiseDisplay.m deleted file mode 100644 index 250afd2a..00000000 --- a/gpmnoise/ncnmNoiseDisplay.m +++ /dev/null @@ -1,36 +0,0 @@ -function ncnmNoiseDisplay(noise, spacing) - -% NCNMNOISEDISPLAY Display parameters from null category noise model. -% FORMAT -% DESC displays the parameters of the null category noise model. -% ARG noise : the noise model to display. -% -% FORMAT does the same as above, but indents the display according -% to the amount specified. -% ARG noise : the noise model to display. -% ARG spacing : how many spaces to indent the display of the kernel by. -% -% SEEALSO ncnmNoiseParamInit, modelDisplay, noiseDisplay -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005, 2006 - -% NOISE - -if nargin > 1 - spacing = repmat(32, 1, spacing); -else - spacing = []; -end -spacing = char(spacing); -for i = 1:noise.numProcess - fprintf(spacing); - fprintf('Null Cat bias on process %d: %2.4f\n', i, noise.bias(i)) -end -fprintf(spacing); -fprintf('Null cat width: %2.4f\n', noise.width) -fprintf(spacing); -fprintf('Null cat Gamma -: %2.4f\n', noise.gamman) -fprintf(spacing); -fprintf('Null cat Gamma +: %2.4f\n', noise.gammap) -fprintf(spacing); -fprintf('Null cat Sigma2: %2.4f\n', noise.sigma2) diff --git a/gpmnoise/ncnmNoiseExpandParam.m b/gpmnoise/ncnmNoiseExpandParam.m deleted file mode 100644 index 6fe90a03..00000000 --- a/gpmnoise/ncnmNoiseExpandParam.m +++ /dev/null @@ -1,30 +0,0 @@ -function noise = ncnmNoiseExpandParam(noise, params) - -% NCNMNOISEEXPANDPARAM Expand null category noise model's structure from param vector. -% FORMAT -% DESC returns a null category noise model structure filled with the -% parameters in the given vector. This is used as a helper function to -% enable parameters to be optimised in, for example, the NETLAB -% optimisation functions. -% ARG noise : the noise structure in which the parameters are to be -% placed. -% ARG param : vector of parameters which are to be placed in the -% noise structure. -% RETURN noise : noise structure with the given parameters in the -% relevant locations. -% -% SEEALSO : ncnmNoiseParamInit, ncnmNoiseExtractParam, noiseExpandParam -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005, 2006 - -% NOISE - - -noise.bias = params(1:noise.numProcess); -noise.gamman = params(noise.numProcess+1); -if noise.gammaSplit - noise.gammap = params(noise.numProcess+2); -else - noise.gammap = noise.gamman; -end - diff --git a/gpmnoise/ncnmNoiseExtractParam.m b/gpmnoise/ncnmNoiseExtractParam.m deleted file mode 100644 index bf666563..00000000 --- a/gpmnoise/ncnmNoiseExtractParam.m +++ /dev/null @@ -1,33 +0,0 @@ -function [params, names] = ncnmNoiseExtractParam(noise) - -% NCNMNOISEEXTRACTPARAM Extract parameters from null category noise model. -% FORMAT -% DESC Extract parameters from the null category noise model into a vector of -% parameters for optimisation. -% ARG noise : the noise structure containing the parameters to be -% extracted. -% RETURN param : vector of parameters extracted from the noise. If -% the field 'transforms' is not empty in the noise structure, the -% parameters will be transformed before optimisation (for example -% positive only parameters could be logged before being returned). -% -% SEEALSO ncnmNoiseParamInit, ncnmNoiseExpandParam, noiseExtractParam, scg, conjgrad -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005, 2006 - -% NOISE - -if noise.gammaSplit - params = [noise.bias noise.gamman noise.gammap]; -else - params = [noise.bias noise.gamman]; -end - - -if nargout > 1 - for i = 1:noise.numProcess - names{i} = ['bias ' num2str(i)]; - end - names{noise.numProcess+1} = ['Gamma -']; - names{noise.numProcess+2} = ['Gamma +']; -end diff --git a/gpmnoise/ncnmNoiseGradVals.m b/gpmnoise/ncnmNoiseGradVals.m deleted file mode 100644 index e8f9f7b1..00000000 --- a/gpmnoise/ncnmNoiseGradVals.m +++ /dev/null @@ -1,78 +0,0 @@ -function [dlnZ_dmu, dlnZ_dvs] = ncnmNoiseGradVals(noise, mu, varsigma, y) - -% NCNMNOISEGRADVALS Compute gradient with respect to inputs to noise model. -% FORMAT -% DESC computes the gradient of the log-likelihood with respect to the -% input mean, mu, and the input variance, varsigma for null category -% noise model. These can be used in the computation of the updates -% for nu and g in the IVM algorithm (or EP). -% ARG noise : the noise structure for which gradients are computed. -% ARG mu : the input mean positions where gradients are computed. -% ARG varsigma : the input variance positions for which gradients -% are computed. -% ARG y : the target positions for which gradients are computed. -% RETURN dlnZ_dmu : the gradient of the log likelihood with respect -% to the means. -% RETURN dlnZ_dvs : the gradient of the log likelihood with respect -% to the variances. -% -% SEEALSO : noiseUpdateNuG, noiseGradVals, nsnmNoiseNuG -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005, 2006 - - -% NOISE - -D = size(y, 2); -for i = 1:D - mu(:, i) = mu(:, i) + noise.bias(i); -end -c = 1./sqrt(noise.sigma2 + varsigma); -fact = sqrt(2)/2; -epsilon = eps; -% Missing values are left untouched at zero. -dlnZ_dmu = zeros(size(c)); -dlnZ_dvs = zeros(size(c)); -for j = 1:D - % Do negative class first. - index = find(y(:, j)==-1); - if ~isempty(index) - mu(index, j) = (mu(index, j)+noise.width/2).*c(index, j); - dlnZ_dmu(index, j) = -c(index, j).*gradLogCumGaussian(-mu(index, j)); - dlnZ_dvs(index, j) = -.5*dlnZ_dmu(index, j).*c(index, j).*mu(index, j); - end - - - % Do missing data. - index = find(isnan(y(:, j))); - if ~isempty(index) - mu(index, j) = mu(index, j) + noise.width/2; - u = mu(index, j).*c(index, j); - uprime = (mu(index, j)-noise.width).*c(index, j); - lndenom = lnCumGaussSum(-u, uprime, noise.gamman, noise.gammap); - lnNumer1 = log(noise.gamman) -.5*log(2*pi) -.5*(u.*u); - lnNumer2 = log(noise.gammap) -.5*log(2*pi) -.5*(uprime.*uprime); - B1 = exp(lnNumer1 - lndenom); - B2 = exp(lnNumer2 - lndenom); - dlnZ_dmu(index, j) = c(index, j).*(B2 - B1); - dlnZ_dvs(index, j) = -.5*c(index, j).*c(index, j).*(uprime.*B2-u.*B1); - end - - % Do positive class. - index = find(y(:, j) == 1); - if ~isempty(index) - mu(index, j) = mu(index, j) - noise.width/2; - mu(index, j) = mu(index, j).*c(index, j); - dlnZ_dmu(index, j) = c(index, j).*gradLogCumGaussian(mu(index, j)); - dlnZ_dvs(index, j) = -.5*dlnZ_dmu(index, j).*c(index, j).*mu(index, j); - - end -end -%/~ -if any(isnan(dlnZ_dmu)) - warning('dlnZ_dmu is NaN') -end -if any(isnan(dlnZ_dvs)) - warning('dlnZ_dvs is NaN') -end -%~/ diff --git a/gpmnoise/ncnmNoiseGradientParam.m b/gpmnoise/ncnmNoiseGradientParam.m deleted file mode 100644 index e0f659a6..00000000 --- a/gpmnoise/ncnmNoiseGradientParam.m +++ /dev/null @@ -1,71 +0,0 @@ -function g = ncnmNoiseGradientParam(noise, mu, varsigma, y) - -% NCNMNOISEGRADIENTPARAM Gradient of parameters for NCNM. -% FORMAT -% DESC Computes the gradient of the log likelihood with respect to -% the null category noise model's parameters. -% ARG noise : structure containing the noise model. -% ARG mu : input means to the noise model. -% ARG varsigma : input variances to the noise model. -% ARG y : target values for the noise model. -% RETURN g : gradients of the log likelihood with respect to each -% of the parameters. See ncnmNoiseExtractParam for the ordering. -% -% SEEALSO : ncnmNoiseExtractParam, ncnmNoiseLogLikelihood, noiseGradientParam -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005, 2006 - -% NOISE - -D = size(y, 2); -for i = 1:D - mu(:, i) = mu(:, i) + noise.bias(i); -end -c = 1./sqrt(noise.sigma2 + varsigma); -gnoise.bias = zeros(1, D); -gnoise.gammap = 0; -gnoise.gamman = 0; -epsilon = eps; -for j = 1:D - % Do negative category first. - index = find(y(:, j)==-1); - if ~isempty(index) - mu(index, j) = mu(index, j)+noise.width/2; - u = mu(index, j).*c(index, j); - gnoise.bias(j) = gnoise.bias(j) - sum(c(index, j).*gradLogCumGaussian(-u)); - gnoise.gamman = gnoise.gamman - length(index)/(1-noise.gamman); - end - - % Do missing data. - index = find(isnan(y(:, j))); - if ~isempty(index) - mu(index, j) = mu(index, j) + noise.width/2; - u = mu(index, j).*c(index, j); - uprime = (mu(index, j) - noise.width).*c(index, j); - lndenom = lnCumGaussSum(-u, uprime, noise.gamman, noise.gammap); - lnNumer1 = log(noise.gamman) -.5*log(2*pi) -.5*(u.*u); - lnNumer2 = log(noise.gammap) -.5*log(2*pi) -.5*(uprime.*uprime); - B1 = exp(lnNumer1 - lndenom); - B2 = exp(lnNumer2 - lndenom); - gnoise.bias(j) = gnoise.bias(j) + sum(c(index, j).*(B2-B1)); - gnoise.gammap = gnoise.gammap + sum(exp(lnCumGaussian(uprime) -lndenom)); - gnoise.gamman = gnoise.gamman + sum(exp(lnCumGaussian(-u) - lndenom)); - end - - % Highest category - index = find(y(:, j) == 1); - if ~isempty(index) - mu(index, j) = mu(index, j) - noise.width/2; - mu(index, j) = mu(index, j).*c(index, j); - addpart = sum(c(index, j).*gradLogCumGaussian(mu(index, j))); - gnoise.bias(j) = gnoise.bias(j) + addpart; - % - gnoise.gammap = gnoise.gammap - length(index)/(1-noise.gammap); - end -end -if noise.gammaSplit - g = [gnoise.bias gnoise.gamman(:)' gnoise.gammap(:)']; -else - g = [gnoise.bias gnoise.gamman(:)' + gnoise.gammap(:)']; -end -%g = [gnoise.bias 0]; diff --git a/gpmnoise/ncnmNoiseLikelihood.m b/gpmnoise/ncnmNoiseLikelihood.m deleted file mode 100644 index e6295be7..00000000 --- a/gpmnoise/ncnmNoiseLikelihood.m +++ /dev/null @@ -1,50 +0,0 @@ -function L = ncnmNoiseLikelihood(noise, mu, varsigma, y) - -% NCNMNOISELIKELIHOOD Likelihood of data under null category noise model. -% FORMAT -% DESC returns the likelihood of a set of targets under a given -% NCNM noise model with process mean and variances provided. -% ARG noise : the noise model structure. -% ARG mu : the mean input into the noise model. -% ARG sigma : the variance input into the noise model. -% ARG y : the targets whose likelihoods are being predicted. -% RETURN L : vector of a likelihood for each of the targets. -% -% SEEALSO : noiseLikelihood, ncnmLogLikelihood -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005, 2006 - -% NOISE - -D = size(y, 2); -for i = 1:D - mu(:, i) = mu(:, i) + noise.bias(i); -end - - -c = 1./sqrt(noise.sigma2 + varsigma); -for j = 1:D - % Negatively labelled data. - index = find(y(:, j) == -1); - if ~isempty(index) - mu(index, j) = mu(index, j) + noise.width/2; - L(index, j) = cumGaussian(-mu(index, j).*c(index, j)); - % account for observations of missingness variable. - L(index,j) = L(index,j)*(1-noise.gamman); - end - - % Missing data. - index = find(isnan(y(:, j)); - if ~isempty(index) - mu(index, j) = mu(index, j) + noise.width/2; - L(index, j) = noise.gamman*cumGaussian(-mu(index, j).*c(index, j)) ... - + noise.gammap*cumGaussian((mu(index, j) - noise.width) .* c(index, j)); - end - % Highest category - index = find(y(:, j) == 1); - if ~isempty(index) - mu(index, j) = mu(index, j) - noise.width/2; - L(index, j) = cumGaussian(mu(index, j).*c(index, j)); - L(index,j) = L(index,j)*(1-noise.gammap); - end -end diff --git a/gpmnoise/ncnmNoiseLogLikelihood.m b/gpmnoise/ncnmNoiseLogLikelihood.m deleted file mode 100644 index a97f540c..00000000 --- a/gpmnoise/ncnmNoiseLogLikelihood.m +++ /dev/null @@ -1,53 +0,0 @@ -function L = ncnmNoiseLogLikelihood(noise, mu, varsigma, y) - -% NCNMNOISELOGLIKELIHOOD Log-likelihood of data under null category noise model. -% FORMAT -% DESC returns the log-likelihood of a set of targets under a given -% NCNM noise model with process mean and variances provided. -% ARG noise : the noise model structure. -% ARG mu : the mean input into the noise model. -% ARG sigma : the variance input into the noise model. -% ARG y : the targets whose likelihoods are being predicted. -% RETURN L : scalar value containing the log-likelihood of the targets. -% -% SEEALSO : noiseLogLikelihood, ncnmLikelihood -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005, 2006 - -% NOISE - -D = size(y, 2); -for i = 1:D - mu(:, i) = mu(:, i) + noise.bias(i); -end - -L = 0; -c = 1./sqrt(noise.sigma2 + varsigma); -for j = 1:D - % Do negative class first. - index = find(y(:, j) == -1); - if ~isempty(index) - mu(index, j) = mu(index, j) + noise.width/2; - L = L + sum(lnCumGaussian(-mu(index, j).*c(index, j))); - % account for observations of missingness variable. - L = L + log((1-noise.gamman))*length(index); - end - - % The null category. - index = find(isnan(y(:, j))); - if ~isempty(index) - mu(index, j) = mu(index, j) + noise.width/2; - u = mu(index, j).*c(index, j); - uprime = (mu(index, j) - noise.width).* c(index, j); - L = L + sum(lnCumGaussSum(-u, uprime, noise.gamman, noise.gammap)); - end - % The positive class. - index = find(y(:, j) == 1); - if ~isempty(index) - mu(index, j) = mu(index, j) - noise.width/2; - L = L + sum(lnCumGaussian(mu(index, j).*c(index, j))); - % account for observations of missingness variable. - L = L + log((1-noise.gammap))*length(index); - end -end - diff --git a/gpmnoise/ncnmNoiseNuG.m b/gpmnoise/ncnmNoiseNuG.m deleted file mode 100644 index e2bd36e9..00000000 --- a/gpmnoise/ncnmNoiseNuG.m +++ /dev/null @@ -1,33 +0,0 @@ -function [g, nu] = ncnmNoiseNuG(noise, mu, varSigma, y) - -% NCNMNOISENUG Update nu and g parameters associated with null category noise model. -% FORMAT -% DESC computes the values of nu and g for use in IVM style updated -% equations. These are also used in EP style update equations. This -% command just calls ncnmNoiseGradVals, but then ensures that there -% are no nu values less than 0. -% ARG noise : the noise model structure. -% ARG mu : the input means to the noise model. -% ARG sigma : the input variances to the noise model. -% ARG y : the targets for the noise model. -% RETURN nu : the updated value for nu. -% RETURN g : the updated value for g. -% -% SEEALSO : ncnmNoiseGradVals, noiseUpdateNuG, ncnmNoiseParamInit -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005, 2006 - -% NOISE - -[g, dlnZ_dvs] = feval([noise.type 'NoiseGradVals'], ... - noise, ... - mu, varSigma, ... - y); - -nu = g.*g - 2*dlnZ_dvs; - -% Reset any negative nu values to eps. -for i = 1:size(mu, 2) - index = find(nu(:, i)< eps); - nu(index) = eps; -end diff --git a/gpmnoise/ncnmNoiseOut.m b/gpmnoise/ncnmNoiseOut.m deleted file mode 100644 index a82c9ec8..00000000 --- a/gpmnoise/ncnmNoiseOut.m +++ /dev/null @@ -1,23 +0,0 @@ -function y = ncnmNoiseOut(noise, mu, varsigma) - -% NCNMNOISEOUT Ouput from null category noise model. -% FORMAT -% DESC Gives the most likely output for the null category noise -% model for a given set of input means and variances. -% ARG noise : the noise model structure for which the output is -% calculated. -% ARG mu : the set of input means. -% ARG sigma : the set of input variances. -% RETURN y : a set of labels given the input mean and variance. -% -% SEEALSO : noiseOut, ncnmNoiseLikelihood -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005, 2006 - -% NOISE - -D = size(mu, 2); -for i = 1:D - mu(:, i) = mu(:, i) + noise.bias(i); -end -y = sign(mu); diff --git a/gpmnoise/ncnmNoiseParamInit.m b/gpmnoise/ncnmNoiseParamInit.m deleted file mode 100644 index 7342eb1e..00000000 --- a/gpmnoise/ncnmNoiseParamInit.m +++ /dev/null @@ -1,62 +0,0 @@ -function noise = ncnmNoiseParamInit(noise, y) - -% NCNMNOISEPARAMINIT null category noise model's parameter initialisation. -% The null category noise model enables semi-supervised learning -% with Gaussian processes. The approach is described in a 2004 NIPS -% paper by Lawrence and Jordan. -% -% FORMAT -% DESC initialises the parameters of the null category noise model. -% ARG noise : the structure to initialise. -% ARG y : a set of target values. -% RETURN noise : the initialised noise structure. -% -% FORMAT -% DESC initialises the parameters of the null category noise model. -% ARG noise : the structure to initialise. -% RETURN noise : the initialised noise structure. -% -% SEEALSO : noiseParamInit, noiseCreate -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005, 2006 - -% NOISE - -% The likelihood is not log concave. -noise.logconcave = 0; -noise.gammaSplit = 0; - -if nargin > 1 - nClass1 = sum(y==1, 1); - nClass2 = sum(y==-1, 1); - totClass = nClass1 + nClass2; - p1 = nClass1./totClass; - noise.numProcess = size(y, 2); - noise.gamman = sum(isnan(y))/length(y); - noise.gammap = noise.gamman; - noise.bias = invCumGaussian(p1); -else - noise.bias = zeros(1, noise.numProcess); - noise.gamman = 0.5; - noise.gammap = 0.5; -end -if noise.gammaSplit - noise.nParams = noise.numProcess+2; -else - noise.nParams = noise.numProcess+1; -end - -% Constrain noise.prior to be between 0 and 1. -if noise.gammaSplit - noise.transforms.index = [noise.numProcess+1 noise.numProcess+2]; -else - noise.transforms.index = [noise.numProcess+1]; -end -noise.transforms.type = optimiDefaultConstraint('zeroone'); - -% This isn't optimised, it sets the gradient of the erf. -noise.sigma2 = eps; - -% Can handle missing values? -noise.missing = 1; -noise.width = 1; diff --git a/gpmnoise/ncnmNoisePointPlot.m b/gpmnoise/ncnmNoisePointPlot.m deleted file mode 100644 index de59e7e9..00000000 --- a/gpmnoise/ncnmNoisePointPlot.m +++ /dev/null @@ -1,26 +0,0 @@ -function h = ncnmNoisePointPlot(noise, X, y, ... - fontName, fontSize, ... - markerSize, lineWidth); - -% NCNMNOISEPOINTPLOT Plot the data-points for null category noise model. - -% NOISE - - -pointsNeg = plot(X(find(y(:, 1)==-1), 1), ... - X(find(y(:, 1)==-1), 2), ... - 'gx', 'erasemode', 'xor', ... - 'markersize', markerSize+2, ... - 'linewidth', lineWidth); -hold on -pointsPos = plot(X(find(y(:, 1)==1), 1), ... - X(find(y(:, 1)==1), 2), 'ro', ... - 'erasemode', 'xor', ... - 'markersize', markerSize, ... - 'linewidth', lineWidth); - -pointUn = plot(X(:, 1), ... - X(:, 2), 'm.', ... - 'erasemode', 'xor', 'markersize', markerSize/2); - -h = [pointsNeg; pointsPos; pointUn]; diff --git a/gpmnoise/ncnmNoiseSites.m b/gpmnoise/ncnmNoiseSites.m deleted file mode 100644 index 547217dc..00000000 --- a/gpmnoise/ncnmNoiseSites.m +++ /dev/null @@ -1,9 +0,0 @@ -function [m, beta] = ncnmNoiseSites(noise, g, nu, mu, varSigma, y) - -% NCNMNOISESITES Site updates for null category model. - -% NOISE - -% The standard code. -beta = nu./(1-nu.*varSigma); -m = mu + g./nu; diff --git a/gpmnoise/negNoiseGradientParam.m b/gpmnoise/negNoiseGradientParam.m deleted file mode 100644 index 1a8a936c..00000000 --- a/gpmnoise/negNoiseGradientParam.m +++ /dev/null @@ -1,13 +0,0 @@ -function g = negNoiseGradientParam(params, model, prior) - -% NEGNOISEGRADIENTPARAM Wrapper function for calling noise gradients. - -% NOISE - -model.noise = noiseExpandParam(model.noise, params); -fhandle = str2func([model.noise.type 'GradientParam']); -g = - fhandle(model); - -if prior - g = g + params; -end diff --git a/gpmnoise/negNoiseLogLikelihood.m b/gpmnoise/negNoiseLogLikelihood.m deleted file mode 100644 index 1f643461..00000000 --- a/gpmnoise/negNoiseLogLikelihood.m +++ /dev/null @@ -1,13 +0,0 @@ -function e = negNoiseLogLikelihood(params, model, prior) - -% NEGNOISELOGLIKELIHOOD Wrapper function for calling noise likelihoods. - -% NOISE - -model.noise = noiseExpandParam(model.noise, params); -fhandle = str2func([model.noise.type 'NoiseLogLikelihood']); -e = - fhandle([], [], model); - -if prior - e =e +0.5*params*params'; -end diff --git a/gpmnoise/ngaussNoise3dPlot.m b/gpmnoise/ngaussNoise3dPlot.m deleted file mode 100644 index a5cd090d..00000000 --- a/gpmnoise/ngaussNoise3dPlot.m +++ /dev/null @@ -1,21 +0,0 @@ -function gX = ngaussNoise3dPlot(noise, X) - -% NGAUSSNOISE3DPLOT Draws a 3D or contour plot for the NGAUSS noise model. -% FORMAT -% DESC draws a 3D or contour plot for the noiseless Gaussian noise model. -% ARG noise : the noise structure for which the plot is required. -% ARG plotType : string containing the name of the plotting function (for example mesh, contour). -% ARG X : the input X data in the form of a 'mesh' matrix. -% ARG Y : the input Y data in the form of a 'mesh' matrix. -% ARG mu : the input mean in the form of a 'mesh' matrix. -% ARG varSigma : the input variance in the form of a 'mesh' matrix. -% ARG P1, P2, P3 ... : optional additional arguments for the given plot type. -% RETURN h : the gradients of the diagonal with respect to each element -% of X. The returned matrix has the same dimensions as X. -% -% SEEALSO : ngaussNoiseParamInit, noise3dPlot, -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - diff --git a/gpmnoise/ngaussNoiseDisplay.m b/gpmnoise/ngaussNoiseDisplay.m deleted file mode 100644 index edae0b5f..00000000 --- a/gpmnoise/ngaussNoiseDisplay.m +++ /dev/null @@ -1,31 +0,0 @@ -function ngaussNoiseDisplay(noise) - - -% NGAUSSNOISEDISPLAY Display parameters of the NGAUSS noise. -% FORMAT -% DESC displays the parameters of the noiseless Gaussian -% noise and the noise type to the console. -% ARG noise : the noise to display. -% -% FORMAT does the same as above, but indents the display according -% to the amount specified. -% ARG noise : the noise to display. -% ARG spacing : how many spaces to indent the display of the noise by. -% -% SEEALSO : ngaussNoiseParamInit, modelDisplay, noiseDisplay -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -if nargin > 1 - spacing = repmat(32, 1, spacing); -else - spacing = []; -end -spacing = char(spacing); -for i = 1:noise.numProcess - fprintf(spacing) - fprintf('Noiseless Gaussian bias on process %d: %2.4f\n', i, noise.bias(i)) -end diff --git a/gpmnoise/ngaussNoiseExpandParam.m b/gpmnoise/ngaussNoiseExpandParam.m deleted file mode 100644 index 2054e3ba..00000000 --- a/gpmnoise/ngaussNoiseExpandParam.m +++ /dev/null @@ -1,24 +0,0 @@ -function noise = ngaussNoiseExpandParam(noise, params) - - -% NGAUSSNOISEEXPANDPARAM Create noise structure from NGAUSS noise's parameters. -% FORMAT -% DESC returns a noiseless Gaussian noise structure filled with the -% parameters in the given vector. This is used as a helper function to -% enable parameters to be optimised in, for example, the NETLAB -% optimisation functions. -% ARG noise : the noise structure in which the parameters are to be -% placed. -% ARG param : vector of parameters which are to be placed in the -% noise structure. -% RETURN noise : noise structure with the given parameters in the -% relevant locations. -% -% SEEALSO : ngaussNoiseParamInit, ngaussNoiseExtractParam, noiseExpandParam -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -noise.bias = params(1:end); diff --git a/gpmnoise/ngaussNoiseExtractParam.m b/gpmnoise/ngaussNoiseExtractParam.m deleted file mode 100644 index 5bed472f..00000000 --- a/gpmnoise/ngaussNoiseExtractParam.m +++ /dev/null @@ -1,41 +0,0 @@ -function [params, names] = ngaussNoiseExtractParam(noise) - - -% NGAUSSNOISEEXTRACTPARAM Extract parameters from the NGAUSS noise structure. -% FORMAT -% DESC extracts parameters from the noiseless Gaussian -% noise structure into a vector of parameters for optimisation. -% ARG noise : the noise structure containing the parameters to be -% extracted. -% RETURN param : vector of parameters extracted from the noise. If -% the field 'transforms' is not empty in the noise structure, the -% parameters will be transformed before optimisation (for example -% positive only parameters could be logged before being returned). -% -% FORMAT -% DESC extracts parameters and parameter names from the noiseless Gaussian -% noise structure. -% ARG noise : the noise structure containing the parameters to be -% extracted. -% RETURN param : vector of parameters extracted from the noise. If -% the field 'transforms' is not empty in the noise structure, the -% parameters will be transformed before optimisation (for example -% positive only parameters could be logged before being returned). -% RETURN names : cell array of strings containing names for each -% parameter. -% -% SEEALSO ngaussNoiseParamInit, ngaussNoiseExpandParam, noiseExtractParam, scg, conjgrad -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 -% -% NOISE - - -params = [noise.bias]; - - -if nargout > 1 - for i = 1:noise.numProcess - names{i} = ['bias ' num2str(i)]; - end -end diff --git a/gpmnoise/ngaussNoiseGradVals.m b/gpmnoise/ngaussNoiseGradVals.m deleted file mode 100644 index 7b479a05..00000000 --- a/gpmnoise/ngaussNoiseGradVals.m +++ /dev/null @@ -1,25 +0,0 @@ -function [dlnZ_dmu, dlnZ_dvs] = ngaussNoiseGradVals(noise, mu, varsigma, y) - - -% NGAUSSNOISEGRADVALS Gradient of NGAUSS noise log Z with respect to input mean and variance. -% FORMAT -% DESC computes the gradient of the noiseless Gaussian -% noise with respect to the input mean and the input variance. -% ARG noise : noise structure for which gradients are being -% computed. -% ARG mu : mean input locations with respect to which gradients are -% being computed. -% ARG varSigma : variance input locations with respect to which -% gradients are being computed. -% ARG y : noise model output observed values associated with the given points. -% RETURN dlnZ_dmu : the gradient of log Z with respect to the input mean. -% RETURN dlnZ_dvs : the gradient of log Z with respect to the input variance. -% -% SEEALSO ngaussNoiseParamInit, ngaussNoiseGradientParam, noiseGradVals, -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -[dlnZ_dmu, dlnZ_dvs] = gaussianNoiseGradVals(noise, mu, varsigma, y); diff --git a/gpmnoise/ngaussNoiseGradientParam.m b/gpmnoise/ngaussNoiseGradientParam.m deleted file mode 100644 index 76d821f1..00000000 --- a/gpmnoise/ngaussNoiseGradientParam.m +++ /dev/null @@ -1,37 +0,0 @@ -function g = ngaussNoiseGradientParam(noise, mu, varsigma, y) - - -% NGAUSSNOISEGRADIENTPARAM Gradient of NGAUSS noise's parameters. -% FORMAT -% DESC computes the gradient of the log Z of the noiseless Gaussian noise model with respect to the of functions with respect to the -% noiseless Gaussian -% noise's parameters. -% ARG noise : the noise structure for which the gradients are being -% computed. -% ARG mu : the input means for which the gradients are being computed. -% ARG varSigma : the input variances for which the gradients are being computed. -% ARG y : the target values for the noise model. -% RETURN g : gradients of the log Z with respect to -% the noise parameters. The ordering of the vector should match -% that provided by the function noiseExtractParam. -% -% -% SEEALSO ngaussNoiseParamInit, ngaussnoiseGradVals, noiseGradientParam -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -D = size(y, 2); -u = zeros(size(y)); - -for i = 1:D - mu(:, i) = mu(:, i) + noise.bias(i); -end - -u = y - mu; -nu = 1./(varsigma+noise.sigma2); -u = u.*nu; -gbias = sum(u, 1); -g = [gbias]; diff --git a/gpmnoise/ngaussNoiseLikelihood.m b/gpmnoise/ngaussNoiseLikelihood.m deleted file mode 100644 index 8d1a344d..00000000 --- a/gpmnoise/ngaussNoiseLikelihood.m +++ /dev/null @@ -1,19 +0,0 @@ -function L = ngaussNoiseLikelihood(noise, mu, varsigma, y) - - -% NGAUSSNOISELIKELIHOOD Likelihood of the data under the NGAUSS noise model. -% FORMAT -% DESC returns the likelihood of a data set under the noiseless Gaussian noise model. -% ARG noise : the noise structure for which the likelihood is required. -% ARG mu : input mean locations for the likelihood. -% ARG varSigma : input variance locations for the likelihood. -% ARG y : target locations for the likelihood. -% -% SEEALSO : ngaussNoiseParamInit, ngaussNoiseLogLikelihood, noiseLikelihood -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -L = gaussianNoiseLikelihood(noise, mu, varsigma, y); diff --git a/gpmnoise/ngaussNoiseLogLikelihood.m b/gpmnoise/ngaussNoiseLogLikelihood.m deleted file mode 100644 index 5389aa53..00000000 --- a/gpmnoise/ngaussNoiseLogLikelihood.m +++ /dev/null @@ -1,19 +0,0 @@ -function L = ngaussNoiseLogLikelihood(noise, mu, varsigma, y) - - -% NGAUSSNOISELOGLIKELIHOOD Log likelihood of the data under the NGAUSS noise model. -% FORMAT -% DESC returns the log likelihood of a data set under the noiseless Gaussian noise model. -% ARG noise : the noise structure for which the log likelihood is required. -% ARG mu : input mean locations for the log likelihood. -% ARG varSigma : input variance locations for the log likelihood. -% ARG y : target locations for the log likelihood. -% -% SEEALSO : ngaussNoiseParamInit, ngaussNoiseLikelihood, noiseLogLikelihood -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -L = gaussianNoiseLogLikelihood(noise, mu, varsigma, y); diff --git a/gpmnoise/ngaussNoiseNuG.m b/gpmnoise/ngaussNoiseNuG.m deleted file mode 100644 index f0426f86..00000000 --- a/gpmnoise/ngaussNoiseNuG.m +++ /dev/null @@ -1,10 +0,0 @@ -function [g, nu] = ngaussNoiseNuG(noise, mu, varSigma, y) - -% NGAUSSNOISENUG Update nu and g parameters associated with noiseless Gaussian noise model. - -% NOISE - -% NOISE - - -[g, nu] = gaussianNoiseNuG(noise, mu, varSigma, y); diff --git a/gpmnoise/ngaussNoiseOut.m b/gpmnoise/ngaussNoiseOut.m deleted file mode 100644 index 61158f71..00000000 --- a/gpmnoise/ngaussNoiseOut.m +++ /dev/null @@ -1,20 +0,0 @@ -function y = ngaussNoiseOut(noise, mu, varsigma) - - -% NGAUSSNOISEOUT Compute the output of the NGAUSS noise given the input mean and variance. -% FORMAT -% DESC computes the ouptut for the noiseless Gaussian -% noise given input mean and variances. -% ARG noise : the noise structure for which the output is computed. -% ARG mu : the input mean values. -% ARG varSigma : the input variance values. -% RETURN y : the output from the noise model. -% -% SEEALSO : ngaussNoiseParamInit, noiseOut, noiseCreate, -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -y = gaussianNoiseOut(noise, mu, varsigma); diff --git a/gpmnoise/ngaussNoiseParamInit.m b/gpmnoise/ngaussNoiseParamInit.m deleted file mode 100644 index 8ca20cf3..00000000 --- a/gpmnoise/ngaussNoiseParamInit.m +++ /dev/null @@ -1,33 +0,0 @@ -function noise = ngaussNoiseParamInit(noise, y) - - -% NGAUSSNOISEPARAMINIT NGAUSS noise parameter initialisation. -% FORMAT -% DESC initialises the noiseless Gaussian -% noise structure with some default parameters. -% ARG noise : the noise structure which requires initialisation. -% RETURN noise : the noise structure with the default parameters placed in. -% -% SEEALSO : noiseCreate, noiseParamInit -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -if nargin > 1 - noise.bias = mean(y); - noise.numProcess = size(y, 2); -else - noise.bias = zeros(1, noise.numProcess); -end - -noise.sigma2 = 1e-6; - -noise.nParams = noise.numProcess; - -% Can handle missing values? -noise.missing = 0; - -% Noise model leads to constant value of beta. -noise.spherical = 1; diff --git a/gpmnoise/ngaussNoisePointPlot.m b/gpmnoise/ngaussNoisePointPlot.m deleted file mode 100644 index b7c603ce..00000000 --- a/gpmnoise/ngaussNoisePointPlot.m +++ /dev/null @@ -1,20 +0,0 @@ -function h = ngaussNoisePointPlot(noise, X, y, fontName, fontSize, markerSize, lineWidth) - -% NGAUSSNOISEPOINTPLOT Plot the data-points for the NGAUSS noise model. -% FORMAT -% DESC plots the data point locations for the noiseless Gaussian -% noise structure. -% ARG noise : the noise structure which is to be plotted. -% ARG X : input locations to be plotted. -% ARG y : target locations to be plotted. -% ARG fontName : name of any fonts to be used. -% ARG fontSize : size of any fonts to be used. -% ARG markerSize : size of the makers to be used. -% ARG lineWidth : size of any lines to be plotted. -% -% SEEALSO : ngaussNoiseParamInit, noisePointPlot -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - diff --git a/gpmnoise/ngaussNoiseSites.m b/gpmnoise/ngaussNoiseSites.m deleted file mode 100644 index 35cad653..00000000 --- a/gpmnoise/ngaussNoiseSites.m +++ /dev/null @@ -1,10 +0,0 @@ -function [m, beta] = ngaussNoiseSites(noise, g, nu, mu, varSigma, y) - -% NGAUSSNOISESITES Site updates for noiseless Gaussian noise model. - -% NOISE - -% NOISE - - -[m, beta] = gaussianNoiseSites(noise, g, nu, mu, varSigma, y); diff --git a/gpmnoise/noise3dPlot.m b/gpmnoise/noise3dPlot.m deleted file mode 100644 index 2c4bf39f..00000000 --- a/gpmnoise/noise3dPlot.m +++ /dev/null @@ -1,27 +0,0 @@ -function h = noise3dPlot(noise, plotType, CX, CY, CZ, CZVar, varargin) - -% NOISE3DPLOT Draw a 3D or contour plot for the relevant noise model. -% FORMAT -% DESC draws a 3D or contour plot for the relevant noise model. -% ARG noise : the noise structure for which the plot is required. -% ARG plotType : string containing the name of the plotting function (for example mesh, contour). -% ARG X : the input X data in the form of a 'mesh' matrix. -% ARG Y : the input Y data in the form of a 'mesh' matrix. -% ARG mu : the input mean in the form of a 'mesh' matrix. -% ARG varSigma : the input variance in the form of a 'mesh' matrix. -% ARG P1, P2, P3 ... : optional additional arguments for the given plot type. -% RETURN h : the gradients of the diagonal with respect to each element -% of X. The returned matrix has the same dimensions as X. -% -% SEEALSO : noiseParamInit, noise3dPlot, -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - -functionName = [noise.type 'Noise3dPlot']; -if exist(functionName) == 2 - fhandle = str2func(functionName); - h = fhandle(noise, plotType, CX, CY, CZ, CZVar, varargin{:}); -end - diff --git a/gpmnoise/noiseCreate.m b/gpmnoise/noiseCreate.m deleted file mode 100644 index 1a6eae70..00000000 --- a/gpmnoise/noiseCreate.m +++ /dev/null @@ -1,55 +0,0 @@ -function noise = noiseCreate(noiseType, y) - -% NOISECREATE Initialise a noise structure. -% FORMAT -% DESC takes a noise type and a target vector and initialises a -% noise structure from it. The parameters of the noise structure -% are the set by calling noiseParamInit. -% ARG noiseType : the type of noise to be created (e.g. 'gaussian', -% 'probit', 'ncnm'). -% ARG y : the target vector. -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 -% -% SEEALSO : noiseParamInit - -% NOISE - -if isstruct(noiseType) - noise = noiseType; - return -elseif iscell(noiseType) - % compound noise type - noise.type = 'cmpnd'; - if nargin > 1 - for i = 1:length(noiseType) - noise.comp{i} = noiseCreate(noiseType{i}, y(:, i)); - end - else - for i = 1:length(noiseType) - noise.comp{i} = noiseCreate(noiseType{i}); - end - end -else - noise.type = noiseType; -end - - -if nargin>1 - noise = noiseParamInit(noise, y); -end - - -% Check if the noise model has bespoke site update code -if exist([noise.type 'NoiseSites'])==2 - noise.updateSites = 1; -else - noise.updateSites = 0; -end - -% Check if the model has bespoke nu and g update code. -if exist([noise.type 'NoiseNuG'])==2 - noise.updateNuG = 1; -else - noise.updateNuG = 0; -end diff --git a/gpmnoise/noiseDisplay.m b/gpmnoise/noiseDisplay.m deleted file mode 100644 index 1afb2f59..00000000 --- a/gpmnoise/noiseDisplay.m +++ /dev/null @@ -1,17 +0,0 @@ -function noiseDisplay(noise, varargin) - -% NOISEDISPLAY Display the parameters of the noise model. -% FORMAT -% DESC display the type of noise model and any associated -% parameters. -% ARG noise : noise model to display. -% ARG spacing : any spacing to place before the noise model. -% -% SEEALSO modelDisplay -% -% COPYRIGHT : Neil D. Lawrence, 2005 - -% NOISE - -fhandle = str2func([noise.type 'NoiseDisplay']); -fhandle(noise, varargin{:}); diff --git a/gpmnoise/noiseExpandParam.m b/gpmnoise/noiseExpandParam.m deleted file mode 100644 index 98a8a118..00000000 --- a/gpmnoise/noiseExpandParam.m +++ /dev/null @@ -1,30 +0,0 @@ -function noise = noiseExpandParam(noise, params) - -% NOISEEXPANDPARAM Expand the noise model's parameters from params vector. -% FORMAT -% DESC returns a noise structure filled with the -% parameters in the given vector. This is used as a helper function to -% enable parameters to be optimised in, for example, the NETLAB -% optimisation functions. -% ARG noise : the noise structure in which the parameters are to be -% placed. -% ARG param : vector of parameters which are to be placed in the -% noise structure. -% RETURN noise : noise structure with the given parameters in the -% relevant locations. -% -% SEEALSO : noiseParamInit, noiseExtractParam -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - -if isfield(noise, 'transforms') - for i = 1:length(noise.transforms) - index = noise.transforms(i).index; - fhandle = str2func([noise.transforms(i).type 'Transform']); - params(index) = fhandle(params(index), 'atox'); - end -end -fhandle = str2func([noise.type 'NoiseExpandParam']); -noise = fhandle(noise, params); diff --git a/gpmnoise/noiseExpectationLogLikelihood.m b/gpmnoise/noiseExpectationLogLikelihood.m deleted file mode 100644 index 8e242e1d..00000000 --- a/gpmnoise/noiseExpectationLogLikelihood.m +++ /dev/null @@ -1,21 +0,0 @@ -function L = noiseExpectationLogLikelihood(noise, mu, varsigma, y); - -% NOISEEXPECTATIONLOGLIKELIHOOD Return the expectation of the log likelihood. -% FORMAT -% DESC returns the expectation of the log likelihood for a gven noise model. -% ARG noise : the noise structure for which the expectation of the log -% likelihood is required. -% ARG mu : input mean locations for the likelihood. -% ARG varSigma : input variance locations for the likelihood. -% ARG y : target locations for the likelihood. -% -% SEEALSO : noiseParamInit, noiseLogLikelihood -% -% COPYRIGHT : Neil D. Lawrence, 2007 - -% NOISE - -fhandle = str2func([noise.type 'NoiseExpectationLogLikelihood']); -L = fhandle(noise, mu, varsigma, y); - - diff --git a/gpmnoise/noiseExtractParam.m b/gpmnoise/noiseExtractParam.m deleted file mode 100644 index fed01fd4..00000000 --- a/gpmnoise/noiseExtractParam.m +++ /dev/null @@ -1,47 +0,0 @@ -function [params, names] = noiseExtractParam(noise) - -% NOISEEXTRACTPARAM Extract the noise model's parameters. -% FORMAT -% DESC extracts parameters from the given -% noise structure into a vector of parameters for optimisation. -% ARG noise : the noise structure containing the parameters to be -% extracted. -% RETURN param : vector of parameters extracted from the noise. If -% the field 'transforms' is not empty in the noise structure, the -% parameters will be transformed before optimisation (for example -% positive only parameters could be logged before being returned). -% -% FORMAT -% DESC extracts parameters and parameter names from the given -% noise structure. -% ARG noise : the noise structure containing the parameters to be -% extracted. -% RETURN param : vector of parameters extracted from the noise. If -% the field 'transforms' is not empty in the noise structure, the -% parameters will be transformed before optimisation (for example -% positive only parameters could be logged before being returned). -% RETURN names : cell array of strings containing names for each -% parameter. -% -% SEEALSO noiseParamInit, noiseExpandParam, scg, conjgrad -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - -fhandle = str2func([noise.type 'NoiseExtractParam']); -if nargout < 2 - params = fhandle(noise); -else - [params, names] = fhandle(noise); -end - - -% Check if parameters are being optimised in a transformed space. -if isfield(noise, 'transforms') - for i = 1:length(noise.transforms) - index = noise.transforms(i).index; - fhandle = str2func([noise.transforms(i).type 'Transform']); - params(index) = fhandle(params(index), 'xtoa'); - end -end diff --git a/gpmnoise/noiseGradVals.m b/gpmnoise/noiseGradVals.m deleted file mode 100644 index e8fd5726..00000000 --- a/gpmnoise/noiseGradVals.m +++ /dev/null @@ -1,33 +0,0 @@ -function [dlnZ_dmu, dlnZ_dvs] = noiseGradVals(noise, mu, varsigma, y) - -% NOISEGRADVALS Gradient of noise model wrt mu and varsigma. -% FORMAT -% DESC computes the gradient of the given -% noise with respect to the input mean and the input variance. -% ARG noise : noise structure for which gradients are being -% computed. -% ARG mu : mean input locations with respect to which gradients are -% being computed. -% ARG varSigma : variance input locations with respect to which -% gradients are being computed. -% ARG y : noise model output observed values associated with the given points. -% RETURN dlnZ_dmu : the gradient of log Z with respect to the input mean. -% RETURN dlnZ_dvs : the gradient of log Z with respect to the input variance. -% -% SEEALSO noiseCreate, noiseParamInit, noiseGradientParam -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - -fhandle = str2func([noise.type 'NoiseGradVals']); -[dlnZ_dmu, dlnZ_dvs] = fhandle(noise, mu, ... - varsigma, y); -%/~ -if any(isnan(dlnZ_dmu)) - warning('Gradient of mu is NaN') -end -if any(isnan(dlnZ_dvs)) - warning('Gradient of varsigma is NaN') -end -%~/ diff --git a/gpmnoise/noiseGradX.m b/gpmnoise/noiseGradX.m deleted file mode 100644 index 3b3b81d3..00000000 --- a/gpmnoise/noiseGradX.m +++ /dev/null @@ -1,8 +0,0 @@ -function g = noiseGradX(noise, mu, varsigma, dmu, dvs, y); - -% NOISEGRADX Returns the gradient of the log-likelihood wrt x. - -% NOISE - -[dlnZ_dmu, dlnZ_dvs] = noiseGradVals(noise, mu, varsigma, y); -g = dlnZ_dmu*dmu' + dlnZ_dvs*dvs'; diff --git a/gpmnoise/noiseGradientParam.m b/gpmnoise/noiseGradientParam.m deleted file mode 100644 index 32965065..00000000 --- a/gpmnoise/noiseGradientParam.m +++ /dev/null @@ -1,44 +0,0 @@ -function g = noiseGradientParam(noise, mu, varsigma, y) - -% NOISEGRADIENTPARAM Gradient wrt the noise model's parameters. -% FORMAT -% DESC computes the gradient of the log Z of the given noise model -% with respect to the of functions with respect to the given -% noise model's parameters. -% ARG noise : the noise structure for which the gradients are being -% computed. -% ARG mu : the input means for which the gradients are being computed. -% ARG varSigma : the input variances for which the gradients are being computed. -% ARG y : the target values for the noise model. -% RETURN g : gradients of the log probability with respect to -% the noise parameters. The ordering of the vector should match -% that provided by the function noiseExtractParam. -% -% -% SEEALSO noiseCreate, noiseParamInit, noiseGradVals, noiseGradientParam -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - -fhandle = str2func([noise.type 'NoiseGradientParam']); -g = fhandle(noise, mu, varsigma, y); - -% check if there is a prior over parameters -if isfield(noise, 'priors') - for i = 1:length(noise.priors) - index = noise.priors(i).index; - g(index) = g(index) + priorGradient(noise.priors(i), params(index)); - end -end - -% Check if parameters are being optimised in a transformed space. -if isfield(noise, 'transforms') - fhandle = str2func([noise.type 'NoiseExtractParam']); - params = fhandle(noise); - for i = 1:length(noise.transforms) - index = noise.transforms(i).index; - fhandle = str2func([noise.transforms(i).type 'Transform']); - g(index) = g(index).*fhandle(params(index), 'gradfact'); - end -end diff --git a/gpmnoise/noiseLikelihood.m b/gpmnoise/noiseLikelihood.m deleted file mode 100644 index 311766ad..00000000 --- a/gpmnoise/noiseLikelihood.m +++ /dev/null @@ -1,18 +0,0 @@ -function L = noiseLikelihood(noise, mu, varsigma, y); - -% NOISELIKELIHOOD Return the likelihood for each point under the noise model. -% FORMAT -% DESC returns the likelihoods for data points under the given noise model. -% ARG noise : the noise structure for which the likelihood is required. -% ARG mu : input mean locations for the likelihood. -% ARG varSigma : input variance locations for the likelihood. -% ARG y : target locations for the likelihood. -% -% SEEALSO : noiseParamInit, noiseLogLikelihood -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - -fhandle = str2func([noise.type 'NoiseLikelihood']); -L = fhandle(noise, mu, varsigma, y); diff --git a/gpmnoise/noiseLogLikelihood.m b/gpmnoise/noiseLogLikelihood.m deleted file mode 100644 index 22fb3f37..00000000 --- a/gpmnoise/noiseLogLikelihood.m +++ /dev/null @@ -1,29 +0,0 @@ -function L = noiseLogLikelihood(noise, mu, varsigma, y); - -% NOISELOGLIKELIHOOD Return the log-likelihood under the noise model. -% FORMAT -% DESC returns the log likelihood of a data set under the given noise model. -% ARG noise : the noise structure for which the log likelihood is required. -% ARG mu : input mean locations for the log likelihood. -% ARG varSigma : input variance locations for the log likelihood. -% ARG y : target locations for the log likelihood. -% -% SEEALSO : noiseParamInit, noiseLikelihood -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - -fhandle = str2func([noise.type 'NoiseLogLikelihood']); -L = fhandle(noise, mu, varsigma, y); - - -% check if there is a prior over parameters -if isfield(noise, 'priors') - fhandle = str2func([noise.type 'NoiseExpandParams']); - params = fhandle(noise); - for i = 1:length(noise.priors) - index = noise.priors(i).index; - L = L + priorLogProb(noise.priors(i), params(index)); - end -end diff --git a/gpmnoise/noiseOut.m b/gpmnoise/noiseOut.m deleted file mode 100644 index 08780510..00000000 --- a/gpmnoise/noiseOut.m +++ /dev/null @@ -1,19 +0,0 @@ -function y = noiseOut(noise, mu, varsigma); - -% NOISEOUT Give the output of the noise model given the mean and variance. -% FORMAT -% DESC computes the ouptut for the given -% noise given input mean and variances. -% ARG noise : the noise structure for which the output is computed. -% ARG mu : the input mean values. -% ARG varSigma : the input variance values. -% RETURN y : the output from the noise model. -% -% SEEALSO : noiseParamInit, noiseCreate -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - -fhandle = str2func([noise.type 'NoiseOut']); -y = fhandle(noise, mu, varsigma); diff --git a/gpmnoise/noiseParamInit.m b/gpmnoise/noiseParamInit.m deleted file mode 100644 index f9c9a395..00000000 --- a/gpmnoise/noiseParamInit.m +++ /dev/null @@ -1,28 +0,0 @@ -function noise = noiseParamInit(noise, y) - -% NOISEPARAMINIT Noise model's parameter initialisation. -% FORMAT -% DESC initialises the -% noise structure with some default parameters. -% ARG noise : the noise structure which requires initialisation. -% RETURN noise : the noise structure with the default parameters placed in. -% -% SEEALSO : noiseCreate -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - -% If this flag is set then the noise model leads to constant values of -% beta (e.g. a Gaussian with constant variance for each data-point & -% dimension). The default setting is set here as false. - -noise.spherical = 0; -noise.logconcave = 1; - -fhandle = str2func([noise.type 'NoiseParamInit']); -if nargin > 1 - noise = fhandle(noise, y); -else - noise = fhandle(noise); -end diff --git a/gpmnoise/noisePointPlot.m b/gpmnoise/noisePointPlot.m deleted file mode 100644 index a7ca1cab..00000000 --- a/gpmnoise/noisePointPlot.m +++ /dev/null @@ -1,29 +0,0 @@ -function h = noisePointPlot(noise, X, y, ... - fontName, fontSize, ... - markerSize, lineWidth) - -% NOISEPOINTPLOT Plot the data-points for the given noise model. -% FORMAT -% DESC plots the data point locations for the given -% noise structure. -% ARG noise : the noise structure which is to be plotted. -% ARG X : input locations to be plotted. -% ARG y : target locations to be plotted. -% ARG fontName : name of any fonts to be used. -% ARG fontSize : size of any fonts to be used. -% ARG markerSize : size of the makers to be used. -% ARG lineWidth : size of any lines to be plotted. -% -% SEEALSO : noiseParamInit, noiseCreate -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - -fhandle = str2func([noise.type 'NoisePointPlot']); -h = fhandle(noise, X, y, ... - fontName, fontSize, ... - markerSize, lineWidth); -if ~isoctave - set(gca, 'fontname', fontName, 'fontsize', fontSize); -end diff --git a/gpmnoise/noiseReadFromFID.m b/gpmnoise/noiseReadFromFID.m deleted file mode 100644 index ef8070ce..00000000 --- a/gpmnoise/noiseReadFromFID.m +++ /dev/null @@ -1,18 +0,0 @@ -function noise = noiseReadFromFID(FID) - -% NOISEREADFROMFID Load from an FID written by the C++ implementation. -% FORMAT -% DESC reads a noise structure from a file stream created by the -% C++ implementation of the noises. -% ARG FID : the file stream ID. -% ARG noise : the noise structure created. -% -% COPYRIGHT : Neil D. Lawrence, 2005, 2008 -% -% SEEALSO : modelReadFromFID, noiseCreate, noiseReadParamsFromFID - -% NOISE - -type = readStringFromFID(FID, 'type'); -noise = noiseReadParamsFromFID(type, FID); - diff --git a/gpmnoise/noiseReadParamsFromFID.m b/gpmnoise/noiseReadParamsFromFID.m deleted file mode 100644 index 774852ee..00000000 --- a/gpmnoise/noiseReadParamsFromFID.m +++ /dev/null @@ -1,27 +0,0 @@ -function noise = noiseReadParamsFromFID(type, FID) - -% NOISEREADPARAMSFROMFID Read the noise parameters from C++ file FID. -% FORMAT -% DESC reads noise parameters from a C++ file stream and returns them in -% the appropriate noise structure. -% ARG type : the type of noise structure that is being read. -% ARG FID : the file ID of the stream that is being read. -% RETURN noise : the noise structure containing the parameters. -% -% COPYRIGHT : Neil D. Lawrence, 2005, 2008 -% -% SEEALSO : noiseReadFromFID - -% NOISE - -noise.numProcess = readIntFromFID(FID, 'outputDim'); -noise.nParams = readIntFromFID(FID, 'numParams'); -noise.type = type; - -if strcmp(type, 'ncnm') - noise.gammaSplit = readIntFromFID(FID, 'gammaSplit'); -end -noise = noiseParamInit(noise); -params = modelReadFromFID(FID); -fhandle = str2func([noise.type 'NoiseExpandParam']); -noise = fhandle(noise, params); diff --git a/gpmnoise/noiseTest.m b/gpmnoise/noiseTest.m deleted file mode 100644 index 111af168..00000000 --- a/gpmnoise/noiseTest.m +++ /dev/null @@ -1,142 +0,0 @@ -function noise = noiseTest(noiseType); - -% NOISETEST Run some tests on the specified noise model. - -% NOISE - -if iscell(noiseType) - % compound noise type - noise.type = 'cmpnd'; - for i = 1:length(noiseType) - noise.comp{i}.type = noiseType{i}; - end -else - noise.type = noiseType; -end -noise.numProcess = 3; -numData = 20; - -noise.C = 10; -noise.numData = numData; -noise = noiseParamInit(noise); -% Set the parameters randomly. -params = noiseExtractParam(noise); -params = randn(size(params))./sqrt(randn(size(params)).^2); -noise = noiseExpandParam(noise, params); - -mu = randn(numData, noise.numProcess).*sqrt(1./(randn(numData,noise.numProcess).^2)); - -varsigma1 = 1./(randn(numData, noise.numProcess).^2); -varsigma2 = (randn(numData, noise.numProcess).^2); -varsigmaSwitch = rand(numData, noise.numProcess)> 0.5; -varsigma = varsigmaSwitch.*varsigma1 + (1-varsigmaSwitch).*varsigma2; -y = noiseOut(noise, mu, varsigma); - -mu = randn(numData, noise.numProcess).*sqrt(1./(randn(numData,noise.numProcess).^2)); - -varsigma1 = 1./(randn(numData, noise.numProcess).^2); -varsigma2 = (randn(numData, noise.numProcess).^2); -varsigmaSwitch = rand(numData, noise.numProcess)> 0.5; -varsigma = varsigmaSwitch.*varsigma1 + (1-varsigmaSwitch).*varsigma2; - -% Test for missing variables -if noise.missing - index = randperm(size(y, 1)*size(y, 2)); - index = index(1:3); - y(index) = NaN; -end - -fprintf('mu values\n'); -disp(mu) -fprintf('varsigma values\n'); -disp(varsigma) -fprintf('y values\n'); -disp(y) -epsilon = 1e-6; -params = noiseExtractParam(noise); -origParams = params; -for i = 1:length(params); - params = origParams; - params(i) = origParams(i) + epsilon; - noise = noiseExpandParam(noise, params); - Lplus(i) = noiseLogLikelihood(noise, mu, varsigma, y); - params(i) = origParams(i) - epsilon; - noise = noiseExpandParam(noise, params); - Lminus(i) = noiseLogLikelihood(noise, mu, varsigma, y); -end -params = origParams; -noise = noiseExpandParam(noise, params); -[void, names] = noiseExtractParam(noise); -gLDiff = .5*(Lplus - Lminus)/epsilon; -g = noiseGradientParam(noise, mu, varsigma, y); - -paramMaxDiff = max(max(abs(gLDiff-g))); -if paramMaxDiff > 2*epsilon - l = 0; - for i = 1:length(names) - if l < length(names{i}) - l = length(names{i}); - end - end - - fprintf([char(repmat(32, 1, l)) '\tanalytic diffs delta\n']); - for i = 1:length(names) - spaceLen = l - length(names{i}); - space = char(repmat(32, 1, spaceLen)); - fprintf([space names{i} ':\t%4.6f\t%4.6f\t%4.6f\n'], ... - g(i), gLDiff(i), gLDiff(i) - g(i)); - end -end -Lplus = zeros(size(mu)); -Lminus = zeros(size(mu)); -origMu = mu; -for i = 1:size(mu, 1) - for j = 1:size(mu, 2) - mu = origMu; - mu(i, j) = origMu(i, j) + epsilon; - Lplus(i, j) = noiseLogLikelihood(noise, mu, varsigma, y); - mu(i, j) = origMu(i, j) - epsilon; - Lminus(i, j) = noiseLogLikelihood(noise, mu, varsigma, y); - end -end -mu = origMu; -gMuDiff = .5*(Lplus - Lminus)/epsilon; - -Lplus = zeros(size(varsigma)); -Lminus = zeros(size(varsigma)); -origVarsigma = varsigma; -for i = 1:size(varsigma, 1) - for j = 1:size(varsigma, 2) - varsigma = origVarsigma; - varsigma(i, j) = origVarsigma(i, j) + epsilon; - Lplus(i, j) = noiseLogLikelihood(noise, mu, varsigma, y); - varsigma(i, j) = origVarsigma(i, j) - epsilon; - Lminus(i, j) = noiseLogLikelihood(noise, mu, varsigma, y); - end -end -varsigma = origVarsigma; -gVarsigmaDiff = .5*(Lplus - Lminus)/epsilon; - - -[g, gvs] = noiseGradVals(noise, mu, varsigma, y); - -vsMaxDiff = max(max(abs(gvs-gVarsigmaDiff))); -muMaxDiff = max(max(abs(g-gMuDiff))); - -if vsMaxDiff > 1e-7 - fprintf('y\n') - disp(y) - fprintf('varsigma\n') - disp(varsigma) - fprintf('mu\n') - disp(mu) - fprintf('gvs\n') - disp(gvs) - fprintf('diffs vs\n') - disp(gVarsigmaDiff) - fprintf('gvs -diffvgs\n') - disp(gvs -gVarsigmaDiff) -end -fprintf('Param max diff: %2.6f.\n', paramMaxDiff) -fprintf('Mu max diff: %2.6f.\n', muMaxDiff) -fprintf('Varsigma max diff: %2.6f.\n', vsMaxDiff) diff --git a/gpmnoise/noiseUpdateNuG.m b/gpmnoise/noiseUpdateNuG.m deleted file mode 100644 index 4ce7871e..00000000 --- a/gpmnoise/noiseUpdateNuG.m +++ /dev/null @@ -1,31 +0,0 @@ -function [g, nu] = noiseUpdateNuG(noise, mu, varSigma, y); - -% NOISEUPDATENUG Update nu and g for a given noise model. -% FORMAT -% DESC computes the values nu and g for the given noise given the mean and variance inputs as well as the output of the noise model. -% ARG noise : the noise structure for which the nu and g are computed. -% ARG mu : input mean to the noise model. -% ARG varSigma : input variance to the noise model. -% ARG y : target output for the noise model. -% RETURN g : the vector g, which is the gradient of log Z with respect to the input mean. -% ARG y : target output for the noise model. -% RETURN nu : the vector nu, see equation 10 of "Extensions of the Informative Vector Machine". -% -% SEEALSO : noiseParamInit, noiseUpdateSites, noiseCreate -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - -if noise.updateNuG - % The noise model has it's own code for site updates. - fhandle = str2func([noise.type 'NoiseNuG']); - [g, nu] = fhandle(noise, mu, varSigma, y); -else - % Use the standard (general) code. - fhandle = str2func([noise.type 'NoiseGradVals']); - [g, dlnZ_dvs] = fhandle(noise, mu, varSigma, y); - nu = g.*g - 2*dlnZ_dvs; - nu(find(abs(nu) < eps)) = eps; -end - diff --git a/gpmnoise/noiseUpdateSites.m b/gpmnoise/noiseUpdateSites.m deleted file mode 100644 index 9928dff1..00000000 --- a/gpmnoise/noiseUpdateSites.m +++ /dev/null @@ -1,31 +0,0 @@ -function [m, beta] = noiseUpdateSites(noise, g, nu, mu, varSigma, y); - -% NOISEUPDATESITES Update site parameters for a given noise model. -% FORMAT -% DESC updates the site parameters for the given -% noise model. -% ARG noise : the noise structure for which the site parameters are to -% be updated. -% ARG g : values of g as retuned by noiseUpdateNuG. -% ARG nu : values of nu as retuned by noiseUpdateNuG. -% ARG mu : the mean value of the Gaussian input to the noise structure. -% ARG varSigma : the variance of the Gaussian input to the noise structure. -% ARG y : the target value. -% RETURN m : the site mean parameters. -% RETURN beta : the site precision parameters. -% -% SEEALSO : noiseParamInit, noiseUpdateNuG -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - -if noise.updateSites - % The noise model has its own code for site updates. - fhandle = str2func([noise.type 'NoiseSites']); - [m, beta] = fhandle(noise, g, nu, mu, varSigma, y); -else - % Use the standard code. - beta = nu./(1-nu.*varSigma); - m = mu + g./nu; -end diff --git a/gpmnoise/noiseWriteParamsToFID.m b/gpmnoise/noiseWriteParamsToFID.m deleted file mode 100644 index aa39d385..00000000 --- a/gpmnoise/noiseWriteParamsToFID.m +++ /dev/null @@ -1,22 +0,0 @@ -function noiseWriteParamsToFID(noise, FID) - -% NOISEWRITEPARAMSTOFID Write the noise parameters to a stream. -% FORMAT -% DESC writes noise parameters to a file stream. -% ARG noise : the noise structure that is being written. -% ARG FID : the file ID of the stream that is being written. -% -% COPYRIGHT : Neil D. Lawrence, 2005, 2008 -% -% SEEALSO : noiseWriteToFID - -% NOISE - -writeIntToFID(FID, 'outputDim', noise.numProcess); -writeIntToFID(FID, 'numParams', noise.nParams); -if strcmp(noise.type, 'ncnm') - writeIntToFID(FID, 'gammaSplit', noise.gammaSplit); -end -fhandle = str2func([noise.type 'NoiseExtractParam']); -params = fhandle(noise); -doubleMatrixWriteToFID(params, FID); diff --git a/gpmnoise/noiseWriteToFID.m b/gpmnoise/noiseWriteToFID.m deleted file mode 100644 index e92c89d4..00000000 --- a/gpmnoise/noiseWriteToFID.m +++ /dev/null @@ -1,19 +0,0 @@ -function noiseWriteToFID(noise, FID) - -% NOISEWRITETOFID Load from an FID written by the C++ implementation. -% FORMAT -% DESC loads in from a file stream the data format produced by -% C++ implementations. -% ARG noise : the noise model to write to the stream. -% ARG FID : the file ID from where the data is loaded. -% -% COPYRIGHT : Neil D. Lawrence, 2005, 2006, 2008 -% -% SEEALSO : modelReadFromFID, noiseCreate, noiseReadParamsFromFID - -% NOISE - -writeVersionToFID(FID, 0.2); -writeStringToFID(FID, 'baseType', 'noise'); -writeStringToFID(FID, 'type', noise.type); -noiseWriteParamsToFID(noise, FID); diff --git a/gpmnoise/orderedGradX.m b/gpmnoise/orderedGradX.m deleted file mode 100644 index e037c776..00000000 --- a/gpmnoise/orderedGradX.m +++ /dev/null @@ -1,12 +0,0 @@ -function g = orderedGradX(X, Y, model, prior) - -% ORDEREDGRADX Gradient wrt x of log-likelihood for Ordered categorical model. - -% NOISE - -% NOISE - - -if size(X, 1) > 1 - error('This function only takes one data-point'); -end diff --git a/gpmnoise/orderedNoise3dPlot.m b/gpmnoise/orderedNoise3dPlot.m deleted file mode 100644 index 4bde315e..00000000 --- a/gpmnoise/orderedNoise3dPlot.m +++ /dev/null @@ -1,32 +0,0 @@ -function h = orderedNoise3dPlot(noise, plotType, CX, CY, CZ, CZVar, varargin) - - -% ORDEREDNOISE3DPLOT Draws a 3D or contour plot for the ORDERED noise model. -% FORMAT -% DESC draws a 3D or contour plot for the ordered categorical noise model. -% ARG noise : the noise structure for which the plot is required. -% ARG plotType : string containing the name of the plotting function (for example mesh, contour). -% ARG X : the input X data in the form of a 'mesh' matrix. -% ARG Y : the input Y data in the form of a 'mesh' matrix. -% ARG mu : the input mean in the form of a 'mesh' matrix. -% ARG varSigma : the input variance in the form of a 'mesh' matrix. -% ARG P1, P2, P3 ... : optional additional arguments for the given plot type. -% RETURN h : the gradients of the diagonal with respect to each element -% of X. The returned matrix has the same dimensions as X. -% -% SEEALSO : orderedNoiseParamInit, noise3dPlot, -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -CZ = (CZ+noise.bias)./sqrt(CZVar); -fhandle = str2func(plotType); -fhandle(CX, CY, CZ, varargin{:}); -hold on -h = []; -for i = 2:noise.C-1 - CZ = CZ - noise.widths(i-1)./sqrt(CZVar); - h = [h; fhandle(CX, CY, CZ, varargin{:})]; -end diff --git a/gpmnoise/orderedNoiseDisplay.m b/gpmnoise/orderedNoiseDisplay.m deleted file mode 100644 index 7a780e7a..00000000 --- a/gpmnoise/orderedNoiseDisplay.m +++ /dev/null @@ -1,37 +0,0 @@ -function orderedNoiseDisplay(noise, spacing) - - -% ORDEREDNOISEDISPLAY Display parameters of the ORDERED noise. -% FORMAT -% DESC displays the parameters of the ordered categorical -% noise and the noise type to the console. -% ARG noise : the noise to display. -% -% FORMAT does the same as above, but indents the display according -% to the amount specified. -% ARG noise : the noise to display. -% ARG spacing : how many spaces to indent the display of the noise by. -% -% SEEALSO : orderedNoiseParamInit, modelDisplay, noiseDisplay -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -if nargin > 1 - spacing = repmat(32, 1, spacing); -else - spacing = []; -end -spacing = char(spacing); -for i = 1:noise.numProcess - fprintf(spacing); - fprintf('Ordered bias on process %d: %2.4f\n', i, noise.bias(i)) -end -for i = 1:noise.C-2 - fprintf('Ordered noise model width %d: %2.4f\n', i, noise.widths(i)) -end -fprintf(spacing); -fprintf(spacing); -fprintf('Ordered Sigma2: %2.4f\n', noise.variance); diff --git a/gpmnoise/orderedNoiseExpandParam.m b/gpmnoise/orderedNoiseExpandParam.m deleted file mode 100644 index ff17183d..00000000 --- a/gpmnoise/orderedNoiseExpandParam.m +++ /dev/null @@ -1,25 +0,0 @@ -function noise = orderedNoiseExpandParam(noise, params) - - -% ORDEREDNOISEEXPANDPARAM Create noise structure from ORDERED noise's parameters. -% FORMAT -% DESC returns a ordered categorical noise structure filled with the -% parameters in the given vector. This is used as a helper function to -% enable parameters to be optimised in, for example, the NETLAB -% optimisation functions. -% ARG noise : the noise structure in which the parameters are to be -% placed. -% ARG param : vector of parameters which are to be placed in the -% noise structure. -% RETURN noise : noise structure with the given parameters in the -% relevant locations. -% -% SEEALSO : orderedNoiseParamInit, orderedNoiseExtractParam, noiseExpandParam -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -noise.bias = params(1:noise.numProcess); -noise.widths = params(noise.numProcess+1:end)'; diff --git a/gpmnoise/orderedNoiseExtractParam.m b/gpmnoise/orderedNoiseExtractParam.m deleted file mode 100644 index 621dc374..00000000 --- a/gpmnoise/orderedNoiseExtractParam.m +++ /dev/null @@ -1,42 +0,0 @@ -function [params, names] = orderedNoiseExtractParam(noise) - - -% ORDEREDNOISEEXTRACTPARAM Extract parameters from the ORDERED noise structure. -% FORMAT -% DESC extracts parameters from the ordered categorical -% noise structure into a vector of parameters for optimisation. -% ARG noise : the noise structure containing the parameters to be -% extracted. -% RETURN param : vector of parameters extracted from the noise. If -% the field 'transforms' is not empty in the noise structure, the -% parameters will be transformed before optimisation (for example -% positive only parameters could be logged before being returned). -% -% FORMAT -% DESC extracts parameters and parameter names from the ordered categorical -% noise structure. -% ARG noise : the noise structure containing the parameters to be -% extracted. -% RETURN param : vector of parameters extracted from the noise. If -% the field 'transforms' is not empty in the noise structure, the -% parameters will be transformed before optimisation (for example -% positive only parameters could be logged before being returned). -% RETURN names : cell array of strings containing names for each -% parameter. -% -% SEEALSO orderedNoiseParamInit, orderedNoiseExpandParam, noiseExtractParam, scg, conjgrad -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 -% -% NOISE - - -params = [noise.bias noise.widths(:)']; -if nargout > 1 - for i = 1:noise.numProcess - names{i} = ['bias ' num2str(i)]; - end - for i = 1:noise.C-2 - names{noise.numProcess+i} = ['width ' num2str(i)]; - end -end diff --git a/gpmnoise/orderedNoiseGradVals.m b/gpmnoise/orderedNoiseGradVals.m deleted file mode 100644 index 040dcb76..00000000 --- a/gpmnoise/orderedNoiseGradVals.m +++ /dev/null @@ -1,76 +0,0 @@ -function [dlnZ_dmu, dlnZ_dvs] = orderedNoiseGradVals(noise, mu, varsigma, y) - - -% ORDEREDNOISEGRADVALS Gradient of ORDERED noise log Z with respect to input mean and variance. -% FORMAT -% DESC computes the gradient of the ordered categorical -% noise with respect to the input mean and the input variance. -% ARG noise : noise structure for which gradients are being -% computed. -% ARG mu : mean input locations with respect to which gradients are -% being computed. -% ARG varSigma : variance input locations with respect to which -% gradients are being computed. -% ARG y : noise model output observed values associated with the given points. -% RETURN dlnZ_dmu : the gradient of log Z with respect to the input mean. -% RETURN dlnZ_dvs : the gradient of log Z with respect to the input variance. -% -% SEEALSO orderedNoiseParamInit, orderedNoiseGradientParam, noiseGradVals, -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -D = size(y, 2); -c = 1./sqrt(noise.variance + varsigma); - -% Missing values are left untouched at zero. -dlnZ_dmu = zeros(size(c)); -dlnZ_dvs = zeros(size(c)); -for j = 1:D - % Do lowest category first - index = find(y(:, j)==0); - if ~isempty(index) - mu(index, j) = mu(index, j) + noise.bias(j) ; - mu(index, j) = mu(index, j).*c(index, j); - dlnZ_dmu(index, j) = -c(index, j).*gradLogCumGaussian(-mu(index, j)); - dlnZ_dvs(index, j) = -.5*dlnZ_dmu(index, j).*c(index, j).*mu(index, j); - end - - - % Intermediate categories - index = find(y(:, j)>0 & y(:, j) 0 & y(:, j) 1) - addpart = sum(c(index(subIndex), j)... - .*B1(subIndex)); - gnoise.widths(1:cat-1) = gnoise.widths(1:cat-1) ... - - repmat(addpart, cat-1, 1); - end - end - end - end - - % Highest category - index = find(y(:, j) == noise.C-1); - if ~isempty(index) - for i = index' - mu(i, j) = mu(i, j) + noise.bias(j) - sum(noise.widths(1:y(i, j)-1)); - end - mu(index, j) = mu(index, j).*c(index, j); - addpart = sum(c(index, j).*gradLogCumGaussian(mu(index, j))); - gnoise.bias(j) = gnoise.bias(j) + addpart; - if length(noise.widths > 0) - gnoise.widths = gnoise.widths ... - - repmat(addpart, noise.C-2, 1); - end - end -end -if length(noise.widths>0) - g = [gnoise.bias gnoise.widths(:)']; -else - g = gnoise.bias; -end diff --git a/gpmnoise/orderedNoiseLikelihood.m b/gpmnoise/orderedNoiseLikelihood.m deleted file mode 100644 index 8811ff77..00000000 --- a/gpmnoise/orderedNoiseLikelihood.m +++ /dev/null @@ -1,55 +0,0 @@ -function L = orderedNoiseLikelihood(noise, mu, varsigma, y) - - -% ORDEREDNOISELIKELIHOOD Likelihood of the data under the ORDERED noise model. -% FORMAT -% DESC returns the likelihood of a data set under the ordered categorical noise model. -% ARG noise : the noise structure for which the likelihood is required. -% ARG mu : input mean locations for the likelihood. -% ARG varSigma : input variance locations for the likelihood. -% ARG y : target locations for the likelihood. -% -% SEEALSO : orderedNoiseParamInit, orderedNoiseLogLikelihood, noiseLikelihood -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -D = size(y, 2); - -L = zeros(size(mu)); -L(find(isnan(y))) = 1; - -c = 1./sqrt(noise.variance + varsigma); -for j = 1:D - % Do lowest category first - index = find(y(:, j) == 0); - if ~isempty(index) - mu(index, j) = mu(index, j) + noise.bias(j) ; - L(index, j) = cumGaussian(-mu(index, j).*c(index, j)); - end - - % Intermediate categories - index = find(y(:, j) > 0 & y(:, j) < noise.C-1); - if ~isempty(index) - for i = index' - mu(i, j) = mu(i, j) + noise.bias(j) - sum(noise.widths(1:y(i, j)-1)); - L(i, j) = cumGaussian(mu(i, j).*c(i, j)) ... - - cumGaussian((mu(i, j) ... - - noise.widths(y(i, j))) ... - .* c(i, j)); - end - end - % Highest category - index = find(y(:, j) == noise.C-1); - if ~isempty(index) - for i = index' - mu(i, j) = mu(i, j) + noise.bias(j) - sum(noise.widths(1:y(i, j)-1)); - end - L(index, j) = cumGaussian(mu(index, j).*c(index, j)); - end -end -%/~ for j = 1:D -% L(:, j) = (1-noise.C*noise.eta)*L(:, j)+noise.eta; -%~/ end diff --git a/gpmnoise/orderedNoiseLogLikelihood.m b/gpmnoise/orderedNoiseLogLikelihood.m deleted file mode 100644 index b984ede9..00000000 --- a/gpmnoise/orderedNoiseLogLikelihood.m +++ /dev/null @@ -1,51 +0,0 @@ -function L = orderedNoiseLogLikelihood(noise, mu, varsigma, y) - - -% ORDEREDNOISELOGLIKELIHOOD Log likelihood of the data under the ORDERED noise model. -% FORMAT -% DESC returns the log likelihood of a data set under the ordered categorical noise model. -% ARG noise : the noise structure for which the log likelihood is required. -% ARG mu : input mean locations for the log likelihood. -% ARG varSigma : input variance locations for the log likelihood. -% ARG y : target locations for the log likelihood. -% -% SEEALSO : orderedNoiseParamInit, orderedNoiseLikelihood, noiseLogLikelihood -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -D = size(y, 2); - -L = 0; -fact = sqrt(2)/2; -c = 1./sqrt(noise.variance + varsigma); -for j = 1:D - % Do lowest category first - index = find(y(:, j) == 0); - if ~isempty(index) - mu(index, j) = mu(index, j) + noise.bias(j) ; - L = L + sum(lnCumGaussian(-mu(index, j).*c(index, j))); - end - - % Intermediate categories - index = find(y(:, j) > 0 & y(:, j) < noise.C-1); - if ~isempty(index) - for i = index' - mu(i, j) = mu(i, j) + noise.bias(j) - sum(noise.widths(1:y(i, j)-1)); - u = mu(i, j).*c(i, j); - uprime = (mu(i, j) - noise.widths(y(i, j))).* c(i, j); - L = L + lnDiffCumGaussian(u, uprime); - end - end - % Highest category - index = find(y(:, j) == noise.C-1); - if ~isempty(index) - for i = index' - mu(i, j) = mu(i, j) + noise.bias(j) - sum(noise.widths(1:y(i, j)-1)); - end - L = L + sum(lnCumGaussian(mu(index, j).*c(index, j))); - end -end - diff --git a/gpmnoise/orderedNoiseOut.m b/gpmnoise/orderedNoiseOut.m deleted file mode 100644 index a102262a..00000000 --- a/gpmnoise/orderedNoiseOut.m +++ /dev/null @@ -1,33 +0,0 @@ -function y = orderedNoiseOut(noise, mu, varsigma) - - -% ORDEREDNOISEOUT Compute the output of the ORDERED noise given the input mean and variance. -% FORMAT -% DESC computes the ouptut for the ordered categorical -% noise given input mean and variances. -% ARG noise : the noise structure for which the output is computed. -% ARG mu : the input mean values. -% ARG varSigma : the input variance values. -% RETURN y : the output from the noise model. -% -% SEEALSO : orderedNoiseParamInit, noiseOut, noiseCreate, -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -D = size(mu, 2); -for i = 1:D - mu(:, i) = mu(:, i) + noise.bias(i); -end - -y = zeros(size(mu)); -i = noise.C-2; -index = find(mu > sum(noise.widths(1:i))); -y(index) = i+1; -for i = noise.C-3:-1:0 - index = find(mu > sum(noise.widths(1:i)) ... - & mu <= sum(noise.widths(1:i+1))); - y(index) = i+1; -end diff --git a/gpmnoise/orderedNoiseParamInit.m b/gpmnoise/orderedNoiseParamInit.m deleted file mode 100644 index fefeae35..00000000 --- a/gpmnoise/orderedNoiseParamInit.m +++ /dev/null @@ -1,45 +0,0 @@ -function noise = orderedNoiseParamInit(noise, y) - - -% ORDEREDNOISEPARAMINIT ORDERED noise parameter initialisation. -% The ordered categorical noise model is an ordinal regression noise -% model. The real line is divided into categories, which have some -% ordering (such as small, medium, large). -% -% FORMAT -% DESC initialises the ordered categorical -% noise structure with some default parameters. -% ARG noise : the noise structure which requires initialisation. -% RETURN noise : the noise structure with the default parameters placed in. -% -% SEEALSO : noiseCreate, noiseParamInit -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -if nargin > 1 - noise.C = max(max(y))+1; - noise.numProcess = size(y, 2); - noise.bias = zeros(1, noise.numProcess); - for i = 1:size(y, 2) - noise.bias(i) = mean(y(find(~isnan(y(:, i))), i)); - end -else - noise.bias = repmat(1/2, 1, noise.numProcess); -end -noise.nParams = noise.C-2 + noise.numProcess; - -if noise.C > 2 - noise.widths = repmat(1/(noise.C-2), noise.C-2, 1); - noise.transforms.index = [noise.numProcess+1:noise.nParams]; - noise.transforms.type = optimiDefaultConstraint('positive'); -else - noise.widths = []; -end -noise.variance = 0.1; % needs to be set a bit above zero for numerical reasons. - -% Can handle missing values? -noise.missing = 1; - diff --git a/gpmnoise/orderedNoisePointPlot.m b/gpmnoise/orderedNoisePointPlot.m deleted file mode 100644 index dc32f9d4..00000000 --- a/gpmnoise/orderedNoisePointPlot.m +++ /dev/null @@ -1,42 +0,0 @@ -function h = orderedNoisePointPlot(noise, X, y, ... - fontName, fontSize, ... - markerSize, lineWidth); - -% ORDEREDNOISEPOINTPLOT Plot the data-points for the ORDERED noise model. -% FORMAT -% DESC plots the data point locations for the ordered categorical -% noise structure. -% ARG noise : the noise structure which is to be plotted. -% ARG X : input locations to be plotted. -% ARG y : target locations to be plotted. -% ARG fontName : name of any fonts to be used. -% ARG fontSize : size of any fonts to be used. -% ARG markerSize : size of the makers to be used. -% ARG lineWidth : size of any lines to be plotted. -% -% SEEALSO : orderedNoiseParamInit, noisePointPlot -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -h = []; -symbol = getSymbols(noise.C); -for i = 1:noise.C - h = [h; plot(X(find(y==i-1), 1), X(find(y==i-1), 2), symbol{i}, 'erasemode', ... - 'xor', 'markerSize', markerSize, 'linewidth', lineWidth)]; - hold on -end - -minVals = min([X]); -maxVals = max([X]); - -spans = maxVals - minVals; -gaps = spans*.05; - -prop = {'xlim', 'ylim'}; -for i = 1:2 - set(gca, prop{i}, [minVals(i)-gaps(i) maxVals(i)+gaps(i)]); -end -hold on diff --git a/gpmnoise/orderedNoiseUpdateParams.m b/gpmnoise/orderedNoiseUpdateParams.m deleted file mode 100644 index 4acd8fb1..00000000 --- a/gpmnoise/orderedNoiseUpdateParams.m +++ /dev/null @@ -1,14 +0,0 @@ -function [nu, g] = orderedNoiseUpdateParams(noise, mu, varsigma, y, index) - -% ORDEREDNOISEUPDATEPARAMS Update parameters for ordered categorical noise model. - -% NOISE - -% NOISE - - -[g, dlnZ_dvs] = orderedNoiseGradVals(noise, mu(index, :), ... - varsigma(index, :), ... - y(index, :)); - -nu = g.*g - 2*dlnZ_dvs; diff --git a/gpmnoise/probit3dPlot.m b/gpmnoise/probit3dPlot.m deleted file mode 100644 index 86d77ff8..00000000 --- a/gpmnoise/probit3dPlot.m +++ /dev/null @@ -1,10 +0,0 @@ -function probit3dPlot(noise, plotType, CX, CY, CZ, CZVar, varargin) - -% PROBIT3DPLOT Draw a 3D or contour plot for the probit. - -% NOISE - -CZ = CZ + model.noise.bias; -fhandle = str2func(plotType); -fhandle(CX, CY, CZ, varargin{:}); - diff --git a/gpmnoise/probitNoise3dPlot.m b/gpmnoise/probitNoise3dPlot.m deleted file mode 100644 index 63805143..00000000 --- a/gpmnoise/probitNoise3dPlot.m +++ /dev/null @@ -1,31 +0,0 @@ -function h = probitNoise3dPlot(noise, plotType, CX, CY, CZ, CZVar, varargin) - - -% PROBITNOISE3DPLOT Draws a 3D or contour plot for the PROBIT noise model. -% FORMAT -% DESC draws a 3D or contour plot for the probit based classification noise model. -% ARG noise : the noise structure for which the plot is required. -% ARG plotType : string containing the name of the plotting function (for example mesh, contour). -% ARG X : the input X data in the form of a 'mesh' matrix. -% ARG Y : the input Y data in the form of a 'mesh' matrix. -% ARG mu : the input mean in the form of a 'mesh' matrix. -% ARG varSigma : the input variance in the form of a 'mesh' matrix. -% ARG P1, P2, P3 ... : optional additional arguments for the given plot type. -% RETURN h : the gradients of the diagonal with respect to each element -% of X. The returned matrix has the same dimensions as X. -% -% SEEALSO : probitNoiseParamInit, noise3dPlot, -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -fhandle = str2func(plotType); - -CZ = cumGaussian((CZ + noise.bias)./sqrt(CZVar)); -if nargout > 0 - h = fhandle(CX, CY, CZ, varargin{:}); -else - fhandle(CX, CY, CZ, varargin{:}); -end diff --git a/gpmnoise/probitNoiseDisplay.m b/gpmnoise/probitNoiseDisplay.m deleted file mode 100644 index 4c4ab7b7..00000000 --- a/gpmnoise/probitNoiseDisplay.m +++ /dev/null @@ -1,35 +0,0 @@ -function probitNoiseDisplay(noise, spacing) - - -% PROBITNOISEDISPLAY Display parameters of the PROBIT noise. -% FORMAT -% DESC displays the parameters of the probit based classification -% noise and the noise type to the console. -% ARG noise : the noise to display. -% -% FORMAT does the same as above, but indents the display according -% to the amount specified. -% ARG noise : the noise to display. -% ARG spacing : how many spaces to indent the display of the noise by. -% -% SEEALSO : probitNoiseParamInit, modelDisplay, noiseDisplay -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -if nargin > 1 - spacing = repmat(32, 1, spacing); -else - spacing = []; -end -spacing = char(spacing); -for i = 1:noise.numProcess - fprintf(spacing); - fprintf('Probit bias on process %d: %2.4f\n', i, noise.bias(i)) -end -fprintf(spacing); -fprintf('Probit Sigma2: %2.4f\n', noise.sigma2); - - diff --git a/gpmnoise/probitNoiseExpandParam.m b/gpmnoise/probitNoiseExpandParam.m deleted file mode 100644 index 8c7f0dcd..00000000 --- a/gpmnoise/probitNoiseExpandParam.m +++ /dev/null @@ -1,25 +0,0 @@ -function noise = probitNoiseExpandParam(noise, params) - - -% PROBITNOISEEXPANDPARAM Create noise structure from PROBIT noise's parameters. -% FORMAT -% DESC returns a probit based classification noise structure filled with the -% parameters in the given vector. This is used as a helper function to -% enable parameters to be optimised in, for example, the NETLAB -% optimisation functions. -% ARG noise : the noise structure in which the parameters are to be -% placed. -% ARG param : vector of parameters which are to be placed in the -% noise structure. -% RETURN noise : noise structure with the given parameters in the -% relevant locations. -% -% SEEALSO : probitNoiseParamInit, probitNoiseExtractParam, noiseExpandParam -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -noise.bias = params(1:end); - diff --git a/gpmnoise/probitNoiseExtractParam.m b/gpmnoise/probitNoiseExtractParam.m deleted file mode 100644 index 6674addc..00000000 --- a/gpmnoise/probitNoiseExtractParam.m +++ /dev/null @@ -1,40 +0,0 @@ -function [params, names] = probitNoiseExtractParam(noise) - - -% PROBITNOISEEXTRACTPARAM Extract parameters from the PROBIT noise structure. -% FORMAT -% DESC extracts parameters from the probit based classification -% noise structure into a vector of parameters for optimisation. -% ARG noise : the noise structure containing the parameters to be -% extracted. -% RETURN param : vector of parameters extracted from the noise. If -% the field 'transforms' is not empty in the noise structure, the -% parameters will be transformed before optimisation (for example -% positive only parameters could be logged before being returned). -% -% FORMAT -% DESC extracts parameters and parameter names from the probit based classification -% noise structure. -% ARG noise : the noise structure containing the parameters to be -% extracted. -% RETURN param : vector of parameters extracted from the noise. If -% the field 'transforms' is not empty in the noise structure, the -% parameters will be transformed before optimisation (for example -% positive only parameters could be logged before being returned). -% RETURN names : cell array of strings containing names for each -% parameter. -% -% SEEALSO probitNoiseParamInit, probitNoiseExpandParam, noiseExtractParam, scg, conjgrad -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 -% -% NOISE - - -params = [noise.bias]; - -if nargout > 1 - for i = 1:noise.numProcess - names{i} = ['bias ' num2str(i)]; - end -end diff --git a/gpmnoise/probitNoiseGradVals.m b/gpmnoise/probitNoiseGradVals.m deleted file mode 100644 index bc8cccd2..00000000 --- a/gpmnoise/probitNoiseGradVals.m +++ /dev/null @@ -1,32 +0,0 @@ -function [dlnZ_dmu, dlnZ_dvs] = probitNoiseGradVals(noise, mu, varsigma, y) - - -% PROBITNOISEGRADVALS Gradient of PROBIT noise log Z with respect to input mean and variance. -% FORMAT -% DESC computes the gradient of the probit based classification -% noise with respect to the input mean and the input variance. -% ARG noise : noise structure for which gradients are being -% computed. -% ARG mu : mean input locations with respect to which gradients are -% being computed. -% ARG varSigma : variance input locations with respect to which -% gradients are being computed. -% ARG y : noise model output observed values associated with the given points. -% RETURN dlnZ_dmu : the gradient of log Z with respect to the input mean. -% RETURN dlnZ_dvs : the gradient of log Z with respect to the input variance. -% -% SEEALSO probitNoiseParamInit, probitNoiseGradientParam, noiseGradVals, -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -D = size(mu, 2); -c = y./sqrt(noise.sigma2+varsigma); -u = zeros(size(c)); -for i = 1:D - u(:, i) = c(:, i).*(mu(:, i) + noise.bias(i)); -end -dlnZ_dmu = c.*gradLogCumGaussian(u); -dlnZ_dvs = -.5*c.*u.*dlnZ_dmu; diff --git a/gpmnoise/probitNoiseGradientParam.m b/gpmnoise/probitNoiseGradientParam.m deleted file mode 100644 index 9f0f5a03..00000000 --- a/gpmnoise/probitNoiseGradientParam.m +++ /dev/null @@ -1,30 +0,0 @@ -function g = probitNoiseGradientParam(noise, mu, varsigma, y) - - -% PROBITNOISEGRADIENTPARAM Gradient of PROBIT noise's parameters. -% FORMAT -% DESC computes the gradient of the log Z of the probit based classification noise model with respect to the of functions with respect to the -% probit based classification -% noise's parameters. -% ARG noise : the noise structure for which the gradients are being -% computed. -% ARG mu : the input means for which the gradients are being computed. -% ARG varSigma : the input variances for which the gradients are being computed. -% ARG y : the target values for the noise model. -% RETURN g : gradients of the log Z with respect to -% the noise parameters. The ordering of the vector should match -% that provided by the function noiseExtractParam. -% -% -% SEEALSO probitNoiseParamInit, probitnoiseGradVals, noiseGradientParam -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -c = y./sqrt(noise.sigma2 + varsigma); -for i = 1:size(mu, 2) - u(:, i) = c(:, i).*(mu(:, i) + noise.bias(i)); -end -g = sum(c.*gradLogCumGaussian(u), 1); diff --git a/gpmnoise/probitNoiseLikelihood.m b/gpmnoise/probitNoiseLikelihood.m deleted file mode 100644 index b3ccb1d9..00000000 --- a/gpmnoise/probitNoiseLikelihood.m +++ /dev/null @@ -1,23 +0,0 @@ -function L = probitNoiseLikelihood(noise, mu, varsigma, y) - - -% PROBITNOISELIKELIHOOD Likelihood of the data under the PROBIT noise model. -% FORMAT -% DESC returns the likelihood of a data set under the probit based classification noise model. -% ARG noise : the noise structure for which the likelihood is required. -% ARG mu : input mean locations for the likelihood. -% ARG varSigma : input variance locations for the likelihood. -% ARG y : target locations for the likelihood. -% -% SEEALSO : probitNoiseParamInit, probitNoiseLogLikelihood, noiseLikelihood -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -D = size(y, 2); -for i = 1:D - mu(:, i) = mu(:, i) + noise.bias(i); -end -L = cumGaussian((y.*mu)./(sqrt(noise.sigma2+varsigma))); diff --git a/gpmnoise/probitNoiseLogLikelihood.m b/gpmnoise/probitNoiseLogLikelihood.m deleted file mode 100644 index 221e0b0d..00000000 --- a/gpmnoise/probitNoiseLogLikelihood.m +++ /dev/null @@ -1,24 +0,0 @@ -function L = probitNoiseLogLikelihood(noise, mu, varsigma, y) - - -% PROBITNOISELOGLIKELIHOOD Log likelihood of the data under the PROBIT noise model. -% FORMAT -% DESC returns the log likelihood of a data set under the probit based classification noise model. -% ARG noise : the noise structure for which the log likelihood is required. -% ARG mu : input mean locations for the log likelihood. -% ARG varSigma : input variance locations for the log likelihood. -% ARG y : target locations for the log likelihood. -% -% SEEALSO : probitNoiseParamInit, probitNoiseLikelihood, noiseLogLikelihood -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -D = size(y, 2); -for i = 1:D - mu(:, i) = mu(:, i) + noise.bias(i); -end - -L = sum(sum(lnCumGaussian((y.*mu)./(sqrt(noise.sigma2+varsigma))))); diff --git a/gpmnoise/probitNoiseOut.m b/gpmnoise/probitNoiseOut.m deleted file mode 100644 index 11523c1f..00000000 --- a/gpmnoise/probitNoiseOut.m +++ /dev/null @@ -1,24 +0,0 @@ -function y = probitNoiseOut(noise, mu, varsigma) - - -% PROBITNOISEOUT Compute the output of the PROBIT noise given the input mean and variance. -% FORMAT -% DESC computes the ouptut for the probit based classification -% noise given input mean and variances. -% ARG noise : the noise structure for which the output is computed. -% ARG mu : the input mean values. -% ARG varSigma : the input variance values. -% RETURN y : the output from the noise model. -% -% SEEALSO : probitNoiseParamInit, noiseOut, noiseCreate, -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -D = size(mu, 2); -for i = 1:D - mu(:, i) = mu(:, i) + noise.bias(i); -end -y = sign(mu); diff --git a/gpmnoise/probitNoiseParamInit.m b/gpmnoise/probitNoiseParamInit.m deleted file mode 100644 index 609b7f3d..00000000 --- a/gpmnoise/probitNoiseParamInit.m +++ /dev/null @@ -1,42 +0,0 @@ -function noise = probitNoiseParamInit(noise, y) - - -% PROBITNOISEPARAMINIT PROBIT noise parameter initialisation. -% The probit noise model is a classification noise model. It is based on the cumulative Gaussian. If the cumulative Gaussian is defined as -% -% \phi(x) = \int_{-\infty}^x N(z|0, 1) dz -% -% Then the probit noise model is \phi(y.*(mu+bias)/(\sqrt(sigma2 + varSigma))) -% where bias and sigma2 are parameters of the noise model, y is the true class and mu and varSigma are the input mean and variance. -% -% SEEALSO : ncnmParamInit -% -% FORMAT -% DESC initialises the probit based classification -% noise structure with some default parameters. -% ARG noise : the noise structure which requires initialisation. -% RETURN noise : the noise structure with the default parameters placed in. -% -% SEEALSO : noiseCreate, noiseParamInit -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -if nargin > 1 - nClass1 = sum(y==1, 1); - nClass2 = sum(y==-1, 1); - noise.bias = invCumGaussian(nClass1./(nClass2+nClass1)); - noise.numProcess = size(y, 2); -else - noise.bias = zeros(1, noise.numProcess); -end -noise.nParams = noise.numProcess; - -% This isn't optimised, it sets the gradient of the erf. -noise.sigma2 = 1e-6; - - -% Can handle missing values? -noise.missing = 0; diff --git a/gpmnoise/probitNoisePointPlot.m b/gpmnoise/probitNoisePointPlot.m deleted file mode 100644 index 8453d223..00000000 --- a/gpmnoise/probitNoisePointPlot.m +++ /dev/null @@ -1,36 +0,0 @@ -function h = probitNoisePointPlot(noise, X, y, ... - fontName, fontSize, ... - markerSize, lineWidth); - -% PROBITNOISEPOINTPLOT Plot the data-points for the PROBIT noise model. -% FORMAT -% DESC plots the data point locations for the probit based classification -% noise structure. -% ARG noise : the noise structure which is to be plotted. -% ARG X : input locations to be plotted. -% ARG y : target locations to be plotted. -% ARG fontName : name of any fonts to be used. -% ARG fontSize : size of any fonts to be used. -% ARG markerSize : size of the makers to be used. -% ARG lineWidth : size of any lines to be plotted. -% -% SEEALSO : probitNoiseParamInit, noisePointPlot -% -% COPYRIGHT : Neil D. Lawrence, 2004, 2005 - -% NOISE - - -pointsNeg = plot(X(find(y(:, 1)==-1), 1), ... - X(find(y(:, 1)==-1), 2), ... - 'gx', 'erasemode', 'xor', ... - 'markersize', markerSize+2, ... - 'linewidth', lineWidth); -hold on -pointsPos = plot(X(find(y(:, 1)==1), 1), ... - X(find(y(:, 1)==1), 2), 'ro', ... - 'erasemode', 'xor', ... - 'markersize', markerSize, ... - 'linewidth', lineWidth); - -h = [pointsNeg; pointsPos]; diff --git a/gpmnoise/scaleNoiseDisplay.m b/gpmnoise/scaleNoiseDisplay.m deleted file mode 100644 index 54295e9d..00000000 --- a/gpmnoise/scaleNoiseDisplay.m +++ /dev/null @@ -1,18 +0,0 @@ -function scaleNoiseDisplay(noise, spacing) - -% SCALENOISEDISPLAY Display the parameters of the scaled noise model. - -% NOISE - -if nargin > 1 - spacing = repmat(32, 1, spacing); -else - spacing = []; -end -spacing = char(spacing); -for i = 1:noise.numProcess - fprintf(spacing) - fprintf('Bias on process %d: %2.4f\n', i, noise.bias(i)) - fprintf(spacing) - fprintf('Scale on process %d: %2.4f\n', i, noise.scale(i)) -end diff --git a/gpmnoise/scaleNoiseExpandParam.m b/gpmnoise/scaleNoiseExpandParam.m deleted file mode 100644 index 39c858c9..00000000 --- a/gpmnoise/scaleNoiseExpandParam.m +++ /dev/null @@ -1,8 +0,0 @@ -function noise = scaleNoiseExpandParam(noise, params) - -% SCALENOISEEXPANDPARAM Expand Scale noise structure from param vector. - -% NOISE - -noise.bias = params(1:noise.numProcess); -noise.scale = params(noise.numProcess+1:end); diff --git a/gpmnoise/scaleNoiseOut.m b/gpmnoise/scaleNoiseOut.m deleted file mode 100644 index e1ae7e08..00000000 --- a/gpmnoise/scaleNoiseOut.m +++ /dev/null @@ -1,12 +0,0 @@ -function y = scaleNoiseOut(noise, mu, varSigma) - -% SCALENOISEOUT A simple noise model that scales and centres the data. - -% NOISE - -y = zeros(size(mu)); -for i = 1:size(mu, 2) - y(:, i) = noise.bias(i) + mu(:, i)*noise.scale(i); -end - - diff --git a/gpmnoise/scaleNoiseParamInit.m b/gpmnoise/scaleNoiseParamInit.m deleted file mode 100644 index 481b6c89..00000000 --- a/gpmnoise/scaleNoiseParamInit.m +++ /dev/null @@ -1,26 +0,0 @@ -function noise = scaleNoiseParamInit(noise, y) - -% SCALENOISEPARAMINIT Scale noise model's parameter initialisation. - -% NOISE - -noise.sigma2 = 1e-6; -if nargin > 1 - noise.numProcess = size(y, 2); - noise.nParams = 2*noise.numProcess; - for i = 1:noise.numProcess - ind = find(~isnan(y(:, i))); - noise.bias(i) = mean(y(ind, i)); - noise.scale(i) = sqrt(var(y(ind, i))); - end -else - noise.bias = zeros(1, noise.numProcess); - noise.scale = zeros(1, noise.numProcess); - -end - -% Can handle missing values? -noise.missing = 1; - -% Noise model leads to constant value of beta. -noise.spherical = 1; diff --git a/gpmnoise/scaleNoiseSites.m b/gpmnoise/scaleNoiseSites.m deleted file mode 100644 index 3e7454d3..00000000 --- a/gpmnoise/scaleNoiseSites.m +++ /dev/null @@ -1,13 +0,0 @@ -function [m, beta] = scaleNoiseSites(noise, g, nu, mu, varSigma, y) - -% SCALENOISESITES Site updates for Scale noise model. - -% NOISE - -N = size(y, 1); -D = length(noise.bias); -beta = zeros(N, D); -for i = 1:size(y, 2) - m(:, i) = (y(:, i) - noise.bias(i))/noise.scale(i); -end -beta = repmat(1./noise.sigma2, N, D);