PhpBench\Math\Kde::__construct PHP Метод

__construct() публичный Метод

Kernel density estimation is a way to estimate the probability density function (PDF) of a random variable in a non-parametric way. gaussian_kde works for both uni-variate and multi-variate data. It includes automatic bandwidth determination. The estimation works best for a unimodal distribution; bimodal or multi-modal distributions tend to be oversmoothed. Note: Bandwidth selection strongly influences the estimate obtained from the KDE (much more so than the actual shape of the kernel). Bandwidth selection can be done by a "rule of thumb", by cross-validation, by "plug-in methods" or by other means; see [3]_, [4]_ for reviews. gaussian_kde uses a rule of thumb, the default is Scott's Rule. Scott's Rule [1]_, implemented as scotts_factor, is:: n**(-1./(d+4)), with n the number of data points and d the number of dimensions. Silverman's Rule [2]_, implemented as silverman_factor, is:: (n * (d + 2) / 4.)**(-1. / (d + 4)). Good general descriptions of kernel density estimation can be found in [1]_ and [2]_, the mathematics for this multi-dimensional implementation can be found in [1]_. References .. [1] D.W. Scott, "Multivariate Density Estimation: Theory, Practice, and Visualization", John Wiley & Sons, New York, Chicester, 1992. .. [2] B.W. Silverman, "Density Estimation for Statistics and Data Analysis", Vol. 26, Monographs on Statistics and Applied Probability, Chapman and Hall, London, 1986.
public __construct ( array $dataset, string $bwMethod = null )
$dataset array Array of univariate data points.
$bwMethod string : Either "scott", "silverman" or an explicit (float) value.
    public function __construct(array $dataset, $bwMethod = null)
    {
        $this->dataset = $dataset;
        if (count($this->dataset) <= 1) {
            throw new \OutOfBoundsException('`dataset` input should have multiple elements.');
        }
        $this->setBandwidth($bwMethod);
    }