@@ -30,7 +30,7 @@ |
||
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | - * @param mixed $targetClass |
|
| 33 | + * @param integer $targetClass |
|
| 34 | 34 | */ |
| 35 | 35 | public function backpropagate(array $layers, $targetClass) |
| 36 | 36 | { |
@@ -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 | |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | ); |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | - private function ensureDirectorySeparator(string &$path) |
|
| 239 | + private function ensureDirectorySeparator(string & $path) |
|
| 240 | 240 | { |
| 241 | 241 | if (substr($path, -1) !== DIRECTORY_SEPARATOR) { |
| 242 | 242 | $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\FeatureExtraction; |
| 6 | 6 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - private function transformSample(string &$sample) |
|
| 88 | + private function transformSample(string & $sample) |
|
| 89 | 89 | { |
| 90 | 90 | $counts = []; |
| 91 | 91 | $tokens = $this->tokenizer->tokenize($sample); |
@@ -88,6 +88,7 @@ |
||
| 88 | 88 | |
| 89 | 89 | /** |
| 90 | 90 | * @throws MatrixException |
| 91 | + * @param integer $column |
|
| 91 | 92 | */ |
| 92 | 93 | public function getColumnValues($column) : array |
| 93 | 94 | { |
@@ -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; |
| 6 | 6 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | public function transpose() : Matrix |
| 127 | 127 | { |
| 128 | 128 | if ($this->rows == 1) { |
| 129 | - $matrix = array_map(function ($el) { |
|
| 129 | + $matrix = array_map(function($el) { |
|
| 130 | 130 | return [$el]; |
| 131 | 131 | }, $this->matrix[0]); |
| 132 | 132 | } else { |
@@ -256,7 +256,6 @@ |
||
| 256 | 256 | * |
| 257 | 257 | * The probability is simply taken as the distance of the sample |
| 258 | 258 | * to the decision plane. |
| 259 | - |
|
| 260 | 259 | * @param mixed $label |
| 261 | 260 | */ |
| 262 | 261 | protected function predictProbability(array $sample, $label) : float |
@@ -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 | * @package JAMA |
| 6 | 6 | * |