@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Phpml\FeatureSelection; |
6 | 6 | |
@@ -37,7 +37,7 @@ discard block |
||
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 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Phpml\FeatureSelection; |
6 | 6 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Phpml\FeatureSelection\ScoringFunction; |
6 | 6 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Phpml\FeatureSelection\ScoringFunction; |
6 | 6 | |
@@ -52,7 +52,7 @@ discard block |
||
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 | } |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Phpml\FeatureSelection; |
6 | 6 |
@@ -1,6 +1,6 @@ discard block |
||
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 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | throw InvalidArgumentException::arraySizeTooSmall(2); |
29 | 29 | } |
30 | 30 | |
31 | - $samplesPerClass = array_map(function (array $class): int { |
|
31 | + $samplesPerClass = array_map(function(array $class): int { |
|
32 | 32 | return count($class); |
33 | 33 | }, $samples); |
34 | 34 | $allSamples = array_sum($samplesPerClass); |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | $dfbn = $classes - 1; |
42 | 42 | $dfwn = $allSamples - $classes; |
43 | 43 | |
44 | - $msb = array_map(function ($s) use ($dfbn) { |
|
44 | + $msb = array_map(function($s) use ($dfbn) { |
|
45 | 45 | return $s / $dfbn; |
46 | 46 | }, $ssbn); |
47 | - $msw = array_map(function ($s) use ($dfwn) { |
|
47 | + $msw = array_map(function($s) use ($dfwn) { |
|
48 | 48 | return $s / $dfwn; |
49 | 49 | }, $sswn); |
50 | 50 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | private static function sumOfFeaturesPerClass(array $samples): array |
74 | 74 | { |
75 | - return array_map(function (array $class) { |
|
75 | + return array_map(function(array $class) { |
|
76 | 76 | $sum = array_fill(0, count($class[0]), 0); |
77 | 77 | foreach ($class as $sample) { |
78 | 78 | foreach ($sample as $index => $feature) { |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
96 | - return array_map(function ($sum) { |
|
96 | + return array_map(function($sum) { |
|
97 | 97 | return $sum ** 2; |
98 | 98 | }, $squares); |
99 | 99 | } |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Phpml\Dataset; |
6 | 6 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Phpml\Association; |
6 | 6 | |
@@ -103,11 +103,11 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |