php SVM

2017年12月22日 0 条评论 111 次阅读 0 人点赞

没用过,看svm时候突然看到,感觉很6,记录下来。

LibSVM 是SVM分类和回归问题的有效解决方案。这里的以php接口封装的svm扩展是为了在php脚本中更方便的应用。
SVM — The SVM class
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
SVMModel — The SVMModel class
SVMModel::checkProbabilityModel — Returns true if the model has probability information
SVMModel::__construct — Construct a new SVMModel
SVMModel::getLabels — Get the labels the model was trained on
SVMModel::getNrClass — Returns the number of classes the model was trained with
SVMModel::getSvmType — Get the SVM type the model was trained with
SVMModel::getSvrProbability — Get the sigma value for regression types
SVMModel::load — Load a saved SVM Model
SVMModel::predict_probability — Return class probabilities for previous unseen data
SVMModel::predict — Predict a value for previously unseen data
SVMModel::save — Save a model to a file
例如:
<?php
$dataarray(
    array(-1, 1 => 0.43, 3 => 0.12, 9284 => 0.2),
    array(1, 1 => 0.22, 5 => 0.01, 94 => 0.11),
);
$svmnewSVM();
$model$svm->train($data);
$dataarray(1 => 0.43, 3 => 0.12, 9284 => 0.2);
$result$model->predict($data);
var_dump($result);
$model->save('model.svm');
?>
以上例程的输出类似于:
int(-1)

lyssom

这个人太懒什么东西都没留下

文章评论(0)