arrayfire.statistics module¶
Statistical algorithms (mean, var, stdev, etc).
-
arrayfire.statistics.
corrcoef
(x, y)[source]¶ Calculate the correlation coefficient of the input arrays.
- Parameters
- x: af.Array
The first input array.
- y: af.Array
The second input array.
- Returns
- output: af.Array
Array containing the correlation coefficient of the input arrays.
-
arrayfire.statistics.
cov
(a, isbiased=False, dim=None)[source]¶ Calculate covariance along a given dimension.
- Parameters
- a: af.Array
The input array.
- isbiased: optional: Boolean. default: False.
Boolean denoting whether biased estimate should be taken.
- dim: optional: int. default: None.
The dimension for which to obtain the covariance from input data.
- Returns
- output: af.Array
Array containing the covariance of the input array along a given dimension.
-
arrayfire.statistics.
mean
(a, weights=None, dim=None)[source]¶ Calculate mean along a given dimension.
- Parameters
- a: af.Array
The input array.
- weights: optional: af.Array. default: None.
Array to calculate the weighted mean. Must match size of the input array.
- dim: optional: int. default: None.
The dimension for which to obtain the mean from input data.
- Returns
- output: af.Array
Array containing the mean of the input array along a given dimension.
-
arrayfire.statistics.
meanvar
(a, weights=None, bias=<VARIANCE.DEFAULT: 0>, dim=-1)[source]¶ Calculate mean and variance along a given dimension.
- Parameters
- a: af.Array
The input array.
- weights: optional: af.Array. default: None.
Array to calculate for the weighted mean. Must match size of the input array.
- bias: optional: af.VARIANCE. default: DEFAULT.
population variance(VARIANCE.POPULATION) or sample variance(VARIANCE.SAMPLE).
- dim: optional: int. default: -1.
The dimension for which to obtain the variance from input data.
- Returns
- mean: af.Array
Array containing the mean of the input array along a given dimension.
- variance: af.Array
Array containing the variance of the input array along a given dimension.
-
arrayfire.statistics.
median
(a, dim=None)[source]¶ Calculate median along a given dimension.
- Parameters
- a: af.Array
The input array.
- dim: optional: int. default: None.
The dimension for which to obtain the median from input data.
- Returns
- output: af.Array
Array containing the median of the input array along a given dimension.
-
arrayfire.statistics.
stdev
(a, dim=None)[source]¶ Calculate standard deviation along a given dimension.
- Parameters
- a: af.Array
The input array.
- dim: optional: int. default: None.
The dimension for which to obtain the standard deviation from input data.
- Returns
- output: af.Array
Array containing the standard deviation of the input array along a given dimension.
-
arrayfire.statistics.
topk
(data, k, dim=0, order=<TOPK.DEFAULT: 0>)[source]¶ Return top k elements along a single dimension.
- Parameters
- data: af.Array
Input array to return k elements from.
- k: scalar. default: 0
The number of elements to return from input array.
- dim: optional: scalar. default: 0
The dimension along which the top k elements are extracted. Note: at the moment, topk() only supports the extraction of values along the first dimension.
- order: optional: af.TOPK. default: af.TOPK.DEFAULT
The ordering of k extracted elements. Defaults to top k max values.
- Returns
- values: af.Array
Top k elements from input array.
- indices: af.Array
Corresponding index array to top k elements.
-
arrayfire.statistics.
var
(a, isbiased=False, weights=None, dim=None)[source]¶ Calculate variance along a given dimension.
- Parameters
- a: af.Array
The input array.
- isbiased: optional: Boolean. default: False.
Boolean denoting population variance (false) or sample variance (true).
- weights: optional: af.Array. default: None.
Array to calculate for the weighted mean. Must match size of the input array.
- dim: optional: int. default: None.
The dimension for which to obtain the variance from input data.
- Returns
- output: af.Array
Array containing the variance of the input array along a given dimension.