|
@@ 157-160 (lines=4) @@
|
| 154 |
|
// the average value for the cut point |
| 155 |
|
$threshold = array_sum($values) / (float) count($values); |
| 156 |
|
$errorRate = $this->calculateErrorRate($threshold, $operator, $values); |
| 157 |
|
if ($split == null || $errorRate < $split['trainingErrorRate']) { |
| 158 |
|
$split = ['value' => $threshold, 'operator' => $operator, |
| 159 |
|
'column' => $col, 'trainingErrorRate' => $errorRate]; |
| 160 |
|
} |
| 161 |
|
|
| 162 |
|
// Try other possible points one by one |
| 163 |
|
for ($step = $minValue; $step <= $maxValue; $step+= $stepSize) { |
|
@@ 166-169 (lines=4) @@
|
| 163 |
|
for ($step = $minValue; $step <= $maxValue; $step+= $stepSize) { |
| 164 |
|
$threshold = (float)$step; |
| 165 |
|
$errorRate = $this->calculateErrorRate($threshold, $operator, $values); |
| 166 |
|
if ($errorRate < $split['trainingErrorRate']) { |
| 167 |
|
$split = ['value' => $threshold, 'operator' => $operator, |
| 168 |
|
'column' => $col, 'trainingErrorRate' => $errorRate]; |
| 169 |
|
} |
| 170 |
|
}// for |
| 171 |
|
} |
| 172 |
|
|
|
@@ 194-197 (lines=4) @@
|
| 191 |
|
foreach ($distinctVals as $val) { |
| 192 |
|
$errorRate = $this->calculateErrorRate($val, $operator, $values); |
| 193 |
|
|
| 194 |
|
if ($split == null || $split['trainingErrorRate'] < $errorRate) { |
| 195 |
|
$split = ['value' => $val, 'operator' => $operator, |
| 196 |
|
'column' => $col, 'trainingErrorRate' => $errorRate]; |
| 197 |
|
} |
| 198 |
|
}// for |
| 199 |
|
} |
| 200 |
|
|