MATLAB implementation of the paper "Hyperparameter selection of one-class support vector machine by self-adaptive data shifting".
This implementation is built on the PrTools and dd_tools libraries, both libraries can be imported using the MATLAB command addpath
:
addpath('prtools');
addpath('dd_tools');
x = gendatb([300, 0]);
data = gendatoc(x, []);
[targets, outliers] = sds(data);
Also generating a pseudo binary dataset based on the paper "Uniform object generation for optimizing one-class classifiers" to compare with SDS.
It is already implemented on dd_tools
by the command:
uniform_objects = gendatout(data, 2000);
params = {};
params{1} = [0 0.05];
%Fraction of the target data rejected (misclassified)
params{2} = linspace(0.5, 8, 6);
%Parameter of the radial kernel (sigma), 6 values equally spaced from 0.5 to 8
w = svdd(data, params{1}(1), params{2}(1));
Testing the classifier on the SDS pseudo binary dataset
err_t_sds = dd_error(targets*w);
err_o_sds = dd_error(outliers*w);
err_sds = err_t_sds(1) + err_o_sds(2);
Testing the classifier on the Uniform Objects pseudo binary dataset
nrfolds = 10;
err_t_uo = zeros(nrfolds, 1);
I = nrfolds;
for j=1:nrfolds
%x - training set, z - test set
[x,z,I] = dd_crossval(data, I);
%training
w1 = svdd(x, thisarg{:});
%test
err_xval = dd_error(z, w1);
err_t_uo(j) = err_xval(1);
end
err_o_uo = dd_error(uniform_objects*w);
err_uo = mean(err_t_uo) + err_o_uo(2);