@@ -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 @@ |
||
| 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 | } |
@@ -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 | } |