@@ -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\CrossValidation; |
| 6 | 6 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | return $this->testLabels; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - protected function seedGenerator(?int $seed = null): void |
|
| 64 | + protected function seedGenerator(?int $seed = null) : void |
|
| 65 | 65 | { |
| 66 | 66 | if (null === $seed) { |
| 67 | 67 | mt_srand(); |
@@ -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 | |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | * |
| 113 | 113 | * @param array|null $means |
| 114 | 114 | */ |
| 115 | - public static function covarianceMatrix(array $data, ?array $means = null) : array |
|
| 115 | + public static function covarianceMatrix(array $data, ? array $means = null) : array |
|
| 116 | 116 | { |
| 117 | 117 | $n = count($data[0]); |
| 118 | 118 | |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Phpml\Metric; |
| 6 | 6 | |
| 7 | 7 | class ConfusionMatrix |
| 8 | 8 | { |
| 9 | - public static function compute(array $actualLabels, array $predictedLabels, ?array $labels = null) : array |
|
| 9 | + public static function compute(array $actualLabels, array $predictedLabels, ? array $labels = null) : array |
|
| 10 | 10 | { |
| 11 | 11 | $labels = $labels ? array_flip($labels) : self::getUniqueLabels($actualLabels); |
| 12 | 12 | $matrix = self::generateMatrixWithZeros($labels); |
@@ -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\NeuralNetwork\Network; |
| 6 | 6 | |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | $this->addLayer(new Layer($nodes, Input::class)); |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - private function addNeuronLayers(array $layers, ?ActivationFunction $activationFunction = null): void |
|
| 135 | + private function addNeuronLayers(array $layers, ?ActivationFunction $activationFunction = null) : void |
|
| 136 | 136 | { |
| 137 | 137 | foreach ($layers as $neurons) { |
| 138 | 138 | $this->addLayer(new Layer($neurons, Neuron::class, $activationFunction)); |
@@ -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\SupportVectorMachine; |
| 6 | 6 | |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | ); |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | - private function ensureDirectorySeparator(string &$path): void |
|
| 237 | + private function ensureDirectorySeparator(string & $path): void |
|
| 238 | 238 | { |
| 239 | 239 | if (substr($path, -1) !== DIRECTORY_SEPARATOR) { |
| 240 | 240 | $path .= DIRECTORY_SEPARATOR; |
@@ -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 InvalidArgumentException::arraySizeNotMatch(); |
| 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\Distance; |
| 6 | 6 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | throw InvalidArgumentException::arraySizeNotMatch(); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - return sqrt((float) array_sum(array_map(function ($m, $n) { |
|
| 21 | + return sqrt((float) array_sum(array_map(function($m, $n) { |
|
| 22 | 22 | return ($m - $n) ** 2; |
| 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\Distance; |
| 6 | 6 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | throw InvalidArgumentException::arraySizeNotMatch(); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - return max(array_map(function ($m, $n) { |
|
| 21 | + return max(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\Distance; |
| 6 | 6 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | return (float) pow( |
| 32 | - array_sum(array_map(function ($m, $n) { |
|
| 32 | + array_sum(array_map(function($m, $n) { |
|
| 33 | 33 | return pow(abs($m - $n), $this->lambda); |
| 34 | 34 | }, $a, $b)), |
| 35 | 35 | 1 / $this->lambda |