src/Phpml/Classification/Linear/LogisticRegression.php 1 location
|
@@ 270-280 (lines=11) @@
|
267 |
|
* @param array $sample |
268 |
|
* @param mixed $label |
269 |
|
*/ |
270 |
|
protected function predictProbability(array $sample, $label) |
271 |
|
{ |
272 |
|
$predicted = $this->predictSampleBinary($sample); |
273 |
|
|
274 |
|
if (strval($predicted) == strval($label)) { |
275 |
|
$sample = $this->checkNormalizedSample($sample); |
276 |
|
return abs($this->output($sample) - 0.5); |
277 |
|
} |
278 |
|
|
279 |
|
return 0.0; |
280 |
|
} |
281 |
|
} |
282 |
|
|
src/Phpml/Classification/Linear/Perceptron.php 1 location
|
@@ 268-278 (lines=11) @@
|
265 |
|
* @param array $sample |
266 |
|
* @param mixed $label |
267 |
|
*/ |
268 |
|
protected function predictProbability(array $sample, $label) |
269 |
|
{ |
270 |
|
$predicted = $this->predictSampleBinary($sample); |
271 |
|
|
272 |
|
if (strval($predicted) == strval($label)) { |
273 |
|
$sample = $this->checkNormalizedSample($sample); |
274 |
|
return abs($this->output($sample)); |
275 |
|
} |
276 |
|
|
277 |
|
return 0.0; |
278 |
|
} |
279 |
|
|
280 |
|
/** |
281 |
|
* @param array $sample |