Skip to content

Commit

Permalink
cs fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
akondas committed Apr 19, 2017
1 parent e1854d4 commit 6296e44
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
4 changes: 1 addition & 3 deletions src/Phpml/Classification/Linear/Perceptron.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use Phpml\Classification\Classifier;
use Phpml\Preprocessing\Normalizer;
use Phpml\IncrementalEstimator;
use Phpml\Helper\PartiallyTrainable;

class Perceptron implements Classifier, IncrementalEstimator
{
Expand Down Expand Up @@ -95,7 +94,7 @@ public function __construct(float $learningRate = 0.001, int $maxIterations = 10
* @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);
}
Expand All @@ -107,7 +106,6 @@ public function partialTrain(array $samples, array $targets, array $labels = arr
*/
public function trainBinary(array $samples, array $targets, array $labels)
{

if ($this->normalizer) {
$this->normalizer->transform($samples);
}
Expand Down
7 changes: 3 additions & 4 deletions src/Phpml/Helper/OneVsRest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function train(array $samples, array $targets)
* @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.
Expand Down Expand Up @@ -129,14 +129,13 @@ protected function getClassifierCopy()
*/
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];
}


Expand Down
2 changes: 1 addition & 1 deletion src/Phpml/IncrementalEstimator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []);
}
7 changes: 3 additions & 4 deletions src/Phpml/SupportVectorMachine/SupportVectorMachine.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@

use Phpml\Helper\Trainable;


class SupportVectorMachine
{
use Trainable;
/**
use Trainable;
/**
* @var int
*/
private $type;
Expand Down

0 comments on commit 6296e44

Please sign in to comment.