Test Failed
Pull Request — master (#100)
by Никита
04:08
created
src/Phpml/Classification/DecisionTree/DecisionTreeLeaf.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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>&nbsp;</td>';
170
+            $str .= '<td>&nbsp;</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
         }
Please login to merge, or discard this patch.
src/Phpml/Classification/DecisionTree.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Phpml\Classification;
6 6
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
         // otherwise group the records so that we can classify the leaf
155 155
         // in case maximum depth is reached
156 156
         $leftRecords = [];
157
-        $rightRecords= [];
157
+        $rightRecords = [];
158 158
         $remainingTargets = [];
159 159
         $prevRecord = null;
160 160
         $allSame = true;
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
             if ($split->evaluate($record)) {
173 173
                 $leftRecords[] = $recordNo;
174 174
             } else {
175
-                $rightRecords[]= $recordNo;
175
+                $rightRecords[] = $recordNo;
176 176
             }
177 177
 
178 178
             // Group remaining targets
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
                 $split->leftLeaf = $this->getSplitLeaf($leftRecords, $depth + 1);
194 194
             }
195 195
             if ($rightRecords) {
196
-                $split->rightLeaf= $this->getSplitLeaf($rightRecords, $depth + 1);
196
+                $split->rightLeaf = $this->getSplitLeaf($rightRecords, $depth + 1);
197 197
             }
198 198
         }
199 199
 
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
      */
363 363
     protected static function isCategoricalColumn(array $columnValues) : bool
364 364
     {
365
-        $columnValues = array_filter($columnValues, function ($value) { return !is_null($value); }); // Filtering null values out
365
+        $columnValues = array_filter($columnValues, function($value) { return !is_null($value); }); // Filtering null values out
366 366
         $count = count($columnValues);
367 367
 
368 368
         // There are two main indicators that *may* show whether a
Please login to merge, or discard this patch.