One-class SVM Probabilistic Outputs

This repository contains the experimental code for the paper
[One-class SVM Probabilistic Outputs].


There are three folders in this repository:


1. 'data'
  - This folder includes 7 data sets mentioned in the paper:art1 (ART1), art2 (ART2), art3 (ART3), art_5 (ART_5d), art_10 (ART_10d), fourclass_scale_oc (fourclass), usps_oc (USPS).
  - Files with ".t" are the test sets. For some of the artificial data sets, the ideal probabilities of the test sets are written in the files with "_prob.t".


2. 'ocsvm_prob'
  - This is an extension of LIBSVM by adding the function of one-class SVM probabilistic output.
  - Please refer to the README file in that folder (README file of LIBSVM) to build the code.
  - The probabilities generated by Platt scaling, binning equidistantly and binning by density for one-class SVM will be directly written in the output file.


3. 'script'

  - 'exp_mse.py'
    For artificial data sets with ideal probabilities (art1, art2, art3, art_5,art_10), calculate the mean square error of the probabilities generated by Platt scaling, binning equidistantly, binning by density and new Gamma scaling.
    Please run 'exp_all.sh' in folder 'ocsvm_prob' before run this.

  - 'exp_i_ocsvm.py'
    For artificial data sets with ideal probabilities (art1, art2, art3, art_5,art_10), calculate the mean square error of the probabilities generated by I-OCSVM.
    Please run 'i_ocsvm.py' in folder 'ocsvm_prob' before run this.

  - 'exp_relation.py'
    Plot the relationship between probabilities and decision values of data sets art1 and art2. Probabilities are from ideal probabilities, Platt scaling, binning equidistantly, binning by density, new Gamma scaling, Gaussian RN and Gamma RN.
    Calculate the mean square error of the probabilities generated by Gaussian RN and Gamma RN.
    Please run 'exp_all.sh' in folder 'ocsvm_prob' before run this.

  - 'exp_qqplot.py'
    Plot the Q-Q plot of probabilities generated by Platt scaling, binning by density and new Gamma scaling on data sets art1, art2, art3, fourclass_scale_oc and usps_oc.
    Please run 'exp_all.sh' in folder 'ocsvm_prob' before run this.

  - 'exp_plattlabel.py'
    Plot the predicted probabilities of Platt scaling on art1 with or without true labels.
    Please run 'exp_plattlabel_1.sh' and 'exp_plattlabel_2.sh' in folder 'ocsvm_prob' before run this. Don't forget to modify the 'svm.cpp' in folder 'ocsvm_prob' and recompile refer to the comments in 'exp_plattlabel_1.sh'.
