Test Setup Failed
Push — master ( dbbce0...cefb4f )
by Arkadiusz
02:16
created
src/Math/Statistic/StandardDeviation.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
         $mean = Mean::arithmetic($numbers);
52 52
 
53 53
         return array_sum(array_map(
54
-            function ($val) use ($mean) {
54
+            function($val) use ($mean) {
55 55
                 return ($val - $mean) ** 2;
56 56
             },
57 57
             $numbers
Please login to merge, or discard this patch.
src/Association/Apriori.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -103,11 +103,11 @@  discard block
 block discarded – undo
103 103
      */
104 104
     protected function predictSample(array $sample): array
105 105
     {
106
-        $predicts = array_values(array_filter($this->getRules(), function ($rule) use ($sample) {
106
+        $predicts = array_values(array_filter($this->getRules(), function($rule) use ($sample) {
107 107
             return $this->equals($rule[self::ARRAY_KEY_ANTECEDENT], $sample);
108 108
         }));
109 109
 
110
-        return array_map(function ($rule) {
110
+        return array_map(function($rule) {
111 111
             return $rule[self::ARRAY_KEY_CONSEQUENT];
112 112
         }, $predicts);
113 113
     }
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
         $cardinality = count($sample);
177 177
         $antecedents = $this->powerSet($sample);
178 178
 
179
-        return array_filter($antecedents, function ($antecedent) use ($cardinality) {
179
+        return array_filter($antecedents, function($antecedent) use ($cardinality) {
180 180
             return (count($antecedent) != $cardinality) && ($antecedent != []);
181 181
         });
182 182
     }
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
             }
199 199
         }
200 200
 
201
-        return array_map(function ($entry) {
201
+        return array_map(function($entry) {
202 202
             return [$entry];
203 203
         }, $items);
204 204
     }
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
      */
213 213
     private function frequent(array $samples): array
214 214
     {
215
-        return array_values(array_filter($samples, function ($entry) {
215
+        return array_values(array_filter($samples, function($entry) {
216 216
             return $this->support($entry) >= $this->support;
217 217
         }));
218 218
     }
@@ -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/Classification/NaiveBayes.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@
 block discarded – undo
120 120
                 $this->dataType[$label][$i] = self::NOMINAL;
121 121
                 $this->discreteProb[$label][$i] = array_count_values($values);
122 122
                 $db = &$this->discreteProb[$label][$i];
123
-                $db = array_map(function ($el) use ($numValues) {
123
+                $db = array_map(function($el) use ($numValues) {
124 124
                     return $el / $numValues;
125 125
                 }, $db);
126 126
             } else {
Please login to merge, or discard this patch.
src/DimensionReduction/LDA.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@
 block discarded – undo
157 157
 
158 158
         // Calculate overall mean of the dataset for each column
159 159
         $numElements = array_sum($counts);
160
-        $map = function ($el) use ($numElements) {
160
+        $map = function($el) use ($numElements) {
161 161
             return $el / $numElements;
162 162
         };
163 163
         $this->overallMean = array_map($map, $overallMean);
Please login to merge, or discard this patch.
src/Clustering/FuzzyCMeans.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@
 block discarded – undo
143 143
                 $total += $val;
144 144
             }
145 145
 
146
-            $this->membership[] = array_map(function ($val) use ($total) {
146
+            $this->membership[] = array_map(function($val) use ($total) {
147 147
                 return $val / $total;
148 148
             }, $row);
149 149
         }
Please login to merge, or discard this patch.
src/FeatureSelection/VarianceThreshold.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
 
38 38
     public function fit(array $samples, ?array $targets = null): void
39 39
     {
40
-        $this->variances = array_map(function (array $column) {
40
+        $this->variances = array_map(function(array $column) {
41 41
             return Variance::population($column);
42 42
         }, Matrix::transposeArray($samples));
43 43
 
Please login to merge, or discard this patch.
src/Helper/Optimizer/StochasticGD.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -241,7 +241,7 @@
 block discarded – undo
241 241
     {
242 242
         // Check for early stop: No change larger than threshold (default 1e-5)
243 243
         $diff = array_map(
244
-            function ($w1, $w2) {
244
+            function($w1, $w2) {
245 245
                 return abs($w1 - $w2) > $this->threshold ? 1 : 0;
246 246
             },
247 247
             $oldTheta,
Please login to merge, or discard this patch.
src/Classification/Linear/LogisticRegression.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
                  * The gradient of the cost function to be used with gradient descent:
189 189
                  *		∇J(x) = -(y - h(x)) = (h(x) - y)
190 190
                  */
191
-                return function ($weights, $sample, $y) use ($penalty) {
191
+                return function($weights, $sample, $y) use ($penalty) {
192 192
                     $this->weights = $weights;
193 193
                     $hX = $this->output($sample);
194 194
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
                  * The gradient of the cost function:
221 221
                  *		∇J(x) = -(h(x) - y) . h(x) . (1 - h(x))
222 222
                  */
223
-                return function ($weights, $sample, $y) use ($penalty) {
223
+                return function($weights, $sample, $y) use ($penalty) {
224 224
                     $this->weights = $weights;
225 225
                     $hX = $this->output($sample);
226 226
 
Please login to merge, or discard this patch.
src/Classification/Ensemble/RandomForest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@
 block discarded – undo
100 100
 
101 101
         // Normalize & sort the importance values
102 102
         $total = array_sum($sum);
103
-        array_walk($sum, function (&$importance) use ($total): void {
103
+        array_walk($sum, function(&$importance) use ($total): void {
104 104
             $importance /= $total;
105 105
         });
106 106
         arsort($sum);
Please login to merge, or discard this patch.