__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
declare(strict_types=1);
namespace Phpml\Metric;
use Phpml\Exception\InvalidArgumentException;
class Accuracy
{
/**
* @return float|int
*
* @throws InvalidArgumentException
*/
public static function score(array $actualLabels, array $predictedLabels, bool $normalize = true)
{
if (count($actualLabels) != count($predictedLabels)) {
throw new InvalidArgumentException('Size of given arrays does not match');
}
$score = 0;
foreach ($actualLabels as $index => $label) {
if ($label == $predictedLabels[$index]) {
++$score;
}
}
if ($normalize) {
$score /= count($actualLabels);
}
return $score;
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| Accuracy.php | File | 770 B | 0777 |
|
| ClassificationReport.php | File | 5.76 KB | 0777 |
|
| ConfusionMatrix.php | File | 1.3 KB | 0777 |
|
| Regression.php | File | 2.38 KB | 0777 |
|