Completed
Pull Request — master (#317)
by Marcin
08:21
created
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.