Trait statrs::statistics::Entropy [−][src]
The Entropy
trait specifies an object that has a closed form solution
for its entropy
Required methods
fn entropy(&self) -> T
[src]
Returns the entropy. May panic depending on the implementor.
Examples
use statrs::statistics::Entropy; use statrs::distribution::Uniform; let n = Uniform::new(0.0, 1.0).unwrap(); assert_eq!(0.0, n.entropy());
Implementors
impl Entropy<f64> for Bernoulli
[src]
impl Entropy<f64> for Beta
[src]
fn entropy(&self) -> f64
[src]
Returns the entropy of the beta distribution
Formula
ln(B(α, β)) - (α - 1)ψ(α) - (β - 1)ψ(β) + (α + β - 2)ψ(α + β)
where α
is shapeA, β
is shapeB and ψ
is the digamma function
impl Entropy<f64> for Binomial
[src]
fn entropy(&self) -> f64
[src]
Returns the entropy of the binomial distribution
Formula
(1 / 2) * ln (2 * π * e * n * p * (1 - p))
impl Entropy<f64> for Categorical
[src]
fn entropy(&self) -> f64
[src]
Returns the entropy of the categorical distribution
Formula
-Σ(p_j * ln(p_j))
where p_j
is the j
th probability mass,
Σ
is the sum from 0
to k - 1
,
and k
is the number of categories
impl Entropy<f64> for Cauchy
[src]
impl Entropy<f64> for Chi
[src]
impl Entropy<f64> for ChiSquared
[src]
fn entropy(&self) -> f64
[src]
Returns the entropy of the chi-squared distribution
Formula
(k / 2) + ln(2 * Γ(k / 2)) + (1 - (k / 2)) * ψ(k / 2)
where k
is the degrees of freedom, Γ
is the gamma function,
and ψ
is the digamma function
impl Entropy<f64> for Dirichlet
[src]
fn entropy(&self) -> f64
[src]
Returns the entropy of the dirichlet distribution
Formula
ln(B(α)) - (K - α_0)ψ(α_0) - Σ((α_i - 1)ψ(α_i))
where
B(α) = Π(Γ(α_i)) / Γ(Σ(α_i))
α_0
is the sum of all concentration parameters,
K
is the number of concentration parameters, ψ
is the digamma
function, α_i
is the i
th concentration parameter, and Σ
is the sum from 1
to K
impl Entropy<f64> for DiscreteUniform
[src]
impl Entropy<f64> for Erlang
[src]
fn entropy(&self) -> f64
[src]
Returns the entropy of the erlang distribution
Formula
k - ln(λ) + ln(Γ(k)) + (1 - k) * ψ(k)
where k
is the shape, λ
is the rate, Γ
is the gamma function,
and ψ
is the digamma function
impl Entropy<f64> for Exponential
[src]
impl Entropy<f64> for Gamma
[src]
fn entropy(&self) -> f64
[src]
Returns the entropy of the gamma distribution
Formula
α - ln(β) + ln(Γ(α)) + (1 - α) * ψ(α)
where α
is the shape, β
is the rate, Γ
is the gamma function,
and ψ
is the digamma function
impl Entropy<f64> for Geometric
[src]
fn entropy(&self) -> f64
[src]
Returns the entropy of the geometric distribution
Formula
(-(1 - p) * log_2(1 - p) - p * log_2(p)) / p
impl Entropy<f64> for InverseGamma
[src]
fn entropy(&self) -> f64
[src]
Returns the entropy of the inverse gamma distribution
Formula
α + ln(β * Γ(α)) - (1 + α) * ψ(α)
where α
is the shape, β
is the rate, Γ
is the gamma function,
and ψ
is the digamma function
impl Entropy<f64> for LogNormal
[src]
fn entropy(&self) -> f64
[src]
Returns the entropy of the log-normal distribution
Formula
ln(σe^(μ + 1 / 2) * sqrt(2π))
where μ
is the location and σ
is the scale
impl Entropy<f64> for Normal
[src]
fn entropy(&self) -> f64
[src]
Returns the entropy of the normal distribution
Formula
(1 / 2) * ln(2σ^2 * π * e)
where σ
is the standard deviation
impl Entropy<f64> for Pareto
[src]
fn entropy(&self) -> f64
[src]
Returns the entropy for the Pareto distribution
Formula
ln(α/x_m) - 1/α - 1
where x_m
is the scale and α
is the shape
impl Entropy<f64> for Poisson
[src]
fn entropy(&self) -> f64
[src]
Returns the entropy of the poisson distribution
Formula
(1 / 2) * ln(2πeλ) - 1 / (12λ) - 1 / (24λ^2) - 19 / (360λ^3)
where λ
is the rate