Statistics API Reference
The stats module provides functions for statistical analysis and data reduction.
Reductions
sum
Calculates the sum of all elements in the array.
pub fn sum(allocator: Allocator, comptime T: type, a: NDArray(T)) !Tprod
Calculates the product of all elements in the array.
pub fn prod(allocator: Allocator, comptime T: type, a: NDArray(T)) !Tmin
Finds the minimum value in the array.
pub fn min(allocator: Allocator, comptime T: type, a: NDArray(T)) !Tmax
Finds the maximum value in the array.
pub fn max(allocator: Allocator, comptime T: type, a: NDArray(T)) !Tmean
Calculates the arithmetic mean of the array elements.
pub fn mean(allocator: Allocator, comptime T: type, a: NDArray(T)) !f64median
Calculates the median of the array elements.
pub fn median(allocator: Allocator, comptime T: type, a: NDArray(T)) !f64variance
Calculates the variance of the array elements.
pub fn variance(allocator: Allocator, comptime T: type, a: NDArray(T)) !f64stdDev
Calculates the standard deviation of the array elements.
pub fn stdDev(allocator: Allocator, comptime T: type, a: NDArray(T)) !f64Axis Operations
sumAxis
Calculates the sum of array elements along a specified axis.
pub fn sumAxis(allocator: Allocator, comptime T: type, a: NDArray(T), axis: usize) !NDArray(T)meanAxis
Calculates the mean of array elements along a specified axis.
pub fn meanAxis(allocator: Allocator, comptime T: type, a: NDArray(T), axis: usize) !NDArray(f64)Index Operations
argmin
Returns the index of the minimum value in the flattened array.
pub fn argmin(allocator: Allocator, comptime T: type, a: NDArray(T)) !usizeargmax
Returns the index of the maximum value in the flattened array.
pub fn argmax(allocator: Allocator, comptime T: type, a: NDArray(T)) !usizeOther
bincount
Count number of occurrences of each value in array of non-negative ints.
pub fn bincount(allocator: Allocator, comptime T: type, a: NDArray(T)) !NDArray(usize)unique
Find the unique elements of an array.
pub fn unique(allocator: Allocator, comptime T: type, a: NDArray(T)) !NDArray(T)