Passed
Pull Request — master (#114)
by Florian
07:10
created
src/Phpml/Exception/InvalidArgumentException.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Phpml\Exception;
6 6
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
      */
72 72
     public static function invalidTarget($target)
73 73
     {
74
-        return new self('Target with value ' . $target . ' is not part of the accepted classes');
74
+        return new self('Target with value '.$target.' is not part of the accepted classes');
75 75
     }
76 76
 
77 77
     /**
Please login to merge, or discard this patch.
src/Phpml/Classification/MLPClassifier.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Phpml\Classification;
6 6
 
Please login to merge, or discard this patch.
src/Phpml/FeatureExtraction/StopWords/French.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Phpml\FeatureExtraction\StopWords;
6 6
 
Please login to merge, or discard this patch.
src/Phpml/Helper/Optimizer/StochasticGD.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Phpml\Helper\Optimizer;
6 6
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      *
73 73
      * @var array
74 74
      */
75
-    protected $costValues= [];
75
+    protected $costValues = [];
76 76
 
77 77
     /**
78 78
      * Initializes the SGD optimizer for the given number of dimensions
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
     {
241 241
         // Check for early stop: No change larger than threshold (default 1e-5)
242 242
         $diff = array_map(
243
-            function ($w1, $w2) {
243
+            function($w1, $w2) {
244 244
                 return abs($w1 - $w2) > $this->threshold ? 1 : 0;
245 245
             },
246 246
             $oldTheta,
Please login to merge, or discard this patch.
src/Phpml/Classification/Linear/LogisticRegression.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Phpml\Classification\Linear;
6 6
 
@@ -76,13 +76,13 @@  discard block
 block discarded – undo
76 76
     ) {
77 77
         $trainingTypes = range(self::BATCH_TRAINING, self::CONJUGATE_GRAD_TRAINING);
78 78
         if (!in_array($trainingType, $trainingTypes)) {
79
-            throw new \Exception("Logistic regression can only be trained with " .
80
-                "batch (gradient descent), online (stochastic gradient descent) " .
79
+            throw new \Exception("Logistic regression can only be trained with ".
80
+                "batch (gradient descent), online (stochastic gradient descent) ".
81 81
                 "or conjugate batch (conjugate gradients) algorithms");
82 82
         }
83 83
 
84 84
         if (!in_array($cost, ['log', 'sse'])) {
85
-            throw new \Exception("Logistic regression cost function can be one of the following: \n" .
85
+            throw new \Exception("Logistic regression cost function can be one of the following: \n".
86 86
                 "'log' for log-likelihood and 'sse' for sum of squared errors");
87 87
         }
88 88
 
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
                  * The gradient of the cost function to be used with gradient descent:
194 194
                  *		∇J(x) = -(y - h(x)) = (h(x) - y)
195 195
                  */
196
-                $callback = function ($weights, $sample, $y) use ($penalty) {
196
+                $callback = function($weights, $sample, $y) use ($penalty) {
197 197
                     $this->weights = $weights;
198 198
                     $hX = $this->output($sample);
199 199
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
                  * The gradient of the cost function:
225 225
                  *		∇J(x) = -(h(x) - y) . h(x) . (1 - h(x))
226 226
                  */
227
-                $callback = function ($weights, $sample, $y) use ($penalty) {
227
+                $callback = function($weights, $sample, $y) use ($penalty) {
228 228
                     $this->weights = $weights;
229 229
                     $hX = $this->output($sample);
230 230
 
Please login to merge, or discard this patch.
src/Phpml/SupportVectorMachine/DataTransformer.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Phpml\SupportVectorMachine;
6 6
 
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
         }
22 22
 
23 23
         foreach ($labels as $index => $label) {
24
-            $set .= ($targets ? $label : $numericLabels[$label]) . " " . self::sampleRow($samples[$index]) . " " . PHP_EOL;
24
+            $set .= ($targets ? $label : $numericLabels[$label])." ".self::sampleRow($samples[$index])." ".PHP_EOL;
25 25
         }
26 26
 
27 27
         return $set;
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
         $set = '';
42 42
         foreach ($samples as $sample) {
43
-            $set .= "0 " . self::sampleRow($sample) . " " . PHP_EOL;
43
+            $set .= "0 ".self::sampleRow($sample)." ".PHP_EOL;
44 44
         }
45 45
 
46 46
         return $set;
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     {
94 94
         $row = [];
95 95
         foreach ($sample as $index => $feature) {
96
-            $row[] = $index + 1 . ":" . $feature;
96
+            $row[] = $index + 1.":".$feature;
97 97
         }
98 98
 
99 99
         return implode(' ', $row);
Please login to merge, or discard this patch.