Completed
Pull Request — master (#319)
by Arkadiusz
399:41 queued 36:00
created
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.
src/Classification/DecisionTree.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -220,7 +220,7 @@
 block discarded – undo
220 220
         // Normalize & sort the importances
221 221
         $total = array_sum($this->featureImportances);
222 222
         if ($total > 0) {
223
-            array_walk($this->featureImportances, function (&$importance) use ($total): void {
223
+            array_walk($this->featureImportances, function(&$importance) use ($total): void {
224 224
                 $importance /= $total;
225 225
             });
226 226
             arsort($this->featureImportances);
Please login to merge, or discard this patch.
src/Preprocessing/Normalizer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
             $count = count($sample);
94 94
             $sample = array_fill(0, $count, 1.0 / $count);
95 95
         } else {
96
-            array_walk($sample, function (&$feature) use ($norm1): void {
96
+            array_walk($sample, function(&$feature) use ($norm1): void {
97 97
                 $feature /= $norm1;
98 98
             });
99 99
         }
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
         if ($norm2 == 0) {
112 112
             $sample = array_fill(0, count($sample), 1);
113 113
         } else {
114
-            array_walk($sample, function (&$feature) use ($norm2): void {
114
+            array_walk($sample, function(&$feature) use ($norm2): void {
115 115
                 $feature /= $norm2;
116 116
             });
117 117
         }
Please login to merge, or discard this patch.
src/FeatureExtraction/TokenCountVectorizer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
 
49 49
     public function transform(array &$samples): void
50 50
     {
51
-        array_walk($samples, function (string &$sample): void {
51
+        array_walk($samples, function(string &$sample): void {
52 52
             $this->transformSample($sample);
53 53
         });
54 54
 
Please login to merge, or discard this patch.
src/FeatureSelection/ScoringFunction/UnivariateLinearRegression.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
         $degreesOfFreedom = count($targets) - ($this->center ? 2 : 1);
54 54
 
55
-        return array_map(function (float $correlation) use ($degreesOfFreedom): float {
55
+        return array_map(function(float $correlation) use ($degreesOfFreedom): float {
56 56
             return $correlation ** 2 / (1 - $correlation ** 2) * $degreesOfFreedom;
57 57
         }, $correlations);
58 58
     }
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     private function centerTargets(array &$targets): void
61 61
     {
62 62
         $mean = Mean::arithmetic($targets);
63
-        array_walk($targets, function (&$target) use ($mean): void {
63
+        array_walk($targets, function(&$target) use ($mean): void {
64 64
             $target -= $mean;
65 65
         });
66 66
     }
Please login to merge, or discard this patch.