PHP Class PhpBench\Math\Statistics

Afficher le fichier Open project: dantleech/phpbench Class Usage Examples

Méthodes publiques

Méthode Description
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.

Method Details

histogram() public static méthode

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
Résultat array

kdeMode() public static méthode

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
Résultat float[]

linspace() public static méthode

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
Résultat float[]

mean() public static méthode

Return the mean (average) value of the given values.
public static mean ( array $values ) : mixed
$values array
Résultat mixed

stdev() public static méthode

Return the standard deviation of a given population.
public static stdev ( array $values, boolean $sample = false ) : float
$values array
$sample boolean
Résultat float

variance() public static méthode

Return the variance for a given population.
public static variance ( array $values, boolean $sample = false ) : float
$values array
$sample boolean
Résultat float