View Source Scholar.Stats (Scholar v0.2.1)
Statistical functions
All of the functions in this module are implemented as
numerical functions and can be JIT or AOT compiled with
any supported Nx
compiler.
Summary
Functions
Computes the kurtosis (Fisher or Pearson) of a dataset.
Calculates the nth moment about the mean for a sample.
Computes the sample skewness of a data set.
Functions
Computes the kurtosis (Fisher or Pearson) of a dataset.
Options
:axes
- Axes to calculate the operation. If set tonil
then the operation is performed on the whole tensor. The default value is[0]
.:keep_axes
(boolean/0
) - If set to true, the axes which are reduced are left. The default value isfalse
.:bias
(boolean/0
) - If false, then the calculations are corrected for statistical bias. The default value istrue
.:variant
- If :fisher then Fisher's definition is used, if :pearson then Pearson's definition is used. The default value is:fisher
.
Examples
iex> x = Nx.tensor([[3, 5, 3], [2, 6, 1], [9, 3, 2], [1, 6, 8]])
iex> Scholar.Stats.kurtosis(x)
#Nx.Tensor<
f32[3]
[-0.7980852127075195, -1.0, -0.8394768238067627]
>
Calculates the nth moment about the mean for a sample.
Options
:axes
- Axes to calculate the operation. If set tonil
then the operation is performed on the whole tensor. The default value is[0]
.:keep_axes
(boolean/0
) - If set to true, the axes which are reduced are left. The default value isfalse
.
Examples
iex> x = Nx.tensor([[3, 5, 3], [2, 6, 1], [9, 3, 2], [1, 6, 8]])
iex> Scholar.Stats.moment(x, 2)
#Nx.Tensor<
f32[3]
[9.6875, 1.5, 7.25]
>
Computes the sample skewness of a data set.
Options
:axes
- Axes to calculate the operation. If set tonil
then the operation is performed on the whole tensor. The default value is[0]
.:keep_axes
(boolean/0
) - If set to true, the axes which are reduced are left. The default value isfalse
.:bias
(boolean/0
) - If false, then the calculations are corrected for statistical bias. The default value istrue
.
Examples
iex> x = Nx.tensor([[3, 5, 3], [2, 6, 1], [9, 3, 2], [1, 6, 8]])
iex> Scholar.Stats.skew(x)
#Nx.Tensor<
f32[3]
[0.9794093370437622, -0.8164965510368347, 0.9220733642578125]
>