@@ -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\Linear; |
| 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\Classification; |
| 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; |
| 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; |
| 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 | |
@@ -162,20 +162,20 @@ discard block |
||
| 162 | 162 | switch ($this->kernel) { |
| 163 | 163 | case self::KERNEL_LINEAR: |
| 164 | 164 | // k(x,y) = xT.y |
| 165 | - return function ($x, $y) { |
|
| 165 | + return function($x, $y) { |
|
| 166 | 166 | return Matrix::dot($x, $y)[0]; |
| 167 | 167 | }; |
| 168 | 168 | case self::KERNEL_RBF: |
| 169 | 169 | // k(x,y)=exp(-γ.|x-y|) where |..| is Euclidean distance |
| 170 | 170 | $dist = new Euclidean(); |
| 171 | 171 | |
| 172 | - return function ($x, $y) use ($dist) { |
|
| 172 | + return function($x, $y) use ($dist) { |
|
| 173 | 173 | return exp(-$this->gamma * $dist->sqDistance($x, $y)); |
| 174 | 174 | }; |
| 175 | 175 | |
| 176 | 176 | case self::KERNEL_SIGMOID: |
| 177 | 177 | // k(x,y)=tanh(γ.xT.y+c0) where c0=1 |
| 178 | - return function ($x, $y) { |
|
| 178 | + return function($x, $y) { |
|
| 179 | 179 | $res = Matrix::dot($x, $y)[0] + 1.0; |
| 180 | 180 | |
| 181 | 181 | return tanh($this->gamma * $res); |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | // k(x,y)=exp(-γ.|x-y|) where |..| is Manhattan distance |
| 186 | 186 | $dist = new Manhattan(); |
| 187 | 187 | |
| 188 | - return function ($x, $y) use ($dist) { |
|
| 188 | + return function($x, $y) use ($dist) { |
|
| 189 | 189 | return exp(-$this->gamma * $dist->distance($x, $y)); |
| 190 | 190 | }; |
| 191 | 191 | |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | protected function projectSample(array $pairs) |
| 220 | 220 | { |
| 221 | 221 | // Normalize eigenvectors by eig = eigVectors / eigValues |
| 222 | - $func = function ($eigVal, $eigVect) { |
|
| 222 | + $func = function($eigVal, $eigVect) { |
|
| 223 | 223 | $m = new Matrix($eigVect, false); |
| 224 | 224 | $a = $m->divideByScalar($eigVal)->toArray(); |
| 225 | 225 | |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | /** |
| 5 | 5 | * @package JAMA |
| 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 | * |
| 6 | 6 | * Class to obtain eigenvalues and eigenvectors of a real matrix. |
@@ -838,7 +838,7 @@ discard block |
||
| 838 | 838 | |
| 839 | 839 | // Always return the eigenvectors of length 1.0 |
| 840 | 840 | $vectors = new Matrix($vectors); |
| 841 | - $vectors = array_map(function ($vect) { |
|
| 841 | + $vectors = array_map(function($vect) { |
|
| 842 | 842 | $sum = 0; |
| 843 | 843 | for ($i = 0; $i < count($vect); ++$i) { |
| 844 | 844 | $sum += $vect[$i] ** 2; |
@@ -65,24 +65,24 @@ |
||
| 65 | 65 | private $V = []; |
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | - * Array for internal storage of nonsymmetric Hessenberg form. |
|
| 69 | - * |
|
| 70 | - * @var array |
|
| 71 | - */ |
|
| 68 | + * Array for internal storage of nonsymmetric Hessenberg form. |
|
| 69 | + * |
|
| 70 | + * @var array |
|
| 71 | + */ |
|
| 72 | 72 | private $H = []; |
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | - * Working storage for nonsymmetric algorithm. |
|
| 76 | - * |
|
| 77 | - * @var array |
|
| 78 | - */ |
|
| 75 | + * Working storage for nonsymmetric algorithm. |
|
| 76 | + * |
|
| 77 | + * @var array |
|
| 78 | + */ |
|
| 79 | 79 | private $ort; |
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | - * Used for complex scalar division. |
|
| 83 | - * |
|
| 84 | - * @var float |
|
| 85 | - */ |
|
| 82 | + * Used for complex scalar division. |
|
| 83 | + * |
|
| 84 | + * @var float |
|
| 85 | + */ |
|
| 86 | 86 | private $cdivr; |
| 87 | 87 | private $cdivi; |
| 88 | 88 | |
@@ -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 | |