|
@@ 186-190 (lines=5) @@
|
| 183 |
|
// the average value for the cut point |
| 184 |
|
$threshold = array_sum($values) / (float) count($values); |
| 185 |
|
list($errorRate, $prob) = $this->calculateErrorRate($targets, $threshold, $operator, $values); |
| 186 |
|
if ($split == null || $errorRate < $split['trainingErrorRate']) { |
| 187 |
|
$split = ['value' => $threshold, 'operator' => $operator, |
| 188 |
|
'prob' => $prob, 'column' => $col, |
| 189 |
|
'trainingErrorRate' => $errorRate]; |
| 190 |
|
} |
| 191 |
|
|
| 192 |
|
// Try other possible points one by one |
| 193 |
|
for ($step = $minValue; $step <= $maxValue; $step+= $stepSize) { |
|
@@ 196-200 (lines=5) @@
|
| 193 |
|
for ($step = $minValue; $step <= $maxValue; $step+= $stepSize) { |
| 194 |
|
$threshold = (float)$step; |
| 195 |
|
list($errorRate, $prob) = $this->calculateErrorRate($targets, $threshold, $operator, $values); |
| 196 |
|
if ($errorRate < $split['trainingErrorRate']) { |
| 197 |
|
$split = ['value' => $threshold, 'operator' => $operator, |
| 198 |
|
'prob' => $prob, 'column' => $col, |
| 199 |
|
'trainingErrorRate' => $errorRate]; |
| 200 |
|
} |
| 201 |
|
}// for |
| 202 |
|
} |
| 203 |
|
|
|
@@ 226-230 (lines=5) @@
|
| 223 |
|
foreach ($distinctVals as $val) { |
| 224 |
|
list($errorRate, $prob) = $this->calculateErrorRate($targets, $val, $operator, $values); |
| 225 |
|
|
| 226 |
|
if ($split == null || $split['trainingErrorRate'] < $errorRate) { |
| 227 |
|
$split = ['value' => $val, 'operator' => $operator, |
| 228 |
|
'prob' => $prob, 'column' => $col, |
| 229 |
|
'trainingErrorRate' => $errorRate]; |
| 230 |
|
} |
| 231 |
|
} |
| 232 |
|
} |
| 233 |
|
|