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;
    }