@@ -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\DimensionReduction; |
| 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\Math\Statistic; |
| 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\NeuralNetwork\ActivationFunction; |
| 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\Math; |
| 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\DimensionReduction; |
| 6 | 6 | |
@@ -161,20 +161,20 @@ discard block |
||
| 161 | 161 | switch ($this->kernel) { |
| 162 | 162 | case self::KERNEL_LINEAR: |
| 163 | 163 | // k(x,y) = xT.y |
| 164 | - return function ($x, $y) { |
|
| 164 | + return function($x, $y) { |
|
| 165 | 165 | return Matrix::dot($x, $y)[0]; |
| 166 | 166 | }; |
| 167 | 167 | case self::KERNEL_RBF: |
| 168 | 168 | // k(x,y)=exp(-γ.|x-y|) where |..| is Euclidean distance |
| 169 | 169 | $dist = new Euclidean(); |
| 170 | 170 | |
| 171 | - return function ($x, $y) use ($dist) { |
|
| 171 | + return function($x, $y) use ($dist) { |
|
| 172 | 172 | return exp(-$this->gamma * $dist->sqDistance($x, $y)); |
| 173 | 173 | }; |
| 174 | 174 | |
| 175 | 175 | case self::KERNEL_SIGMOID: |
| 176 | 176 | // k(x,y)=tanh(γ.xT.y+c0) where c0=1 |
| 177 | - return function ($x, $y) { |
|
| 177 | + return function($x, $y) { |
|
| 178 | 178 | $res = Matrix::dot($x, $y)[0] + 1.0; |
| 179 | 179 | |
| 180 | 180 | return tanh($this->gamma * $res); |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | // k(x,y)=exp(-γ.|x-y|) where |..| is Manhattan distance |
| 185 | 185 | $dist = new Manhattan(); |
| 186 | 186 | |
| 187 | - return function ($x, $y) use ($dist) { |
|
| 187 | + return function($x, $y) use ($dist) { |
|
| 188 | 188 | return exp(-$this->gamma * $dist->distance($x, $y)); |
| 189 | 189 | }; |
| 190 | 190 | |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | protected function projectSample(array $pairs): array |
| 219 | 219 | { |
| 220 | 220 | // Normalize eigenvectors by eig = eigVectors / eigValues |
| 221 | - $func = function ($eigVal, $eigVect) { |
|
| 221 | + $func = function($eigVal, $eigVect) { |
|
| 222 | 222 | $m = new Matrix($eigVect, false); |
| 223 | 223 | $a = $m->divideByScalar($eigVal)->toArray(); |
| 224 | 224 | |
@@ -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\FeatureExtraction; |
| 6 | 6 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - private function transformSample(string &$sample): void |
|
| 76 | + private function transformSample(string & $sample): void |
|
| 77 | 77 | { |
| 78 | 78 | $counts = []; |
| 79 | 79 | $tokens = $this->tokenizer->tokenize($sample); |
@@ -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\CrossValidation; |
| 6 | 6 | |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | abstract protected function splitDataset(Dataset $dataset, float $testSize); |
| 64 | 64 | |
| 65 | - protected function seedGenerator(?int $seed = null): void |
|
| 65 | + protected function seedGenerator(?int $seed = null) : void |
|
| 66 | 66 | { |
| 67 | 67 | if ($seed === null) { |
| 68 | 68 | mt_srand(); |