statistics.jl
Unit for statistics, probability and related functions.
Category | Output |
---|---|
1. Probability | functions relating to probability |
2. Descriptive Statistics | functions relating to decriptive statistics |
Probability
Function | Description |
---|---|
softmax | compute softmax probabilities |
PosDefManifold.softmax
— Functionsoftmax(χ::Vector{T}) where T<:Real
Given a real vector of $k$ non-negative scores $χ=c_1,...,c_k$, return the vector $π=p_1,...,p_k$ of their softmax probabilities, as per
$p_i=\frac{\textrm{e}^{c_i}}{\sum_{i=1}^{k}\textrm{e}^{c_i}}$.
Examples
χ=[1.0, 2.3, 0.4, 5.0]
π=softmax(χ)
Descriptive Statistics
Function | Description |
---|---|
mean | scalar mean of real or complex numbers according to the specified metric |
std | scalar standard deviation of real or complex numbers according to the specified metric |
mean(metric::Metric, ν::Vector{T}) where T<:RealOrComplex
See bottom of documentation of general function mean
Statistics.std
— Functionstd(metric::Metric, ν::Vector{T};
corrected::Bool=true,
mean=nothing) where T<:RealOrComplex
Standard deviation of $k$ real or complex scalars, using the specified metric
of type Metric::Enumerated type and the specified mean
if provided.
Only the Euclidean and Fisher metric are supported by this function. Using the Euclidean metric return the output of standard Julia std function. Using the Fisher metric return the scalar geometric standard deviation, which is defined such as,
$\sigma=\text{exp}\Big(\sqrt{k^{-1}\sum_{i=1}^{k}\text{ln}^2(v_i/\mu})\Big)$.
If corrected
is true
, then the sum is scaled with $k-1$, whereas if it is false
the sum is scaled with $k$.
Examples
using PosDefManifold
# Generate 10 random numbers distributed as a chi-square with 2 df.
ν=[randχ²(2) for i=1:10]
arithmetic_sd=std(Euclidean, ν) # mean not provided
geometric_mean=mean(Fisher, ν)
geometric_sd=std(Fisher, ν, mean=geometric_mean) # mean provided