<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Test training params on subsets of the training data.</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="svm.construct.html">SVM::__construct</a></div> <div class="next" style="text-align: right; float: right;"><a href="svm.getoptions.html">SVM::getOptions</a></div> <div class="up"><a href="class.svm.html">SVM</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="svm.crossvalidate" class="refentry"> <div class="refnamediv"> <h1 class="refname">SVM::crossvalidate</h1> <p class="verinfo">(PECL svm >= 0.1.0)</p><p class="refpurpose"><span class="refname">SVM::crossvalidate</span> — <span class="dc-title">Test training params on subsets of the training data.</span></p> </div> <div class="refsect1 description" id="refsect1-svm.crossvalidate-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">float</span> <span class="methodname"><strong>svm::crossvalidate</strong></span> ( <span class="methodparam"><span class="type">array</span> <code class="parameter">$problem</code></span> , <span class="methodparam"><span class="type">int</span> <code class="parameter">$number_of_folds</code></span> )</div> <p class="para rdfs-comment"> 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 repeatedly trains on one subset and tests on another. While the accuracy 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. </p> </div> <div class="refsect1 parameters" id="refsect1-svm.crossvalidate-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">problem</code></em></span> <dd> <p class="para"> 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. </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">number_of_folds</code></em></span> <dd> <p class="para"> 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. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-svm.crossvalidate-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> 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. </p> </div> <div class="refsect1 seealso" id="refsect1-svm.crossvalidate-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="methodname"><a href="svm.train.html" class="methodname" rel="rdfs-seeAlso">SVM::train()</a> - Create a SVMModel based on training data</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="svm.construct.html">SVM::__construct</a></div> <div class="next" style="text-align: right; float: right;"><a href="svm.getoptions.html">SVM::getOptions</a></div> <div class="up"><a href="class.svm.html">SVM</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>