1
0
mirror of https://github.com/php/doc-en.git synced 2026-03-23 23:32:18 +01:00

svm : fix XML by converting para to simpara tags via script

This commit is contained in:
Gina Peter Banyard
2026-01-26 14:23:18 +00:00
parent 63d53ffd1a
commit 1ca2d4af94
22 changed files with 191 additions and 219 deletions

View File

@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- State: experimental -->
<book xml:id="book.svm" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<book xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="book.svm">
<?phpdoc extension-membership="pecl" ?>
<title>Support Vector Machine</title>
<titleabbrev>SVM</titleabbrev>
@@ -10,10 +9,10 @@
<preface xml:id="intro.svm">
&reftitle.intro;
&warn.experimental;
<para>
<simpara>
LibSVM is an efficient solver for SVM classification and regression problems.
The svm extension wraps this in a PHP interface for easy use in PHP scripts.
</para>
</simpara>
</preface>
&reference.svm.setup;
@@ -23,7 +22,6 @@
&reference.svm.svmmodel;
</book>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -1,17 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<section xml:id="svm.installation" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="svm.installation">
&reftitle.install;
<para>
<simpara>
&pecl.info;
<link xlink:href="&url.pecl.package;svm">&url.pecl.package;svm</link>
</para>
</simpara>
</section>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -1,52 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<chapter xml:id="svm.examples" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="svm.examples">
&reftitle.examples;
<para>
The basic process is to define parameters, supply training data to generate a
model on, then make predictions based on the model. There are a default set
of parameters that should get some results with most any input, so we'll start
by looking at the data.
</para>
<para>
Data is supplied in either a file, a stream, or as an array. If supplied in
a file or a stream, it must contain one line per training example, which must
be formatted as an integer class (usually 1 and -1) followed by a series of
feature/value pairs, in increasing feature order. The features are integers,
<simpara>
The basic process is to define parameters, supply training data to generate a
model on, then make predictions based on the model. There are a default set
of parameters that should get some results with most any input, so we'll start
by looking at the data.
</simpara>
<simpara>
Data is supplied in either a file, a stream, or as an array. If supplied in
a file or a stream, it must contain one line per training example, which must
be formatted as an integer class (usually 1 and -1) followed by a series of
feature/value pairs, in increasing feature order. The features are integers,
the values floats, usually scaled 0-1. For example:
</para>
<para>
</simpara>
<simpara>
-1 1:0.43 3:0.12 9284:0.2
</para>
<para>
In a document classification problem, say a spam checker, each line would
represent a document. There would be two classes, -1 for spam, 1 for ham.
Each feature would represent some word, and the value would represent that
importance of that word to the document (perhaps the frequency count, with
the total scaled to unit length). Features that were 0 (e.g. the word did
</simpara>
<simpara>
In a document classification problem, say a spam checker, each line would
represent a document. There would be two classes, -1 for spam, 1 for ham.
Each feature would represent some word, and the value would represent that
importance of that word to the document (perhaps the frequency count, with
the total scaled to unit length). Features that were 0 (e.g. the word did
not appear in the document at all) would simply not be included.
</para>
<para>
In array mode, the data must be passed as an array of arrays. Each sub-array
must have the class as the first element, then key => value sets for the
</simpara>
<simpara>
In array mode, the data must be passed as an array of arrays. Each sub-array
must have the class as the first element, then key =&gt; value sets for the
feature values pairs.
</para>
<para>
This data is passed to the SVM class's train function, which will return an
</simpara>
<simpara>
This data is passed to the SVM class's train function, which will return an
SVM model is successful.
</para>
<para>
Once a model has been generated, it can be used to make predictions about
previously unseen data. This can be passed as an array to the model's
predict function, in the same format as before, but without the label.
The response will be the class.
</para>
<para>
Models can be saved and restored as required, using the save and load
functions, which both take a file location.
</para>
</simpara>
<simpara>
Once a model has been generated, it can be used to make predictions about
previously unseen data. This can be passed as an array to the model's
predict function, in the same format as before, but without the label.
The response will be the class.
</simpara>
<simpara>
Models can be saved and restored as required, using the save and load
functions, which both take a file location.
</simpara>
<para>
<example>
<title>Train from array</title>
@@ -88,7 +87,6 @@ $model = $svm->train("traindata.txt");
</example>
</para>
</chapter>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
@@ -109,4 +107,3 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -1,19 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<chapter xml:id="svm.setup" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="svm.setup">
&reftitle.setup;
<section xml:id="svm.requirements">
&reftitle.required;
<para>
<simpara>
Libsvm itself is required, and is available through some package
management - libsvm-devel for RPM based system or libsvm-dev for
Debian based ones. Alternatively it is available direct from the website.
If installing from the <link xlink:href="&url.svm;">official website</link>
then some steps will need to be taken as the package does not install
automatically. For example, assuming the latest version is 3.1:
</para>
</simpara>
<screen>
<![CDATA[
wget http://www.csie.ntu.edu.tw/~cjlin/cgi-bin/libsvm.cgi?+http://www.csie.ntu.edu.tw/~cjlin/libsvm+tar.gz
@@ -27,21 +26,20 @@ ldconfig --print | grep libsvm
]]>
</screen>
<para>
<simpara>
This last step should show libsvm is installed.
</para>
</simpara>
</section>
<section xml:id="svm.installation">
&reftitle.install;
<para>
<simpara>
&pecl.info;
<link xlink:href="&url.pecl.package;svm">&url.pecl.package;svm</link>
</para>
</simpara>
</section>
</chapter>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<reference xml:id="class.svm" role="class" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<reference xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xml:id="class.svm" role="class">
<title>The SVM class</title>
<titleabbrev>SVM</titleabbrev>
@@ -11,9 +10,9 @@
<!-- {{{ svm intro -->
<section xml:id="svm.intro">
&reftitle.intro;
<para>
<simpara>
</para>
</simpara>
</section>
<!-- }}} -->
@@ -187,154 +186,154 @@
<varlistentry xml:id="svm.constants.c-svc">
<term><constant>SVM::C_SVC</constant></term>
<listitem>
<para>The basic C_SVC SVM type. The default, and a good starting point</para>
<simpara>The basic C_SVC SVM type. The default, and a good starting point</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="svm.constants.nu-svc">
<term><constant>SVM::NU_SVC</constant></term>
<listitem>
<para>The NU_SVC type uses a different, more flexible, error weighting</para>
<simpara>The NU_SVC type uses a different, more flexible, error weighting</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="svm.constants.one-class">
<term><constant>SVM::ONE_CLASS</constant></term>
<listitem>
<para>One class SVM type. Train just on a single class, using outliers as negative examples</para>
<simpara>One class SVM type. Train just on a single class, using outliers as negative examples</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="svm.constants.epsilon-svr">
<term><constant>SVM::EPSILON_SVR</constant></term>
<listitem>
<para>A SVM type for regression (predicting a value rather than just a class)</para>
<simpara>A SVM type for regression (predicting a value rather than just a class)</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="svm.constants.nu-svr">
<term><constant>SVM::NU_SVR</constant></term>
<listitem>
<para>A NU style SVM regression type</para>
<simpara>A NU style SVM regression type</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="svm.constants.kernel-linear">
<term><constant>SVM::KERNEL_LINEAR</constant></term>
<listitem>
<para>A very simple kernel, can work well on large document classification problems</para>
<simpara>A very simple kernel, can work well on large document classification problems</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="svm.constants.kernel-poly">
<term><constant>SVM::KERNEL_POLY</constant></term>
<listitem>
<para>A polynomial kernel</para>
<simpara>A polynomial kernel</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="svm.constants.kernel-rbf">
<term><constant>SVM::KERNEL_RBF</constant></term>
<listitem>
<para>The common Gaussian RBD kernel. Handles non-linear problems well and is a good default for classification</para>
<simpara>The common Gaussian RBD kernel. Handles non-linear problems well and is a good default for classification</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="svm.constants.kernel-sigmoid">
<term><constant>SVM::KERNEL_SIGMOID</constant></term>
<listitem>
<para>A kernel based on the sigmoid function. Using this makes the SVM very similar to a two layer sigmoid based neural network</para>
<simpara>A kernel based on the sigmoid function. Using this makes the SVM very similar to a two layer sigmoid based neural network</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="svm.constants.kernel-precomputed">
<term><constant>SVM::KERNEL_PRECOMPUTED</constant></term>
<listitem>
<para>A precomputed kernel - currently unsupported.</para>
<simpara>A precomputed kernel - currently unsupported.</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="svm.constants.opt-type">
<term><constant>SVM::OPT_TYPE</constant></term>
<listitem>
<para>The options key for the SVM type</para>
<simpara>The options key for the SVM type</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="svm.constants.opt-kernel-type">
<term><constant>SVM::OPT_KERNEL_TYPE</constant></term>
<listitem>
<para>The options key for the kernel type</para>
<simpara>The options key for the kernel type</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="svm.constants.opt-degree">
<term><constant>SVM::OPT_DEGREE</constant></term>
<listitem>
<para></para>
<simpara/>
</listitem>
</varlistentry>
<varlistentry xml:id="svm.constants.opt-shrinking">
<term><constant>SVM::OPT_SHRINKING</constant></term>
<listitem>
<para>Training parameter, boolean, for whether to use the shrinking heuristics</para>
<simpara>Training parameter, boolean, for whether to use the shrinking heuristics</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="svm.constants.opt-probability">
<term><constant>SVM::OPT_PROBABILITY</constant></term>
<listitem>
<para>Training parameter, boolean, for whether to collect and use probability estimates</para>
<simpara>Training parameter, boolean, for whether to collect and use probability estimates</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="svm.constants.opt-gamma">
<term><constant>SVM::OPT_GAMMA</constant></term>
<listitem>
<para>Algorithm parameter for Poly, RBF and Sigmoid kernel types.</para>
<simpara>Algorithm parameter for Poly, RBF and Sigmoid kernel types.</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="svm.constants.opt-nu">
<term><constant>SVM::OPT_NU</constant></term>
<listitem>
<para>The option key for the nu parameter, only used in the NU_ SVM types</para>
<simpara>The option key for the nu parameter, only used in the NU_ SVM types</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="svm.constants.opt-eps">
<term><constant>SVM::OPT_EPS</constant></term>
<listitem>
<para>The option key for the Epsilon parameter, used in epsilon regression</para>
<simpara>The option key for the Epsilon parameter, used in epsilon regression</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="svm.constants.opt-p">
<term><constant>SVM::OPT_P</constant></term>
<listitem>
<para>Training parameter used by Episilon SVR regression</para>
<simpara>Training parameter used by Episilon SVR regression</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="svm.constants.opt-coef-zero">
<term><constant>SVM::OPT_COEF_ZERO</constant></term>
<listitem>
<para>Algorithm parameter for poly and sigmoid kernels</para>
<simpara>Algorithm parameter for poly and sigmoid kernels</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="svm.constants.opt-c">
<term><constant>SVM::OPT_C</constant></term>
<listitem>
<para>The option for the cost parameter that controls tradeoff between errors and generality - effectively the penalty for misclassifying training examples. </para>
<simpara>The option for the cost parameter that controls tradeoff between errors and generality - effectively the penalty for misclassifying training examples. </simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="svm.constants.opt-cache-size">
<term><constant>SVM::OPT_CACHE_SIZE</constant></term>
<listitem>
<para>Memory cache size, in MB</para>
<simpara>Memory cache size, in MB</simpara>
</listitem>
</varlistentry>
</variablelist>
@@ -348,7 +347,6 @@
&reference.svm.entities.svm;
</reference>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="svm.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="svm.construct">
<refnamediv>
<refname>SVM::__construct</refname>
<refpurpose>Construct a new SVM object</refpurpose>
@@ -11,11 +10,11 @@
&reftitle.description;
<constructorsynopsis>
<modifier>public</modifier> <methodname>SVM::__construct</methodname>
<void />
<void/>
</constructorsynopsis>
<para>
Constructs a new SVM object ready to accept training data.
</para>
<simpara>
Constructs a new SVM object ready to accept training data.
</simpara>
</refsect1>
@@ -26,14 +25,13 @@
<refsect1 role="errors">
&reftitle.errors;
<para>
<simpara>
Throws a <classname>SVMException</classname> if the libsvm
library could not be loaded.
</para>
</simpara>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -13,7 +13,7 @@
<methodparam><type>array</type><parameter>problem</parameter></methodparam>
<methodparam><type>int</type><parameter>number_of_folds</parameter></methodparam>
</methodsynopsis>
<para>
<simpara>
Crossvalidate can be used to test the effectiveness of the current
parameter set on a subset of the training data. Given a problem set
and a n "folds", it separates the problem set into n subsets, and the
@@ -21,7 +21,7 @@
will generally be lower than a SVM trained on the enter data set, the
accuracy score returned should be relatively useful, so it can be used to
test different training parameters.
</para>
</simpara>
</refsect1>
@@ -31,21 +31,21 @@
<varlistentry>
<term><parameter>problem</parameter></term>
<listitem>
<para>
<simpara>
The problem data. This can either be in the form of an array, the URL
of an SVMLight formatted file, or a stream to an opened SVMLight
formatted datasource.
</para>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>number_of_folds</parameter></term>
<listitem>
<para>
<simpara>
The number of sets the data should be divided into and cross tested.
A higher number means smaller training sets and less reliability. 5 is
a good number to start with.
</para>
</simpara>
</listitem>
</varlistentry>
</variablelist>
@@ -53,11 +53,11 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
<simpara>
The correct percentage, expressed as a floating point number from 0-1.
In the case of NU_SVC or EPSILON_SVR kernels the mean squared error will
returned instead.
</para>
</simpara>
</refsect1>
<refsect1 role="seealso">

View File

@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="svm.getoptions" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="svm.getoptions">
<refnamediv>
<refname>SVM::getOptions</refname>
<refpurpose>Return the current training parameters</refpurpose>
@@ -11,12 +10,12 @@
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>array</type><methodname>SVM::getOptions</methodname>
<void />
<void/>
</methodsynopsis>
<para>
Retrieve an array containing the training parameters.
The parameters will be keyed on the predefined SVM constants.
</para>
<simpara>
Retrieve an array containing the training parameters.
The parameters will be keyed on the predefined SVM constants.
</simpara>
</refsect1>
@@ -27,14 +26,13 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns an array of configuration settings.
</para>
<simpara>
Returns an array of configuration settings.
</simpara>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -12,9 +12,9 @@
<modifier>public</modifier> <type>bool</type><methodname>SVM::setOptions</methodname>
<methodparam><type>array</type><parameter>params</parameter></methodparam>
</methodsynopsis>
<para>
<simpara>
Set one or more training parameters.
</para>
</simpara>
</refsect1>
@@ -24,9 +24,9 @@
<varlistentry>
<term><parameter>params</parameter></term>
<listitem>
<para>
<simpara>
An array of training parameters, keyed on the SVM constants.
</para>
</simpara>
</listitem>
</varlistentry>
</variablelist>
@@ -34,9 +34,9 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
<simpara>
Return true on success, throws SVMException on error.
</para>
</simpara>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View File

@@ -13,9 +13,9 @@
<methodparam><type>array</type><parameter>problem</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>weights</parameter></methodparam>
</methodsynopsis>
<para>
<simpara>
Train a support vector machine based on the supplied training data.
</para>
</simpara>
</refsect1>
@@ -25,7 +25,7 @@
<varlistentry>
<term><parameter>problem</parameter></term>
<listitem>
<para>
<simpara>
The problem can be provided in three different ways.
An array, where the data should start with the class label
(usually 1 or -1) then followed by a sparse data set of
@@ -35,18 +35,18 @@
containing the class (1, -1) then a series of tab separated data
values shows as key:value.
A opened stream pointing to a data source formatted as in the file above.
</para>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>weights</parameter></term>
<listitem>
<para>
<simpara>
Weights are an optional set of weighting parameters for the different
classes, to help account for unbalanced training sets. For example,
if the classes were 1 and -1, and -1 had significantly more example
than one, the weight for -1 could be 0.5. Weights should be in the range 0-1.
</para>
</simpara>
</listitem>
</varlistentry>
</variablelist>
@@ -54,10 +54,10 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
<simpara>
Returns an SVMModel that can be used to classify previously unseen data.
Throws SVMException on error
</para>
</simpara>
</refsect1>
</refentry>

View File

@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<reference xml:id="class.svmexception" role="class" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<reference xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xml:id="class.svmexception" role="class">
<title>The SVMException class</title>
<titleabbrev>SVMException</titleabbrev>
@@ -11,9 +10,9 @@
<!-- {{{ svmexception intro -->
<section xml:id="svmexception.intro">
&reftitle.intro;
<para>
<simpara>
The exception object thrown on errors from the SVM and SVMModel classes.
</para>
</simpara>
</section>
<!-- }}} -->
@@ -29,7 +28,7 @@
<ooclass>
<classname>SVMException</classname>
</ooclass>
<ooclass>
<modifier>extends</modifier>
<classname>Exception</classname>
@@ -37,26 +36,25 @@
</classsynopsisinfo>
<!-- }}} -->
<classsynopsisinfo role="comment">&InheritedProperties;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('exception.synopsis')/descendant::db:fieldsynopsis)" />
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('exception.synopsis')/descendant::db:fieldsynopsis)"/>
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.svmexception')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.svmexception')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])"/>
<classsynopsisinfo role="comment">&InheritedMethods;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.exception')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.exception')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])"/>
</classsynopsis>
<!-- }}} -->
</section>
</partintro>
&reference.svm.entities.svmexception;
</reference>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<reference xml:id="class.svmmodel" role="class" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<reference xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xml:id="class.svmmodel" role="class">
<title>The SVMModel class</title>
<titleabbrev>SVMModel</titleabbrev>
@@ -11,10 +10,10 @@
<!-- {{{ svmmodel intro -->
<section xml:id="svmmodel.intro">
&reftitle.intro;
<para>
<simpara>
The SVMModel is the end result of the training process.
It can be used to classify previously unseen data.
</para>
</simpara>
</section>
<!-- }}} -->
@@ -50,7 +49,6 @@
&reference.svm.entities.svmmodel;
</reference>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="svmmodel.checkprobabilitymodel" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- $Revision$ -->
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="svmmodel.checkprobabilitymodel">
<refnamediv>
<refname>SVMModel::checkProbabilityModel</refname>
<refpurpose>Returns true if the model has probability information</refpurpose>
@@ -11,11 +10,11 @@
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>SVMModel::checkProbabilityModel</methodname>
<void />
<void/>
</methodsynopsis>
<para>
<simpara>
Returns true if the model contains probability information.
</para>
</simpara>
</refsect1>
@@ -26,13 +25,12 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
<simpara>
Return a boolean value
</para>
</simpara>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -12,10 +12,10 @@
<modifier>public</modifier> <methodname>SVMModel::__construct</methodname>
<methodparam choice="opt"><type>string</type><parameter>filename</parameter></methodparam>
</constructorsynopsis>
<para>
<simpara>
Build a new SVMModel. Models will usually be created from the
SVM::train function, but then saved models may be restored directly.
</para>
</simpara>
</refsect1>
@@ -25,9 +25,9 @@
<varlistentry>
<term><parameter>filename</parameter></term>
<listitem>
<para>
<simpara>
The filename for the saved model file this model should load.
</para>
</simpara>
</listitem>
</varlistentry>
</variablelist>
@@ -35,9 +35,9 @@
<refsect1 role="errors">
&reftitle.errors;
<para>
<simpara>
Throws a <classname>SVMException</classname> on error
</para>
</simpara>
</refsect1>
<refsect1 role="seealso">

