src/Prediction/Linear/LinearRegression.php
public function predict(DataSet $dataSet)
    {
        foreach ($dataSet as $instance) {
            $prediction = $this
                ->calculator
                ->calculate(new LinearPrediction($instance->getDimensions(), $this->coefficients))
                ->getResult()
                ->last()
            ;
            $instance->addResult(
                static::class,
                [
                    'type'   => self::PREDICTION,
                    'result' => $prediction
                ]
            );
        }

        $this->calculator->using($dataSet)->calculate(new Benchmark(LinearRegression::class));
        $results = $this->calculator->getResult()->of(Benchmark::class);

        $this->accuracy = $results[Benchmark::ACCURACY] ?? 0;
        $this->rmse = $results[Benchmark::RMSE] ?? 0;
    }
public function predict(DataSet $dataSet)
    {
        foreach ($dataSet as $instance) {
            $prediction = $this
                ->calculator
                ->calculate(new LinearPrediction($instance->getDimensions(), $this->coefficients))
                ->getResult()
                ->last()
            ;
            $instance->addResult(
                static::class,
                [
                    'type'   => self::PREDICTION,
                    'result' => $prediction
                ]
            );
        }

        $this->calculator->using($dataSet)->calculate(new Benchmark(LinearRegression::class));
        $results = $this->calculator->getResult()->of(Benchmark::class);

        $this->accuracy = $results[Benchmark::ACCURACY] ?? 0;
        $this->rmse = $results[Benchmark::RMSE] ?? 0;
    }
Makes a linear prediction of input based on coefficients
@param DataSet $dataSet
@throws WrongUsageException