@@ -91,7 +91,7 @@ |
||
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
94 | - * @param $column |
|
94 | + * @param integer $column |
|
95 | 95 | * |
96 | 96 | * @return array |
97 | 97 | * |
@@ -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\SupportVectorMachine; |
6 | 6 |
@@ -128,7 +128,7 @@ |
||
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
131 | - * @return mixed |
|
131 | + * @return integer |
|
132 | 132 | */ |
133 | 133 | public function count() |
134 | 134 | { |
@@ -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\SupportVectorMachine; |
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\Association; |
6 | 6 | |
@@ -107,11 +107,11 @@ discard block |
||
107 | 107 | */ |
108 | 108 | protected function predictSample(array $sample) : array |
109 | 109 | { |
110 | - $predicts = array_values(array_filter($this->getRules(), function ($rule) use ($sample) { |
|
110 | + $predicts = array_values(array_filter($this->getRules(), function($rule) use ($sample) { |
|
111 | 111 | return $this->equals($rule[self::ARRAY_KEY_ANTECEDENT], $sample); |
112 | 112 | })); |
113 | 113 | |
114 | - return array_map(function ($rule) { |
|
114 | + return array_map(function($rule) { |
|
115 | 115 | return $rule[self::ARRAY_KEY_CONSEQUENT]; |
116 | 116 | }, $predicts); |
117 | 117 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $cardinality = count($sample); |
180 | 180 | $antecedents = $this->powerSet($sample); |
181 | 181 | |
182 | - return array_filter($antecedents, function ($antecedent) use ($cardinality) { |
|
182 | + return array_filter($antecedents, function($antecedent) use ($cardinality) { |
|
183 | 183 | return (count($antecedent) != $cardinality) && ($antecedent != []); |
184 | 184 | }); |
185 | 185 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | } |
202 | 202 | } |
203 | 203 | |
204 | - return array_map(function ($entry) { |
|
204 | + return array_map(function($entry) { |
|
205 | 205 | return [$entry]; |
206 | 206 | }, $items); |
207 | 207 | } |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | */ |
216 | 216 | private function frequent(array $samples) : array |
217 | 217 | { |
218 | - return array_filter($samples, function ($entry) { |
|
218 | + return array_filter($samples, function($entry) { |
|
219 | 219 | return $this->support($entry) >= $this->support; |
220 | 220 | }); |
221 | 221 | } |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | */ |
296 | 296 | private function frequency(array $sample) : int |
297 | 297 | { |
298 | - return count(array_filter($this->samples, function ($entry) use ($sample) { |
|
298 | + return count(array_filter($this->samples, function($entry) use ($sample) { |
|
299 | 299 | return $this->subset($entry, $sample); |
300 | 300 | })); |
301 | 301 | } |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | */ |
313 | 313 | private function contains(array $system, array $set) : bool |
314 | 314 | { |
315 | - return (bool) array_filter($system, function ($entry) use ($set) { |
|
315 | + return (bool) array_filter($system, function($entry) use ($set) { |
|
316 | 316 | return $this->equals($entry, $set); |
317 | 317 | }); |
318 | 318 | } |
@@ -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 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | /** |
94 | 94 | * @param string $sample |
95 | 95 | */ |
96 | - private function transformSample(string &$sample) |
|
96 | + private function transformSample(string & $sample) |
|
97 | 97 | { |
98 | 98 | $counts = []; |
99 | 99 | $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\FeatureExtraction; |
6 | 6 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | $count = count($samples); |
34 | 34 | foreach ($this->idf as &$value) { |
35 | - $value = log((float)($count / $value), 10.0); |
|
35 | + $value = log((float) ($count / $value), 10.0); |
|
36 | 36 | } |
37 | 37 | } |
38 | 38 |
@@ -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 | |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | self::checkArrayLength($numbers); |
35 | 35 | |
36 | 36 | $count = count($numbers); |
37 | - $middleIndex = (int)floor($count / 2); |
|
37 | + $middleIndex = (int) floor($count / 2); |
|
38 | 38 | sort($numbers, SORT_NUMERIC); |
39 | 39 | $median = $numbers[$middleIndex]; |
40 | 40 |
@@ -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 | |
@@ -43,6 +43,6 @@ discard block |
||
43 | 43 | $distance += pow(abs($a[$i] - $b[$i]), $this->lambda); |
44 | 44 | } |
45 | 45 | |
46 | - return (float)pow($distance, 1 / $this->lambda); |
|
46 | + return (float) pow($distance, 1 / $this->lambda); |
|
47 | 47 | } |
48 | 48 | } |
@@ -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\Preprocessing; |
6 | 6 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | foreach ($sample as $feature) { |
79 | 79 | $norm2 += $feature * $feature; |
80 | 80 | } |
81 | - $norm2 = sqrt((float)$norm2); |
|
81 | + $norm2 = sqrt((float) $norm2); |
|
82 | 82 | |
83 | 83 | if (0 == $norm2) { |
84 | 84 | $sample = array_fill(0, count($sample), 1); |
@@ -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\SupportVectorMachine; |
6 | 6 |