View File

@@ -12,10 +12,10 @@
<modifier>public</modifier> <type>array</type><methodname>SVMModel::getLabels</methodname>
<void/>
</methodsynopsis>
<para>
<simpara>
Return an array of labels that the model was trained on. For regression and one class
models an empty array is returned.
</para>
</simpara>
</refsect1>
@@ -26,9 +26,9 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
<simpara>
Return an array of labels
</para>
</simpara>
</refsect1>
<refsect1 role="seealso">

View File

@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="svmmodel.getnrclass" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- $Revision$ -->
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="svmmodel.getnrclass">
<refnamediv>
<refname>SVMModel::getNrClass</refname>
<refpurpose>Returns the number of classes the model was trained with</refpurpose>
@@ -11,11 +10,11 @@
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>int</type><methodname>SVMModel::getNrClass</methodname>
<void />
<void/>
</methodsynopsis>
<para>
<simpara>
Returns the number of classes the model was trained with, will return 2 for one class and regression models.
</para>
</simpara>
</refsect1>
@@ -26,13 +25,12 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
<simpara>
Return an integer number of classes
</para>
</simpara>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="svmmodel.getsvmtype" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- $Revision$ -->
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="svmmodel.getsvmtype">
<refnamediv>
<refname>SVMModel::getSvmType</refname>
<refpurpose>Get the SVM type the model was trained with</refpurpose>
@@ -11,11 +10,11 @@
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>int</type><methodname>SVMModel::getSvmType</methodname>
<void />
<void/>
</methodsynopsis>
<para>
<simpara>
Returns an integer value representing the type of the SVM model used, e.g SVM::C_SVC.
</para>
</simpara>
</refsect1>
@@ -26,13 +25,12 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
<simpara>
Return an integer SVM type
</para>
</simpara>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="svmmodel.getsvrprobability" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="svmmodel.getsvrprobability">
<refnamediv>
<refname>SVMModel::getSvrProbability</refname>
<refpurpose>Get the sigma value for regression types</refpurpose>
@@ -11,12 +10,12 @@
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>float</type><methodname>SVMModel::getSvrProbability</methodname>
<void />
<void/>
</methodsynopsis>
<para>
<simpara>
For regression models, returns a sigma value. If there is no probability
information or the model is not SVR, 0 is returned.
</para>
</simpara>
</refsect1>
@@ -27,13 +26,12 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
<simpara>
Returns a sigma value
</para>
</simpara>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -12,9 +12,9 @@
<modifier>public</modifier> <type>bool</type><methodname>SVMModel::load</methodname>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
</methodsynopsis>
<para>
<simpara>
Load a model file ready for classification or regression.
</para>
</simpara>
</refsect1>
@@ -24,9 +24,9 @@
<varlistentry>
<term><parameter>filename</parameter></term>
<listitem>
<para>
<simpara>
The filename of the model.
</para>
</simpara>
</listitem>
</varlistentry>
</variablelist>
@@ -34,10 +34,10 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
<simpara>
Throws SVMException on error.
Returns true on success.
</para>
</simpara>
</refsect1>
<refsect1 role="seealso">

