名为“6765419 at qq dot com”的用户给出的负面评价的示例也适用!
<?php
$data = array(
array(-1, 1 =>170, 2 => 60),//-1 代表男生,键1代表身高,键2代表体重
array(-1, 1 =>180, 2 => 70),
array(1, 1 => 160, 2 => 46),//1 代表女生,键1代表身高,键2代表体重
array(1, 1 => 155, 2 => 40),
);
$svm = new SVM();
$model = $svm->train($data);
$data = array( 1 => 165, 2 =>60);//测试数据
$result = $model->predict($data);
echo var_dump($result);//echo var_export($result);
//return;
?>
所以我得到
float(-1)