Completed
Push — master ( deefbb...2ee0d3 )
by Arkadiusz
03:03
created
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/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/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/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.
src/Dataset/MnistDataset.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
                 $imageBytes = fread($stream, $fields['rows'] * $fields['cols']);
62 62
 
63 63
                 // Convert to float between 0 and 1
64
-                $images[] = array_map(function ($b) {
64
+                $images[] = array_map(function($b) {
65 65
                     return $b / 255;
66 66
                 }, array_values(unpack('C*', (string) $imageBytes)));
67 67
             }
Please login to merge, or discard this patch.
src/NeuralNetwork/ActivationFunction/Gaussian.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
      */
14 14
     public function compute($value): float
15 15
     {
16
-        return exp(- $value ** 2);
16
+        return exp(-$value ** 2);
17 17
     }
18 18
 
19 19
     /**
Please login to merge, or discard this patch.