Passed
Pull Request — master (#203)
by Marcin
02:43
created
src/Phpml/NeuralNetwork/ActivationFunction/ThresholdedReLU.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\NeuralNetwork\ActivationFunction;
6 6
 
Please login to merge, or discard this patch.
src/Phpml/Math/Comparison.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\Math;
6 6
 
Please login to merge, or discard this patch.
src/Phpml/DimensionReduction/KernelPCA.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\DimensionReduction;
6 6
 
@@ -161,20 +161,20 @@  discard block
 block discarded – undo
161 161
         switch ($this->kernel) {
162 162
             case self::KERNEL_LINEAR:
163 163
                 // k(x,y) = xT.y
164
-                return function ($x, $y) {
164
+                return function($x, $y) {
165 165
                     return Matrix::dot($x, $y)[0];
166 166
                 };
167 167
             case self::KERNEL_RBF:
168 168
                 // k(x,y)=exp(-γ.|x-y|) where |..| is Euclidean distance
169 169
                 $dist = new Euclidean();
170 170
 
171
-                return function ($x, $y) use ($dist) {
171
+                return function($x, $y) use ($dist) {
172 172
                     return exp(-$this->gamma * $dist->sqDistance($x, $y));
173 173
                 };
174 174
 
175 175
             case self::KERNEL_SIGMOID:
176 176
                 // k(x,y)=tanh(γ.xT.y+c0) where c0=1
177
-                return function ($x, $y) {
177
+                return function($x, $y) {
178 178
                     $res = Matrix::dot($x, $y)[0] + 1.0;
179 179
 
180 180
                     return tanh($this->gamma * $res);
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
                 // k(x,y)=exp(-γ.|x-y|) where |..| is Manhattan distance
185 185
                 $dist = new Manhattan();
186 186
 
187
-                return function ($x, $y) use ($dist) {
187
+                return function($x, $y) use ($dist) {
188 188
                     return exp(-$this->gamma * $dist->distance($x, $y));
189 189
                 };
190 190
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
     protected function projectSample(array $pairs): array
219 219
     {
220 220
         // Normalize eigenvectors by eig = eigVectors / eigValues
221
-        $func = function ($eigVal, $eigVect) {
221
+        $func = function($eigVal, $eigVect) {
222 222
             $m = new Matrix($eigVect, false);
223 223
             $a = $m->divideByScalar($eigVal)->toArray();
224 224
 
Please login to merge, or discard this patch.
src/Phpml/Association/Apriori.php 1 patch
Spacing   +8 added lines, -8 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\Association;
6 6
 
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
      */
105 105
     protected function predictSample(array $sample): array
106 106
     {
107
-        $predicts = array_values(array_filter($this->getRules(), function ($rule) use ($sample) {
107
+        $predicts = array_values(array_filter($this->getRules(), function($rule) use ($sample) {
108 108
             return $this->equals($rule[self::ARRAY_KEY_ANTECEDENT], $sample);
109 109
         }));
110 110
 
111
-        return array_map(function ($rule) {
111
+        return array_map(function($rule) {
112 112
             return $rule[self::ARRAY_KEY_CONSEQUENT];
113 113
         }, $predicts);
114 114
     }
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         $cardinality = count($sample);
178 178
         $antecedents = $this->powerSet($sample);
179 179
 
180
-        return array_filter($antecedents, function ($antecedent) use ($cardinality) {
180
+        return array_filter($antecedents, function($antecedent) use ($cardinality) {
181 181
             return (count($antecedent) != $cardinality) && ($antecedent != []);
182 182
         });
183 183
     }
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
             }
200 200
         }
201 201
 
202
-        return array_map(function ($entry) {
202
+        return array_map(function($entry) {
203 203
             return [$entry];
204 204
         }, $items);
205 205
     }
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
      */
214 214
     private function frequent(array $samples): array
215 215
     {
216
-        return array_filter($samples, function ($entry) {
216
+        return array_filter($samples, function($entry) {
217 217
             return $this->support($entry) >= $this->support;
218 218
         });
219 219
     }
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
      */
288 288
     private function frequency(array $sample): int
289 289
     {
290
-        return count(array_filter($this->samples, function ($entry) use ($sample) {
290
+        return count(array_filter($this->samples, function($entry) use ($sample) {
291 291
             return $this->subset($entry, $sample);
292 292
         }));
293 293
     }
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
      */
303 303
     private function contains(array $system, array $set): bool
304 304
     {
305
-        return (bool) array_filter($system, function ($entry) use ($set) {
305
+        return (bool) array_filter($system, function($entry) use ($set) {
306 306
             return $this->equals($entry, $set);
307 307
         });
308 308
     }
Please login to merge, or discard this patch.
src/Phpml/Math/Matrix.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\Math;
6 6
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
     public function transpose(): self
127 127
     {
128 128
         if ($this->rows == 1) {
129
-            $matrix = array_map(function ($el) {
129
+            $matrix = array_map(function($el) {
130 130
                 return [$el];
131 131
             }, $this->matrix[0]);
132 132
         } else {
Please login to merge, or discard this patch.
src/Phpml/Math/LinearAlgebra/LUDecomposition.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
 /**
6 6
  * @package JAMA
Please login to merge, or discard this patch.
src/Phpml/Math/LinearAlgebra/EigenvalueDecomposition.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
 /**
6 6
  *	Class to obtain eigenvalues and eigenvectors of a real matrix.
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 
129 129
         // Always return the eigenvectors of length 1.0
130 130
         $vectors = new Matrix($vectors);
131
-        $vectors = array_map(function ($vect) {
131
+        $vectors = array_map(function($vect) {
132 132
             $sum = 0;
133 133
             for ($i = 0; $i < count($vect); ++$i) {
134 134
                 $sum += $vect[$i] ** 2;
Please login to merge, or discard this patch.
src/Phpml/Math/Distance/Manhattan.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\Math\Distance;
6 6
 
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
             throw InvalidArgumentException::arraySizeNotMatch();
19 19
         }
20 20
 
21
-        return array_sum(array_map(function ($m, $n) {
21
+        return array_sum(array_map(function($m, $n) {
22 22
             return abs($m - $n);
23 23
         }, $a, $b));
24 24
     }
Please login to merge, or discard this patch.
src/Phpml/FeatureExtraction/TokenCountVectorizer.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;
6 6
 
Please login to merge, or discard this patch.