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