StompException::getDetails
Introduction
Other Services
PHP Manual

# Support Vector Machine

Table of Contents

- Introduction
- Installing/Configuring
  - Requirements
  - Installation
  - Runtime Configuration
  - Resource Types
- Examples
- SVM — The SVM class
  - SVM::__construct — Construct a new SVM object
  - SVM::crossvalidate — Test training params on subsets of the training data.
  - SVM::getOptions — Return the current training parameters
  - SVM::setOptions — Set training parameters
  - SVM::train — Create a SVMModel based on training data
- SVMModel — The SVMModel class
  - SVMModel::checkProbabilityModel — Returns true if the model has probability information
  - SVMModel::__construct — Construct a new SVMModel
  - SVMModel::getLabels — Get the labels the model was trained on
  - SVMModel::getNrClass — Returns the number of classes the model was trained with
  - SVMModel::getSvmType — Get the SVM type the model was trained with
  - SVMModel::getSvrProbability — Get the sigma value for regression types
  - SVMModel::load — Load a saved SVM Model
  - SVMModel::predict_probability — Return class probabilities for previous unseen data
  - SVMModel::predict — Predict a value for previously unseen data
  - SVMModel::save — Save a model to a file

# The SVM class

## Introduction

## Class synopsis

SVM
class SVM {
/* Constants */
const integer SVM::C_SVC = 0 ;
const integer SVM::NU_SVC = 1 ;
const integer SVM::ONE_CLASS = 2 ;
const integer SVM::EPSILON_SVR = 3 ;
const integer SVM::NU_SVR = 4 ;
const integer SVM::KERNEL_LINEAR = 0 ;
const integer SVM::KERNEL_POLY = 1 ;
const integer SVM::KERNEL_RBF = 2 ;
const integer SVM::KERNEL_SIGMOID = 3 ;
const integer SVM::KERNEL_PRECOMPUTED = 4 ;
const integer SVM::OPT_TYPE = 101 ;
const integer SVM::OPT_KERNEL_TYPE = 102 ;
const integer SVM::OPT_DEGREE = 103 ;
const integer SVM::OPT_SHRINKING = 104 ;
const integer SVM::OPT_PROPABILITY = 105 ;
const integer SVM::OPT_GAMMA = 201 ;
const integer SVM::OPT_NU = 202 ;
const integer SVM::OPT_EPS = 203 ;
const integer SVM::OPT_P = 204 ;
const integer SVM::OPT_COEF_ZERO = 205 ;
const integer SVM::OPT_C = 206 ;
const integer SVM::OPT_CACHE_SIZE = 207 ;
/* Methods */
public __construct ( void )
public float svm::crossvalidate ( array `$problem` , int `$number_of_folds` )
public array getOptions ( void )
public bool setOptions ( array `$params` )
public SVMModel svm::train ( array `$problem` [, array `$weights` ] )
}

## Predefined Constants

## SVM Constants

`SVM::C_SVC`

  The basic C_SVC SVM type. The default, and a good starting point

`SVM::NU_SVC`

  The NU_SVC type uses a different, more flexible, error weighting

`SVM::ONE_CLASS`

  One class SVM type. Train just on a single class, using outliers as negative examples

`SVM::EPSILON_SVR`

  A SVM type for regression (predicting a value rather than just a class)

`SVM::NU_SVR`

  A NU style SVM regression type

`SVM::KERNEL_LINEAR`

  A very simple kernel, can work well on large document classification problems

`SVM::KERNEL_POLY`

  A polynomial kernel

`SVM::KERNEL_RBF`

  The common Gaussian RBD kernel. Handles non-linear problems well and is a good default for classification

`SVM::KERNEL_SIGMOID`

  A kernel based on the sigmoid function. Using this makes the SVM very similar to a two layer sigmoid based neural network

`SVM::KERNEL_PRECOMPUTED`

  A precomputed kernel - currently unsupported.

`SVM::OPT_TYPE`

  The options key for the SVM type

`SVM::OPT_KERNEL_TYPE`

  The options key for the kernel type

`SVM::OPT_DEGREE`

`SVM::OPT_SHRINKING`

  Training parameter, boolean, for whether to use the shrinking heuristics

`SVM::OPT_PROBABILITY`

  Training parameter, boolean, for whether to collect and use probability estimates

`SVM::OPT_GAMMA`

  Algorithm parameter for Poly, RBF and Sigmoid kernel types.

`SVM::OPT_NU`

  The option key for the nu parameter, only used in the NU_ SVM types

`SVM::OPT_EPS`

  The option key for the Epsilon parameter, used in epsilon regression

`SVM::OPT_P`

  Training parameter used by Episilon SVR regression

`SVM::OPT_COEF_ZERO`

  Algorithm parameter for poly and sigmoid kernels

`SVM::OPT_C`

  The option for the cost parameter that controls tradeoff between errors and generality - effectively the penalty for misclassifying training examples.

`SVM::OPT_CACHE_SIZE`

  Memory cache size, in MB

# The SVMModel class

## Introduction

The SVMModel is the end result of the training process. It can be used to classify previously unseen data.

## Class synopsis

SVMModel
class SVMModel {
/* Methods */
public bool checkProbabilityModel ( void )
public __construct ([ string `$filename` ] )
public array getLabels ( void )
public int getNrClass ( void )
public int getSvmType ( void )
public float getSvrProbability ( void )
public bool load ( string `$filename` )
public float predict_probability ( array `$data` )
public float predict ( array `$data` )
public bool save ( string `$filename` )
}