mirror of
https://github.com/Llewellynvdm/php-ml.git
synced 2024-11-10 15:50:57 +00:00
add windows libsvm binaries
This commit is contained in:
parent
7b5b6418f4
commit
95bfc890cd
BIN
bin/libsvm/svm-predict.exe
Normal file
BIN
bin/libsvm/svm-predict.exe
Normal file
Binary file not shown.
BIN
bin/libsvm/svm-scale.exe
Normal file
BIN
bin/libsvm/svm-scale.exe
Normal file
Binary file not shown.
BIN
bin/libsvm/svm-train.exe
Normal file
BIN
bin/libsvm/svm-train.exe
Normal file
Binary file not shown.
@ -69,7 +69,7 @@ class SupportVectorMachine
|
||||
file_put_contents($trainingSetFileName = $this->varPath.uniqid(), $trainingSet);
|
||||
$modelFileName = $trainingSetFileName.'-model';
|
||||
|
||||
$command = sprintf('%ssvm-train -s %s -t %s -c %s %s %s', $this->binPath, $this->type, $this->kernel, $this->cost, $trainingSetFileName, $modelFileName);
|
||||
$command = sprintf('%ssvm-train%s -s %s -t %s -c %s %s %s', $this->binPath, $this->getOSExtension(), $this->type, $this->kernel, $this->cost, $trainingSetFileName, $modelFileName);
|
||||
$output = '';
|
||||
exec(escapeshellcmd($command), $output);
|
||||
|
||||
@ -100,7 +100,7 @@ class SupportVectorMachine
|
||||
file_put_contents($modelFileName, $this->model);
|
||||
$outputFileName = $testSetFileName.'-output';
|
||||
|
||||
$command = sprintf('%ssvm-predict %s %s %s', $this->binPath, $testSetFileName, $modelFileName, $outputFileName);
|
||||
$command = sprintf('%ssvm-predict%s %s %s %s', $this->binPath, $this->getOSExtension(), $testSetFileName, $modelFileName, $outputFileName);
|
||||
$output = '';
|
||||
exec(escapeshellcmd($command), $output);
|
||||
|
||||
@ -112,4 +112,17 @@ class SupportVectorMachine
|
||||
|
||||
return DataTransformer::results($predictions, $this->labels);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
private function getOSExtension()
|
||||
{
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||
return '.exe';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user