PHP Класс PhpBench\Math\Statistics

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
histogram ( array $values, integer $steps = 10, float $lowerBound = null, float $upperBound = null ) : array Generate a histogram.
kdeMode ( array $population, integer $space = 512, float $bandwidth = null ) : float[] Return the mode using the kernel density estimator using the normal distribution.
linspace ( float $min, float $max, integer $num = 50, boolean $endpoint = true ) : float[] Return an array populated with $num numbers from $min to $max.
mean ( array $values ) : mixed Return the mean (average) value of the given values.
stdev ( array $values, boolean $sample = false ) : float Return the standard deviation of a given population.
variance ( array $values, boolean $sample = false ) : float Return the variance for a given population.

Описание методов

histogram() публичный статический Метод

Note this is not a great function, and should not be relied upon for serious use. For a better implementation copy: http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.histogram.html
public static histogram ( array $values, integer $steps = 10, float $lowerBound = null, float $upperBound = null ) : array
$values array
$steps integer
$lowerBound float
$upperBound float
Результат array

kdeMode() публичный статический Метод

The mode is the point in the kernel density estimate with the highest frequency, i.e. the time which correlates with the highest peak. If there are two or more modes (i.e. bimodal, trimodal, etc) then we could take the average of these modes. NOTE: If the kde estimate of the population is multi-modal (it has two points with exactly the same value) then the mean mode is returned. This is potentially misleading, but When benchmarking this should be a very rare occurance.
public static kdeMode ( array $population, integer $space = 512, float $bandwidth = null ) : float[]
$population array
$space integer
$bandwidth float
Результат float[]

linspace() публичный статический Метод

Return an array populated with $num numbers from $min to $max.
public static linspace ( float $min, float $max, integer $num = 50, boolean $endpoint = true ) : float[]
$min float
$max float
$num integer
$endpoint boolean
Результат float[]

mean() публичный статический Метод

Return the mean (average) value of the given values.
public static mean ( array $values ) : mixed
$values array
Результат mixed

stdev() публичный статический Метод

Return the standard deviation of a given population.
public static stdev ( array $values, boolean $sample = false ) : float
$values array
$sample boolean
Результат float

variance() публичный статический Метод

Return the variance for a given population.
public static variance ( array $values, boolean $sample = false ) : float
$values array
$sample boolean
Результат float