Passed
Pull Request — master (#86)
by Marcin
03:55
created
src/Phpml/Helper/OneVsRest.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\Helper;
6 6
 
Please login to merge, or discard this patch.
src/Phpml/IncrementalEstimator.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;
6 6
 
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
  *	@package JAMA
6 6
  *
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.
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
 
839 839
         // Always return the eigenvectors of length 1.0
840 840
         $vectors = new Matrix($vectors);
841
-        $vectors = array_map(function ($vect) {
841
+        $vectors = array_map(function($vect) {
842 842
             $sum = 0;
843 843
             for ($i = 0; $i < count($vect); ++$i) {
844 844
                 $sum += $vect[$i] ** 2;
Please login to merge, or discard this patch.
src/Phpml/Math/Statistic/Covariance.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\Statistic;
6 6
 
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
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
     public function transpose()
158 158
     {
159 159
         if ($this->rows == 1) {
160
-            $matrix = array_map(function ($el) {
160
+            $matrix = array_map(function($el) {
161 161
                 return [$el];
162 162
             }, $this->matrix[0]);
163 163
         } else {
Please login to merge, or discard this patch.
src/Phpml/DimensionReduction/PCA.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\DimensionReduction;
6 6
 
Please login to merge, or discard this patch.
src/Phpml/DimensionReduction/KernelPCA.php 1 patch
Spacing   +7 added lines, -7 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
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
      */
134 134
     protected function centerMatrix(array $matrix, int $n)
135 135
     {
136
-        $N = array_fill(0, $n, array_fill(0, $n, 1.0/$n));
136
+        $N = array_fill(0, $n, array_fill(0, $n, 1.0 / $n));
137 137
         $N = new Matrix($N, false);
138 138
         $K = new Matrix($matrix, false);
139 139
 
@@ -162,19 +162,19 @@  discard block
 block discarded – undo
162 162
         switch ($this->kernel) {
163 163
             case self::KERNEL_LINEAR:
164 164
                 // k(x,y) = xT.y
165
-                return function ($x, $y) {
165
+                return function($x, $y) {
166 166
                     return Matrix::dot($x, $y)[0];
167 167
                 };
168 168
             case self::KERNEL_RBF:
169 169
                 // k(x,y)=exp(-γ.|x-y|) where |..| is Euclidean distance
170 170
                 $dist = new Euclidean();
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
                     return tanh($this->gamma * $res);
180 180
                 };
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
             case self::KERNEL_LAPLACIAN:
183 183
                 // k(x,y)=exp(-γ.|x-y|) where |..| is Manhattan distance
184 184
                 $dist = new Manhattan();
185
-                return function ($x, $y) use ($dist) {
185
+                return function($x, $y) use ($dist) {
186 186
                     return exp(-$this->gamma * $dist->distance($x, $y));
187 187
                 };
188 188
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
     protected function projectSample(array $pairs)
217 217
     {
218 218
         // Normalize eigenvectors by eig = eigVectors / eigValues
219
-        $func = function ($eigVal, $eigVect) {
219
+        $func = function($eigVal, $eigVect) {
220 220
             $m = new Matrix($eigVect, false);
221 221
             $a = $m->divideByScalar($eigVal)->toArray();
222 222
 
Please login to merge, or discard this patch.
src/Phpml/DimensionReduction/LDA.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\DimensionReduction;
6 6
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
     protected function calculateMeans(array $data, array $classes) : array
119 119
     {
120 120
         $means = [];
121
-        $counts= [];
121
+        $counts = [];
122 122
         $overallMean = array_fill(0, count($data[0]), 0.0);
123 123
 
124 124
         foreach ($data as $index => $row) {
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 
148 148
         // Calculate overall mean of the dataset for each column
149 149
         $numElements = array_sum($counts);
150
-        $map = function ($el) use ($numElements) {
150
+        $map = function($el) use ($numElements) {
151 151
             return $el / $numElements;
152 152
         };
153 153
         $this->overallMean = array_map($map, $overallMean);
Please login to merge, or discard this patch.