public function fit(DataSet $dataSet, float $learningRate = 0.0): AlgorithmsInterface
    {
        $outputSize = count($dataSet->getMapper()->getOutputKeys());
        if ($outputSize !== 1) {
            throw new WrongUsageException('Linear regression assumes only one output, ' . $outputSize . ' given');
        }

        if (count($dataSet->getMapper()->getDimensionKeys()) === 1) {
            $this
                ->calculator
                ->using($dataSet)
                ->calculate(new Mean())
                ->then(new SimpleLinearCoefficients());
            ;
        } else {
            $this->coefficients = $this
                ->calculator
                ->using($dataSet)
                ->calculate(new MultipleLinearCoefficients())
                ->getResult()
                ->last()
            ;
        }

        $this->coefficients = $this->calculator->getResult()->last();

        return $this;
    }