SVM::crossvalidate
(PECL svm >= 0.1.0)
SVM::crossvalidate — Test training params on subsets of the training data.
Description
$problem
, int $number_of_folds
)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.
Parameters
-
problem
-
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.
-
number_of_folds
-
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.
Return Values
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.
- PHP Руководство
- Функции по категориям
- Индекс функций
- Справочник функций
- Другие службы
- Support Vector Machine
- Функция SVM::__construct() - Construct a new SVM object
- Функция SVM::crossvalidate() - Test training params on subsets of the training data.
- Функция SVM::getOptions() - Return the current training parameters
- Функция SVM::setOptions() - Set training parameters
- Функция SVM::train() - Create a SVMModel based on training data
Коментарии
$svm = new SVM();
$cross = $svm->crossvalidate("/svmScaled.data" , 5); // 5 fold cross val
var_dump($cross); //