@@ -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\Distance; |
6 | 6 | |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | throw new InvalidArgumentException('Size of given arrays does not match'); |
19 | 19 | } |
20 | 20 | |
21 | - return array_sum(array_map(function ($m, $n) { |
|
21 | + return array_sum(array_map(function($m, $n) { |
|
22 | 22 | return abs($m - $n); |
23 | 23 | }, $a, $b)); |
24 | 24 | } |
@@ -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 new InvalidArgumentException('The array must have at least 2 elements'); |
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 | } |