Computing Deviations
This package provides functions to compute various deviations between arrays in a variety of ways:
StatsBase.counteq
— Functioncounteq(a, b)
Count the number of indices at which the elements of the arrays a
and b
are equal.
StatsBase.countne
— Functioncountne(a, b)
Count the number of indices at which the elements of the arrays a
and b
are not equal.
StatsBase.sqL2dist
— FunctionsqL2dist(a, b)
Compute the squared L2 distance between two arrays: $\sum_{i=1}^n |a_i - b_i|^2$. Efficient equivalent of sum(abs2, a - b)
.
StatsBase.L2dist
— FunctionL2dist(a, b)
Compute the L2 distance between two arrays: $\sqrt{\sum_{i=1}^n |a_i - b_i|^2}$. Efficient equivalent of sqrt(sum(abs2, a - b))
.
StatsBase.L1dist
— FunctionL1dist(a, b)
Compute the L1 distance between two arrays: $\sum_{i=1}^n |a_i - b_i|$. Efficient equivalent of sum(abs, a - b)
.
StatsBase.Linfdist
— FunctionLinfdist(a, b)
Compute the L∞ distance, also called the Chebyshev distance, between two arrays: $\max_{i\in1:n} |a_i - b_i|$. Efficient equivalent of maxabs(a - b)
.
StatsBase.gkldiv
— Functiongkldiv(a, b)
Compute the generalized Kullback-Leibler divergence between two arrays: $\sum_{i=1}^n (a_i \log(a_i/b_i) - a_i + b_i)$. Efficient equivalent of sum(a*log(a/b)-a+b)
.
StatsBase.meanad
— Functionmeanad(a, b)
Return the mean absolute deviation between two arrays: mean(abs, a - b)
.
StatsBase.maxad
— Functionmaxad(a, b)
Return the maximum absolute deviation between two arrays: maxabs(a - b)
.
StatsBase.msd
— Functionmsd(a, b)
Return the mean squared deviation between two arrays: mean(abs2, a - b)
.
StatsBase.rmsd
— Functionrmsd(a, b; normalize=false)
Return the root mean squared deviation between two optionally normalized arrays. The root mean squared deviation is computed as sqrt(msd(a, b))
.
StatsBase.psnr
— Functionpsnr(a, b, maxv)
Compute the peak signal-to-noise ratio between two arrays a
and b
. maxv
is the maximum possible value either array can take. The PSNR is computed as 10 * log10(maxv^2 / msd(a, b))
.
All these functions are implemented in a reasonably efficient way without creating any temporary arrays in the middle.