|
@@ 194-198 (lines=5) @@
|
| 191 |
|
// the average value for the cut point |
| 192 |
|
$threshold = array_sum($values) / (float) count($values); |
| 193 |
|
list($errorRate, $prob) = $this->calculateErrorRate($threshold, $operator, $values); |
| 194 |
|
if ($split == null || $errorRate < $split['trainingErrorRate']) { |
| 195 |
|
$split = ['value' => $threshold, 'operator' => $operator, |
| 196 |
|
'prob' => $prob, 'column' => $col, |
| 197 |
|
'trainingErrorRate' => $errorRate]; |
| 198 |
|
} |
| 199 |
|
|
| 200 |
|
// Try other possible points one by one |
| 201 |
|
for ($step = $minValue; $step <= $maxValue; $step+= $stepSize) { |
|
@@ 204-208 (lines=5) @@
|
| 201 |
|
for ($step = $minValue; $step <= $maxValue; $step+= $stepSize) { |
| 202 |
|
$threshold = (float)$step; |
| 203 |
|
list($errorRate, $prob) = $this->calculateErrorRate($threshold, $operator, $values); |
| 204 |
|
if ($errorRate < $split['trainingErrorRate']) { |
| 205 |
|
$split = ['value' => $threshold, 'operator' => $operator, |
| 206 |
|
'prob' => $prob, 'column' => $col, |
| 207 |
|
'trainingErrorRate' => $errorRate]; |
| 208 |
|
} |
| 209 |
|
}// for |
| 210 |
|
} |
| 211 |
|
|
|
@@ 233-237 (lines=5) @@
|
| 230 |
|
foreach ($distinctVals as $val) { |
| 231 |
|
list($errorRate, $prob) = $this->calculateErrorRate($val, $operator, $values); |
| 232 |
|
|
| 233 |
|
if ($split == null || $split['trainingErrorRate'] < $errorRate) { |
| 234 |
|
$split = ['value' => $val, 'operator' => $operator, |
| 235 |
|
'prob' => $prob, 'column' => $col, |
| 236 |
|
'trainingErrorRate' => $errorRate]; |
| 237 |
|
} |
| 238 |
|
}// for |
| 239 |
|
} |
| 240 |
|
|