@@ -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\Dataset\Demo; |
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\Dataset\Demo; |
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\Dataset; |
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\Dataset; |
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\Dataset; |
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\Metric; |
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\Metric; |
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; |
6 | 6 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | protected function getColumnTypes(array $samples) |
76 | 76 | { |
77 | 77 | $types = []; |
78 | - for ($i=0; $i<$this->featureCount; $i++) { |
|
78 | + for ($i = 0; $i < $this->featureCount; $i++) { |
|
79 | 79 | $values = array_column($samples, $i); |
80 | 80 | $isCategorical = $this->isCategoricalColumn($values); |
81 | 81 | $types[] = $isCategorical ? self::NOMINAL : self::CONTINUOS; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $this->actualDepth = $depth; |
96 | 96 | } |
97 | 97 | $leftRecords = []; |
98 | - $rightRecords= []; |
|
98 | + $rightRecords = []; |
|
99 | 99 | $remainingTargets = []; |
100 | 100 | $prevRecord = null; |
101 | 101 | $allSame = true; |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | if ($split->evaluate($record)) { |
109 | 109 | $leftRecords[] = $recordNo; |
110 | 110 | } else { |
111 | - $rightRecords[]= $recordNo; |
|
111 | + $rightRecords[] = $recordNo; |
|
112 | 112 | } |
113 | 113 | $target = $this->targets[$recordNo]; |
114 | - if (! in_array($target, $remainingTargets)) { |
|
114 | + if (!in_array($target, $remainingTargets)) { |
|
115 | 115 | $remainingTargets[] = $target; |
116 | 116 | } |
117 | 117 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | $split->leftLeaf = $this->getSplitLeaf($leftRecords, $depth + 1); |
127 | 127 | } |
128 | 128 | if ($rightRecords) { |
129 | - $split->rightLeaf= $this->getSplitLeaf($rightRecords, $depth + 1); |
|
129 | + $split->rightLeaf = $this->getSplitLeaf($rightRecords, $depth + 1); |
|
130 | 130 | } |
131 | 131 | } |
132 | 132 | return $split; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $samples = array_combine($records, $this->preprocess($samples)); |
144 | 144 | $bestGiniVal = 1; |
145 | 145 | $bestSplit = null; |
146 | - for ($i=0; $i<$this->featureCount; $i++) { |
|
146 | + for ($i = 0; $i < $this->featureCount; $i++) { |
|
147 | 147 | $colValues = []; |
148 | 148 | $baseValue = null; |
149 | 149 | foreach ($samples as $index => $row) { |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $countMatrix[$label][$rowIndex]++; |
184 | 184 | } |
185 | 185 | $giniParts = [0, 0]; |
186 | - for ($i=0; $i<=1; $i++) { |
|
186 | + for ($i = 0; $i <= 1; $i++) { |
|
187 | 187 | $part = 0; |
188 | 188 | $sum = array_sum(array_column($countMatrix, $i)); |
189 | 189 | if ($sum > 0) { |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | // Detect and convert continuous data column values into |
206 | 206 | // discrete values by using the median as a threshold value |
207 | 207 | $columns = []; |
208 | - for ($i=0; $i<$this->featureCount; $i++) { |
|
208 | + for ($i = 0; $i < $this->featureCount; $i++) { |
|
209 | 209 | $values = array_column($samples, $i); |
210 | 210 | if ($this->columnTypes[$i] == self::CONTINUOS) { |
211 | 211 | $median = Mean::median($values); |