<?php include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc'; $TOC = array(); $TOC_DEPRECATED = array(); $PARENTS = array(); include_once dirname(__FILE__) ."/toc/class.svm.inc"; $setup = array ( 'home' => array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'svm.crossvalidate.php', 1 => 'SVM::crossvalidate', 2 => 'Test training params on subsets of the training data', ), 'up' => array ( 0 => 'class.svm.php', 1 => 'SVM', ), 'prev' => array ( 0 => 'svm.construct.php', 1 => 'SVM::__construct', ), 'next' => array ( 0 => 'svm.getoptions.php', 1 => 'SVM::getOptions', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/svm/svm/crossvalidate.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?> <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">说明</h3> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="methodname"><strong>svm::crossvalidate</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.array.php" class="type array">array</a></span> <code class="parameter">$problem</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$number_of_folds</code></span>): <span class="type"><a href="language.types.float.php" class="type float">float</a></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">参数</h3> <p class="para"> <dl> <dt><code class="parameter">problem</code></dt> <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><code class="parameter">number_of_folds</code></dt> <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> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-svm.crossvalidate-returnvalues"> <h3 class="title">返回值</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">参见</h3> <p class="para"> <ul class="simplelist"> <li><span class="methodname"><a href="svm.train.php" class="methodname" rel="rdfs-seeAlso">SVM::train()</a> - Create a SVMModel based on training data</span></li> </ul> </p> </div> </div><?php manual_footer($setup); ?>