Passed
Pull Request — master (#86)
by Marcin
03:55
created
src/Phpml/Math/Statistic/Gaussian.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\Statistic;
6 6
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         // Ref: https://en.wikipedia.org/wiki/Normal_distribution
40 40
         $std2 = $this->std ** 2;
41 41
         $mean = $this->mean;
42
-        return exp(- (($value - $mean) ** 2) / (2 * $std2)) / sqrt(2 * $std2 * pi());
42
+        return exp(-(($value - $mean) ** 2) / (2 * $std2)) / sqrt(2 * $std2 * pi());
43 43
     }
44 44
 
45 45
     /**
Please login to merge, or discard this patch.
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/DimensionReduction/KernelPCA.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -136,9 +136,9 @@
 block discarded – undo
136 136
         $N_K_N = $N->multiply($K_N);
137 137
 
138 138
         return $K->subtract($N_K)
139
-                 ->subtract($K_N)
140
-                 ->add($N_K_N)
141
-                 ->toArray();
139
+                    ->subtract($K_N)
140
+                    ->add($N_K_N)
141
+                    ->toArray();
142 142
     }
143 143
 
144 144
     /**
Please login to merge, or discard this 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/Math/LinearAlgebra/EigenvalueDecomposition.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -58,21 +58,21 @@
 block discarded – undo
58 58
     private $V = [];
59 59
 
60 60
     /**
61
-    *	Array for internal storage of nonsymmetric Hessenberg form.
62
-    *	@var array
63
-    */
61
+     *	Array for internal storage of nonsymmetric Hessenberg form.
62
+     *	@var array
63
+     */
64 64
     private $H = [];
65 65
 
66 66
     /**
67
-    *	Working storage for nonsymmetric algorithm.
68
-    *	@var array
69
-    */
67
+     *	Working storage for nonsymmetric algorithm.
68
+     *	@var array
69
+     */
70 70
     private $ort;
71 71
 
72 72
     /**
73
-    *	Used for complex scalar division.
74
-    *	@var float
75
-    */
73
+     *	Used for complex scalar division.
74
+     *	@var float
75
+     */
76 76
     private $cdivr;
77 77
     private $cdivi;
78 78
 
Please login to merge, or discard this 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/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/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/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/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.