cs fixer
This commit is contained in:
parent
e1854d44a2
commit
6296e44db0
|
@ -11,7 +11,6 @@ use Phpml\Helper\Optimizer\GD;
|
|||
use Phpml\Classification\Classifier;
|
||||
use Phpml\Preprocessing\Normalizer;
|
||||
use Phpml\IncrementalEstimator;
|
||||
use Phpml\Helper\PartiallyTrainable;
|
||||
|
||||
class Perceptron implements Classifier, IncrementalEstimator
|
||||
{
|
||||
|
@ -95,7 +94,7 @@ class Perceptron implements Classifier, IncrementalEstimator
|
|||
* @param array $targets
|
||||
* @param array $labels
|
||||
*/
|
||||
public function partialTrain(array $samples, array $targets, array $labels = array())
|
||||
public function partialTrain(array $samples, array $targets, array $labels = [])
|
||||
{
|
||||
return $this->trainByLabel($samples, $targets, $labels);
|
||||
}
|
||||
|
@ -107,7 +106,6 @@ class Perceptron implements Classifier, IncrementalEstimator
|
|||
*/
|
||||
public function trainBinary(array $samples, array $targets, array $labels)
|
||||
{
|
||||
|
||||
if ($this->normalizer) {
|
||||
$this->normalizer->transform($samples);
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ trait OneVsRest
|
|||
* @param array $allLabels All training set labels
|
||||
* @return void
|
||||
*/
|
||||
protected function trainByLabel(array $samples, array $targets, array $allLabels = array())
|
||||
protected function trainByLabel(array $samples, array $targets, array $allLabels = [])
|
||||
{
|
||||
|
||||
// Overwrites the current value if it exist. $allLabels must be provided for each partialTrain run.
|
||||
|
@ -129,14 +129,13 @@ trait OneVsRest
|
|||
*/
|
||||
private function binarizeTargets($targets, $label)
|
||||
{
|
||||
|
||||
$notLabel = "not_$label";
|
||||
foreach ($targets as $key => $target) {
|
||||
$targets[$key] = $target == $label ? $label : $notLabel;
|
||||
}
|
||||
|
||||
$labels = array($label, $notLabel);
|
||||
return array($targets, $labels);
|
||||
$labels = [$label, $notLabel];
|
||||
return [$targets, $labels];
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -12,5 +12,5 @@ interface IncrementalEstimator
|
|||
* @param array $targets
|
||||
* @param array $labels
|
||||
*/
|
||||
public function partialTrain(array $samples, array $targets, array $labels = array());
|
||||
public function partialTrain(array $samples, array $targets, array $labels = []);
|
||||
}
|
||||
|
|
|
@ -6,12 +6,11 @@ namespace Phpml\SupportVectorMachine;
|
|||
|
||||
use Phpml\Helper\Trainable;
|
||||
|
||||
|
||||
class SupportVectorMachine
|
||||
{
|
||||
use Trainable;
|
||||
|
||||
/**
|
||||
use Trainable;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $type;
|
||||
|
|
Loading…
Reference in New Issue