public static function estimateRadius(Dataset $dataset, float $percentile = 30., ?Distance $kernel = null) : float
    {
        if ($percentile < 0. or $percentile > 100.) {
            throw new InvalidArgumentException('Percentile must be between'
                . " 0 and 100, $percentile given.");
        }

        $kernel = $kernel ?? new Euclidean();

        $distances = [];

        foreach ($dataset as  $sampleA) {
            foreach ($dataset as $sampleB) {
                $distances[] = $kernel->compute($sampleA, $sampleB);
            }
        }

        return Stats::percentile($distances, $percentile);
    }