Adding predict probability function

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@321143 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Ian Barber 2011-12-18 21:46:20 +00:00
parent 78fbdb3eba
commit 385114cea9
3 changed files with 95 additions and 2 deletions

View file

@ -280,7 +280,7 @@
<varlistentry xml:id="svm.constants.opt-propability">
<term><constant>SVM::OPT_PROBABILITY</constant></term>
<listitem>
<para>Training parmater, boolean, for whether to use probability estimates</para>
<para>Training parameter, boolean, for whether to collect and use probability estimates</para>
</listitem>
</varlistentry>
@ -322,7 +322,7 @@
<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 </para>
<para>The option for the cost parameter that controls tradeoff between errors and generality - effectively the penalty for misclassifying training examples. </para>
</listitem>
</varlistentry>

View file

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 317663 $ -->
<refentry xml:id="svmmodel.predict_probability" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SVMModel::predict_probability</refname>
<refpurpose>Return class probabilities for previous unseen data</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>float</type><methodname>SVMModel::predict_probability</methodname>
<methodparam><type>array</type><parameter>data</parameter></methodparam>
</methodsynopsis>
<para>
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>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>data</parameter></term>
<listitem>
<para>
The array to be classified. This should be a series of key => value
pairs in increasing key order, but not necessarily continuous.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>probabilities</parameter></term>
<listitem>
<para>
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>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
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>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><methodname>SVM::predict</methodname></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -15,6 +15,7 @@
<function name='svmmodel::save' from='PECL svm &gt;= 0.1.0'/>
<function name='svmmodel::load' from='PECL svm &gt;= 0.1.00.1.0'/>
<function name='svmmodel::predict' from='PECL svm &gt;= 0.1.0'/>
<function name='svmmodel::predict_probability' from='PECL svm &gt;= 0.1.4'/>
<function name='svmexception::__clone' from='PECL svm &gt;= 0.1.0'/>
<function name='svmexception::__construct' from='PECL svm &gt;= 0.1.0'/>
<function name='svmexception::getmessage' from='PECL svm &gt;= 0.1.0'/>