note 127892 added to svm.examples
| From: | razvan_bc.yahoo.com via php-notes | Date: | Fri, 04 Nov 2022 08:24:01 +0000 |
| Subject: | note 127892 added to svm.examples | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-219846@lists.php.net to get a copy of this message | ||
premises:php 8.1 ,windows 64
----------------------------------
install (for beginners)
--------
after i visit https://github.com/ianbarber/php-svm
and i got from url found on page(install script)
.. http://www.csie.ntu.edu.tw/~cjlin/cgi-bin/libsvm.cgi?+http://www.csie.ntu.edu.tw/~cjlin/libsvm+tar.gz
and manual install it:
1.php.ini
(after the main group extension=... about 12 pieces)
...
extension=svm
...
2.I put manually inside php a folder called libsvm-3.1 then i unzip there libsvm.dll ,
libsvmread.mexw64 ,libsvmwrite.mexw64 , svmpredict.mexw64 , svm-predict.exe, svm-scale.exe ,
svm-toy.exe , svmtrain.mexw64, svm-train.exe !
running
<?php
$data = array(
array(-1, 1 => 0.43, 3 => 0.12, 9284 => 0.2),
array(1, 1 => 0.22, 5 => 0.01, 94 => 0.11),
);
$svm = new SVM();
$model = $svm->train($data);
$data = array(1 => 0.43, 3 => 0.12, 9284 => 0.2);
$result = $model->predict($data);
var_dump($result);
$model->save('model.svm');
?>
via server(apache ,php,mariadb;even custom or xampp) now i got results:
i got model.svm with the content
================================
svm_type c_svc
kernel_type rbf
gamma 0.00010771219302024989
nr_class 2
total_sv 2
rho 0
label 1 -1
nr_sv 1 1
SV
1 1:0.22 5:0.01 94:0.11
-1 1:0.43 3:0.12 9284:0.2
=================================
so i think is very cool ..for a startup.
i will look around phpt files from github to understand why in yesterday's tests i got errors
with some function witch require 2 parameters and not one like in the manual
----
Server IP: 45.112.84.4
Probable Submitter: 45.91.159.161 (proxied: 5.14.157.148)
----
Manual Page -- https://php.net/manual/en/svm.examples.php
Edit -- https://main.php.net/note/edit/127892
Del: integrated -- https://main.php.net/note/delete/127892/integrated
Del: useless -- https://main.php.net/note/delete/127892/useless
Del: bad code -- https://main.php.net/note/delete/127892/bad+code
Del: spam -- https://main.php.net/note/delete/127892/spam
Del: non-english -- https://main.php.net/note/delete/127892/non-english
Del: in docs -- https://main.php.net/note/delete/127892/in+docs
Del: other reasons-- https://main.php.net/note/delete/127892
Reject -- https://main.php.net/note/reject/127892
Search -- https://main.php.net/manage/user-notes.php