Skip to content

Hyperparameter selection of one-class support vector machine by self-adaptive data shifting

Notifications You must be signed in to change notification settings

homarques/SDS-hyperparameter-selection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Self-adaptive Data Shifting

MATLAB implementation of the paper "Hyperparameter selection of one-class support vector machine by self-adaptive data shifting".

Importing libraries

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');

Generating synthetic one-class dataset

x = gendatb([300, 0]);
data = gendatoc(x, []);

Synthetic dataset

Generating pseudo binary datasets

SDS

[targets, outliers] = sds(data);

SDS pseudo binary dataset

Uniform Object Generation

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);

Uniform objects pseudo binary dataset

Optimizing SVDD hyperparameters

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

Evaluating each combination of parameters

Training SVDD

w = svdd(data, params{1}(1), params{2}(1));

SDS

Testing the classifier on the SDS pseudo binary dataset

Error on target class

err_t_sds = dd_error(targets*w);

Error on outlier class

err_o_sds = dd_error(outliers*w);

Classifier error

err_sds = err_t_sds(1) + err_o_sds(2);

Uniform Object Generation

Testing the classifier on the Uniform Objects pseudo binary dataset

Error on target class (cross-validation)

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

Error on outlier class

err_o_uo = dd_error(uniform_objects*w);

Classifier error

err_uo = mean(err_t_uo) + err_o_uo(2);

Select the classifier with the smallest overall error

SDS

Best classifier according to SDS

Uniform Object Generation

Best classifier according to Uniform Objects

About

Hyperparameter selection of one-class support vector machine by self-adaptive data shifting

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published