~ubuntu-branches/ubuntu/saucy/python-scipy/saucy

« back to all changes in this revision

Viewing changes to Lib/sandbox/svm/__init__.py

  • Committer: Bazaar Package Importer
  • Author(s): Ondrej Certik
  • Date: 2008-06-16 22:58:01 UTC
  • mfrom: (2.1.24 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080616225801-irdhrpcwiocfbcmt
Tags: 0.6.0-12
* The description updated to match the current SciPy (Closes: #489149).
* Standards-Version bumped to 3.8.0 (no action needed)
* Build-Depends: netcdf-dev changed to libnetcdf-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
"""
2
 
A Support Vector Machine, this module defines the following classes:
3
 
 
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
9
 
  (one-class SVM)
10
 
 
11
 
Kernel classes:
12
 
 
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
18
 
 
19
 
Dataset classes:
20
 
 
21
 
- `LibSvmClassificationDataSet`, a dataset for training classification
22
 
  models
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
27
 
 
28
 
Data type classes:
29
 
 
30
 
- `svm_node_dtype`, the libsvm data type for its arrays
31
 
 
32
 
How To Use This Module
33
 
======================
34
 
(See the individual classes, methods, and attributes for details.)
35
 
 
36
 
1. Import it: ``import svm`` or ``from svm import ...``.
37
 
 
38
 
2. Create a training dataset for your problem::
39
 
 
40
 
       traindata = LibSvmClassificationDataSet(labels, x)
41
 
       traindata = LibSvmRegressionDataSet(y, x)
42
 
       traindata = LibSvmOneClassDataSet(x)
43
 
 
44
 
   where x is sequence of NumPy arrays containing scalars or
45
 
   svm_node_dtype entries.
46
 
 
47
 
3. Create a test dataset::
48
 
 
49
 
       testdata = LibSvmTestDataSet(u)
50
 
 
51
 
4. Create a model and fit it to the training data::
52
 
 
53
 
       model = LibSvmCClassificationModel(kernel)
54
 
       results = model.fit(traindata)
55
 
 
56
 
5. Use the results to make predictions with the test data::
57
 
 
58
 
       p = results.predict(testdata)
59
 
       v = results.predict_values(testdata)
60
 
"""
61
 
 
62
 
from classification import *
63
 
from regression import *
64
 
from oneclass import *
65
 
from dataset import *
66
 
from kernel import *
67
 
from predict import *