@@ -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\DecisionTree; |
6 | 6 | |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | /** |
35 | 35 | * @var DecisionTreeLeaf |
36 | 36 | */ |
37 | - public $rightLeaf= null; |
|
37 | + public $rightLeaf = null; |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * @var array |
@@ -120,16 +120,16 @@ discard block |
||
120 | 120 | return 0.0; |
121 | 121 | } |
122 | 122 | |
123 | - $nodeSampleCount = (float)count($this->records); |
|
123 | + $nodeSampleCount = (float) count($this->records); |
|
124 | 124 | $iT = $this->giniIndex; |
125 | 125 | |
126 | 126 | if ($this->leftLeaf) { |
127 | - $pL = count($this->leftLeaf->records)/$nodeSampleCount; |
|
127 | + $pL = count($this->leftLeaf->records) / $nodeSampleCount; |
|
128 | 128 | $iT -= $pL * $this->leftLeaf->giniIndex; |
129 | 129 | } |
130 | 130 | |
131 | 131 | if ($this->rightLeaf) { |
132 | - $pR = count($this->rightLeaf->records)/$nodeSampleCount; |
|
132 | + $pR = count($this->rightLeaf->records) / $nodeSampleCount; |
|
133 | 133 | $iT -= $pR * $this->rightLeaf->giniIndex; |
134 | 134 | } |
135 | 135 | |
@@ -156,22 +156,22 @@ discard block |
||
156 | 156 | if (!preg_match("/^[<>=]{1,2}/", $value)) { |
157 | 157 | $value = "=$value"; |
158 | 158 | } |
159 | - $value = "<b>$col $value</b><br>Gini: ". number_format($this->giniIndex, 2); |
|
159 | + $value = "<b>$col $value</b><br>Gini: ".number_format($this->giniIndex, 2); |
|
160 | 160 | } |
161 | 161 | $str = "<table ><tr><td colspan=3 align=center style='border:1px solid;'> |
162 | 162 | $value</td></tr>"; |
163 | 163 | if ($this->leftLeaf || $this->rightLeaf) { |
164 | - $str .='<tr>'; |
|
164 | + $str .= '<tr>'; |
|
165 | 165 | if ($this->leftLeaf) { |
166 | - $str .="<td valign=top><b>| Yes</b><br>" . $this->leftLeaf->getHTML($columnNames) . "</td>"; |
|
166 | + $str .= "<td valign=top><b>| Yes</b><br>".$this->leftLeaf->getHTML($columnNames)."</td>"; |
|
167 | 167 | } else { |
168 | - $str .='<td></td>'; |
|
168 | + $str .= '<td></td>'; |
|
169 | 169 | } |
170 | - $str .='<td> </td>'; |
|
170 | + $str .= '<td> </td>'; |
|
171 | 171 | if ($this->rightLeaf) { |
172 | - $str .="<td valign=top align=right><b>No |</b><br>" . $this->rightLeaf->getHTML($columnNames) . "</td>"; |
|
172 | + $str .= "<td valign=top align=right><b>No |</b><br>".$this->rightLeaf->getHTML($columnNames)."</td>"; |
|
173 | 173 | } else { |
174 | - $str .='<td></td>'; |
|
174 | + $str .= '<td></td>'; |
|
175 | 175 | } |
176 | 176 | $str .= '</tr>'; |
177 | 177 | } |