@@ -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; |
| 6 | 6 | |
@@ -136,9 +136,9 @@ |
||
| 136 | 136 | $N_K_N = $N->multiply($K_N); |
| 137 | 137 | |
| 138 | 138 | return $K->subtract($N_K) |
| 139 | - ->subtract($K_N) |
|
| 140 | - ->add($N_K_N) |
|
| 141 | - ->toArray(); |
|
| 139 | + ->subtract($K_N) |
|
| 140 | + ->add($N_K_N) |
|
| 141 | + ->toArray(); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | /** |
@@ -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 | |
@@ -145,20 +145,20 @@ discard block |
||
| 145 | 145 | switch ($this->kernel) { |
| 146 | 146 | case self::KERNEL_LINEAR: |
| 147 | 147 | // k(x,y) = xT.y |
| 148 | - return function ($x, $y) { |
|
| 148 | + return function($x, $y) { |
|
| 149 | 149 | return Matrix::dot($x, $y)[0]; |
| 150 | 150 | }; |
| 151 | 151 | case self::KERNEL_RBF: |
| 152 | 152 | // k(x,y)=exp(-γ.|x-y|) where |..| is Euclidean distance |
| 153 | 153 | $dist = new Euclidean(); |
| 154 | 154 | |
| 155 | - return function ($x, $y) use ($dist) { |
|
| 155 | + return function($x, $y) use ($dist) { |
|
| 156 | 156 | return exp(-$this->gamma * $dist->sqDistance($x, $y)); |
| 157 | 157 | }; |
| 158 | 158 | |
| 159 | 159 | case self::KERNEL_SIGMOID: |
| 160 | 160 | // k(x,y)=tanh(γ.xT.y+c0) where c0=1 |
| 161 | - return function ($x, $y) { |
|
| 161 | + return function($x, $y) { |
|
| 162 | 162 | $res = Matrix::dot($x, $y)[0] + 1.0; |
| 163 | 163 | |
| 164 | 164 | return tanh($this->gamma * $res); |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | // k(x,y)=exp(-γ.|x-y|) where |..| is Manhattan distance |
| 169 | 169 | $dist = new Manhattan(); |
| 170 | 170 | |
| 171 | - return function ($x, $y) use ($dist) { |
|
| 171 | + return function($x, $y) use ($dist) { |
|
| 172 | 172 | return exp(-$this->gamma * $dist->distance($x, $y)); |
| 173 | 173 | }; |
| 174 | 174 | |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | protected function projectSample(array $pairs) : array |
| 193 | 193 | { |
| 194 | 194 | // Normalize eigenvectors by eig = eigVectors / eigValues |
| 195 | - $func = function ($eigVal, $eigVect) { |
|
| 195 | + $func = function($eigVal, $eigVect) { |
|
| 196 | 196 | $m = new Matrix($eigVect, false); |
| 197 | 197 | $a = $m->divideByScalar($eigVal)->toArray(); |
| 198 | 198 | |
@@ -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\DimensionReduction; |
| 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\Classification\Linear; |
| 6 | 6 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | protected function runTraining(array $samples, array $targets) |
| 171 | 171 | { |
| 172 | 172 | // The cost function is the sum of squares |
| 173 | - $callback = function ($weights, $sample, $target) { |
|
| 173 | + $callback = function($weights, $sample, $target) { |
|
| 174 | 174 | $this->weights = $weights; |
| 175 | 175 | |
| 176 | 176 | $prediction = $this->outputClass($sample); |
@@ -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\Classification\Ensemble; |
| 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\Helper\Optimizer; |
| 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\Helper\Optimizer; |
| 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 | |