GithubHelp home page GithubHelp logo

fsjlang / sds-hyperparameter-selection Goto Github PK

View Code? Open in Web Editor NEW

This project forked from homarques/sds-hyperparameter-selection

0.0 0.0 0.0 2.04 MB

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

C 2.21% MATLAB 95.01% M 2.77%

sds-hyperparameter-selection's Introduction

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

sds-hyperparameter-selection's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.