View File

@@ -12,12 +12,12 @@
<modifier>public</modifier> <type>float</type><methodname>SVMModel::predict_probability</methodname>
<methodparam><type>array</type><parameter>data</parameter></methodparam>
</methodsynopsis>
<para>
<simpara>
This function accepts an array of data and attempts to predict the class, as with the predict function.
Additionally, however, this function returns an array of probabilities, one per class in the model, which
represent the estimated chance of the data supplied being a member of that class. Requires that the model
to be used has been trained with the probability parameter set to true.
</para>
</simpara>
</refsect1>
@@ -27,20 +27,20 @@
<varlistentry>
<term><parameter>data</parameter></term>
<listitem>
<para>
<simpara>
The array to be classified. This should be a series of key =&gt; value
pairs in increasing key order, but not necessarily continuous.
</para>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>probabilities</parameter></term>
<listitem>
<para>
<simpara>
The supplied value will be filled with the probabilities. This will be either null, in the case
of a model without probability information, or an array where the index is the class name and the value
the predicted probability.
</para>
</simpara>
</listitem>
</varlistentry>
</variablelist>
@@ -48,11 +48,11 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
<simpara>
Float the predicted value. This will be a class label in the case of
classification, a real value in the case of regression.
Throws SVMException on error
</para>
</simpara>
</refsect1>
<refsect1 role="seealso">

