|
@@ 178-181 (lines=4) @@
|
| 175 |
|
// the average value for the cut point |
| 176 |
|
$threshold = array_sum($values) / (float) count($values); |
| 177 |
|
$errorRate = $this->calculateErrorRate($threshold, $operator, $values); |
| 178 |
|
if ($split == null || $errorRate < $split['trainingErrorRate']) { |
| 179 |
|
$split = ['value' => $threshold, 'operator' => $operator, |
| 180 |
|
'column' => $col, 'trainingErrorRate' => $errorRate]; |
| 181 |
|
} |
| 182 |
|
|
| 183 |
|
// Try other possible points one by one |
| 184 |
|
for ($step = $minValue; $step <= $maxValue; $step+= $stepSize) { |
|
@@ 187-190 (lines=4) @@
|
| 184 |
|
for ($step = $minValue; $step <= $maxValue; $step+= $stepSize) { |
| 185 |
|
$threshold = (float)$step; |
| 186 |
|
$errorRate = $this->calculateErrorRate($threshold, $operator, $values); |
| 187 |
|
if ($errorRate < $split['trainingErrorRate']) { |
| 188 |
|
$split = ['value' => $threshold, 'operator' => $operator, |
| 189 |
|
'column' => $col, 'trainingErrorRate' => $errorRate]; |
| 190 |
|
} |
| 191 |
|
}// for |
| 192 |
|
} |
| 193 |
|
|
|
@@ 215-218 (lines=4) @@
|
| 212 |
|
foreach ($distinctVals as $val) { |
| 213 |
|
$errorRate = $this->calculateErrorRate($val, $operator, $values); |
| 214 |
|
|
| 215 |
|
if ($split == null || $split['trainingErrorRate'] < $errorRate) { |
| 216 |
|
$split = ['value' => $val, 'operator' => $operator, |
| 217 |
|
'column' => $col, 'trainingErrorRate' => $errorRate]; |
| 218 |
|
} |
| 219 |
|
}// for |
| 220 |
|
} |
| 221 |
|
|