2
A Support Vector Machine, this module defines the following classes:
4
- `LibSvmCClassificationModel`, a model for C-SV classification
5
- `LibSvmNuClassificationModel`, a model for nu-SV classification
6
- `LibSvmEpsilonRegressionModel`, a model for epsilon-SV regression
7
- `LibSvmNuRegressionModel`, a model for nu-SV regression
8
- `LibSvmOneClassModel`, a model for distribution estimation
13
- `LinearKernel`, a linear kernel
14
- `PolynomialKernel`, a polynomial kernel
15
- `RBFKernel`, a radial basis function kernel
16
- `SigmoidKernel`, a sigmoid kernel
17
- `CustomKernel`, a kernel that wraps any callable
21
- `LibSvmClassificationDataSet`, a dataset for training classification
23
- `LibSvmRegressionDataSet`, a dataset for training regression models
24
- `LibSvmOneClassDataSet`, a dataset for training distribution
25
estimation (one-class SVM) models
26
- `LibSvmTestDataSet`, a dataset for testing with any model
30
- `svm_node_dtype`, the libsvm data type for its arrays
32
How To Use This Module
33
======================
34
(See the individual classes, methods, and attributes for details.)
36
1. Import it: ``import svm`` or ``from svm import ...``.
38
2. Create a training dataset for your problem::
40
traindata = LibSvmClassificationDataSet(labels, x)
41
traindata = LibSvmRegressionDataSet(y, x)
42
traindata = LibSvmOneClassDataSet(x)
44
where x is sequence of NumPy arrays containing scalars or
45
svm_node_dtype entries.
47
3. Create a test dataset::
49
testdata = LibSvmTestDataSet(u)
51
4. Create a model and fit it to the training data::
53
model = LibSvmCClassificationModel(kernel)
54
results = model.fit(traindata)
56
5. Use the results to make predictions with the test data::
58
p = results.predict(testdata)
59
v = results.predict_values(testdata)
62
from classification import *
63
from regression import *
64
from oneclass import *