View File

@@ -12,10 +12,10 @@
<modifier>public</modifier> <type>float</type><methodname>SVMModel::predict</methodname>
<methodparam><type>array</type><parameter>data</parameter></methodparam>
</methodsynopsis>
<para>
<simpara>
This function accepts an array of data and attempts to predict the class
or regression value based on the model extracted from previously trained data.
</para>
</simpara>
</refsect1>
@@ -25,10 +25,10 @@
<varlistentry>
<term><parameter>data</parameter></term>
<listitem>
<para>
<simpara>
The array to be classified. This should be a series of key =&gt; value
pairs in increasing key order, but not necessarily continuous.
</para>
</simpara>
</listitem>
</varlistentry>
</variablelist>
@@ -36,11 +36,11 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
<simpara>
Float the predicted value. This will be a class label in the case of
classification, a real value in the case of regression.
Throws SVMException on error
</para>
</simpara>
</refsect1>
<refsect1 role="seealso">

View File

@@ -12,9 +12,9 @@
<modifier>public</modifier> <type>bool</type><methodname>SVMModel::save</methodname>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
</methodsynopsis>
<para>
<simpara>
Save the model data to a file, for later use.
</para>
</simpara>
</refsect1>
@@ -24,9 +24,9 @@
<varlistentry>
<term><parameter>filename</parameter></term>
<listitem>
<para>
<simpara>
The file to save the model to.
</para>
</simpara>
</listitem>
</varlistentry>
</variablelist>
@@ -34,10 +34,10 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
<simpara>
Throws SVMException on error.
Returns true on success.
</para>
</simpara>
</refsect1>
<refsect1 role="seealso">