source: orange/docs/reference/rst/Orange.classification.svm.rst @ 10696:2aafab564b58

Revision 10696:2aafab564b58, 4.4 KB checked in by Ales Erjavec <ales.erjavec@…>, 2 years ago (diff)

Added more documentation for feature scoring/selection classes.

RevLine 
[10369]1.. py:currentmodule:: Orange.classification.svm
2
3.. index:: support vector machines (SVM)
4.. index:
5   single: classification; support vector machines (SVM)
6   
7*********************************
8Support Vector Machines (``svm``)
9*********************************
10
11The module for `Support Vector Machine`_ (SVM) classification is based
12on the popular `LibSVM`_ and `LIBLINEAR`_ libraries. It provides several
13learning algorithms:
14
15- :obj:`SVMLearner`, a general SVM learner;
16- :obj:`SVMLearnerEasy`, which is similar to the `svm-easy.py` script
17    from the LibSVM distribution and helps with the data normalization and
18    parameter tuning;
19- :obj:`LinearSVMLearner`, a fast learner useful for data sets with a large
20    number of features.
21         
22SVM learners (from `LibSVM`_)
23=============================
24
25:class:`SVMLearner` uses the standard `LibSVM`_ learner. It supports
26several built-in kernel types and user-defined kernels functions
27written in Python. The kernel type is denoted by constants ``Linear``,
28``Polynomial``, ``RBF``, ``Sigmoid`` and ``Custom`` defined in
29``Orange.classification.svm.kernels``.  A custom kernel function must
30accept two data instances and return a float. See
31:ref:`kernel-wrapper` for examples.
32   
33The class also supports several types of optimization: ``C_SVC``,
34``Nu_SVC`` (default), ``OneClass``, ``Epsilon_SVR`` and ``Nu_SVR``
35(defined in ``Orange.classification.svm.SVMLearner``).
36
37Class :obj:`SVMLearner` works on non-sparse data and
38:class:`SVMLearnerSparse` class works on sparse data sets, for
39instance data from the `basket` format).
40
41.. autoclass:: Orange.classification.svm.SVMLearner
42    :members:
43
44.. autoclass:: Orange.classification.svm.SVMLearnerSparse
45    :members:
46    :show-inheritance:
47   
48.. autoclass:: Orange.classification.svm.SVMLearnerEasy
49    :members:
50    :show-inheritance:
51
52The example below compares the performances of :obj:`SVMLearnerEasy`
53with automatic data preprocessing and parameter tuning and
54:obj:`SVMLearner` with the default :obj:`~SVMLearner.nu` and
55:obj:`~SVMLearner.gamma`:
56   
57.. literalinclude:: code/svm-easy.py
58
59
60   
61Linear SVM learners (from `LIBLINEAR`_)
62=======================================
63
64Linear SVM learners are more suitable for large scale problems since
65they are significantly faster then :class:`SVMLearner` and its
66subclasses. A down side is that they support only a linear kernel and
67can not estimate probabilities.
68   
69.. autoclass:: Orange.classification.svm.LinearSVMLearner
70   :members:
71   
72.. autoclass:: Orange.classification.svm.MultiClassSVMLearner
73   :members:
74   
75   
76SVM Based feature selection and scoring
77=======================================
78
79.. autoclass:: Orange.classification.svm.RFE
[10696]80   :members: __init__, __call__
[10369]81
82.. autoclass:: Orange.classification.svm.ScoreSVMWeights
[10696]83   :members: __init__, __call__
84   :show-inheritance:
[10369]85 
86 
87Utility functions
88=================
89
90.. automethod:: Orange.classification.svm.max_nu
91
92.. automethod:: Orange.classification.svm.get_linear_svm_weights
93
94.. automethod:: Orange.classification.svm.table_to_svm_format
95
96The following example shows how to get linear SVM weights:
97   
98.. literalinclude:: code/svm-linear-weights.py   
99
100
101.. _kernel-wrapper:
102
103Kernel wrappers
104===============
105
106Kernel wrappers are helper classes for building custom kernels for use
107with :class:`SVMLearner` and subclasses. They take and transform one
108or two Python functions (attributes :obj:`wrapped` or :obj:`wrapped1`
109and :obj:`wrapped2`). The function must be a positive definite kernel
110that takes two arguments of type :class:`Orange.data.Instance` and
111returns a float.
112
113.. autoclass:: Orange.classification.svm.kernels.KernelWrapper
114   :members:
115
116.. autoclass:: Orange.classification.svm.kernels.DualKernelWrapper
117   :members:
118
119.. autoclass:: Orange.classification.svm.kernels.RBFKernelWrapper
120   :members:
121
122.. autoclass:: Orange.classification.svm.kernels.PolyKernelWrapper
123   :members:
124
125.. autoclass:: Orange.classification.svm.kernels.AdditionKernelWrapper
126   :members:
127
128.. autoclass:: Orange.classification.svm.kernels.MultiplicationKernelWrapper
129   :members:
130
131.. autoclass:: Orange.classification.svm.kernels.CompositeKernelWrapper
132   :members:
133
134.. autoclass:: Orange.classification.svm.kernels.SparseLinKernel
135   :members:
136
137Example:
138
139.. literalinclude:: code/svm-custom-kernel.py
140
141.. _`Support Vector Machine`: http://en.wikipedia.org/wiki/Support_vector_machine
142.. _`LibSVM`: http://www.csie.ntu.edu.tw/~cjlin/libsvm/
143.. _`LIBLINEAR`: http://www.csie.ntu.edu.tw/~cjlin/liblinear/
Note: See TracBrowser for help on using the repository browser.