Giter Club home page Giter Club logo

cssvm's Introduction

Cost-Sensitive Support Vector Machines (CSSVM)

This project implements CSSVM using LibSVM.

  1. Installation

Installing CSSVM is exactly the same as LibSVM:

  1. Command line: In the root directory of the project and simply execute make.

  2. Python Interface In the python directory, execute make.

  3. Run

Running CSSVM is almost like running LibSVM, except the new -C and -W options:


Usage: svm-train [options] training_set_file [model_file]
options:
-s svm_type : set type of SVM (default 0)
	0 -- C-SVC		(multi-class classification)
	1 -- nu-SVC		(multi-class classification)
	2 -- one-class SVM
	3 -- epsilon-SVR	(regression)
	4 -- nu-SVR		(regression)
-t kernel_type : set type of kernel function (default 2)
	0 -- linear: u'*v
	1 -- polynomial: (gamma*u'*v + coef0)^degree
	2 -- radial basis function: exp(-gamma*|u-v|^2)
	3 -- sigmoid: tanh(gamma*u'*v + coef0)
	4 -- precomputed kernel (kernel values in training_set_file)
-C Cost-sensitive Learning Method(default 0):
	0 -- cost-insensitive SVM (biased-penalty SVM with option -w1 C_1 -w-1 C_-1)
	1 -- cost-sensitive SVM with option -w1 C_1 -w-1 1/kappa
	2 -- cost-sensitive SVM with example-dependent cost.used with option -W cost_file_name
-W cost_file_name : file contains example costs for example-dependent cost-sensitive learning
-d degree : set degree in kernel function (default 3)
-g gamma : set gamma in kernel function (default 1/num_features)
-r coef0 : set coef0 in kernel function (default 0)
-c cost : set the parameter C of C-SVC, epsilon-SVR, and nu-SVR (default 1)
-n nu : set the parameter nu of nu-SVC, one-class SVM, and nu-SVR (default 0.5)
-p epsilon : set the epsilon in loss function of epsilon-SVR (default 0.1)
-m cachesize : set cache memory size in MB (default 100)
-e epsilon : set tolerance of termination criterion (default 0.001)
-h shrinking : whether to use the shrinking heuristics, 0 or 1 (default 1)
-b probability_estimates : whether to train a SVC or SVR model for probability estimates, 0 or 1 (default 0)
-wi weight : set the parameter C of class i to weight*C, for C-SVC (default 1)
-v n: n-fold cross validation mode
-q : quiet mode (no outputs)
  1. CSSVM Tools

Several utiliy functions for training, grid search, and computind different performance measures is provided in cssvm_tools.py.

cssvmutil.py and cssvm.py containt python interface functions for CSSVM.

  1. Examples

Example scripts involving grid search, cross-validation, train and testing CSSVM is provided for each algorithm:

Cost-Sensitive Learning with Available Class-Dependent Costs (CSA): For the german dataset which its costs are known, run_german perfoms grid search, minimizing the (cost-sensitive) Risk to find the best hyperparameters and threshold for SVM, Biased-Penalty SVM, and CSSVM. The output of the can be found in the run_german.html

Cost-Sensitive Learning with Unavailable Class-Dependent Costs (CSU): (to be added)

Cost-Sensitive Learning with Example-Dependent Costs (CSE): (to be added)

  1. Cite

@article{masnadi2012cost, title={Cost-Sensitive Support Vector Machines}, author={Masnadi-Shirazi, Hamed and Vasconcelos, Nuno and Iranmehr, Arya}, journal={arXiv preprint arXiv:1212.0975}, year={2012} }

cssvm's People

Contributors

airanmehr avatar

Watchers

 avatar  avatar

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.