Struct rv::dist::Gaussian [−][src]
Gaussian / Normal distribution, N(μ, σ)
Examples
Compute the KL Divergence between two Gaussians.
use rv::prelude::*; let gauss_1 = Gaussian::new(0.1, 2.3).unwrap(); let gauss_2 = Gaussian::standard(); // KL is not symmetric let kl_12 = gauss_1.kl(&gauss_2); let kl_21 = gauss_2.kl(&gauss_1); // ... but kl_sym is because it's the sum of KL(P|Q) and KL(Q|P) let kl_sym = gauss_1.kl_sym(&gauss_2); assert!((kl_sym - (kl_12 + kl_21)).abs() < 1E-12);
Fields
mu: f64
Mean
sigma: f64
Standard deviation
Methods
impl Gaussian
[src]
impl Gaussian
Trait Implementations
impl Debug for Gaussian
[src]
impl Debug for Gaussian
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Clone for Gaussian
[src]
impl Clone for Gaussian
fn clone(&self) -> Gaussian
[src]
fn clone(&self) -> Gaussian
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Default for Gaussian
[src]
impl Default for Gaussian
impl Variance<f64> for Gaussian
[src]
impl Variance<f64> for Gaussian
impl Entropy for Gaussian
[src]
impl Entropy for Gaussian
impl Skewness for Gaussian
[src]
impl Skewness for Gaussian
impl Kurtosis for Gaussian
[src]
impl Kurtosis for Gaussian
impl KlDivergence for Gaussian
[src]
impl KlDivergence for Gaussian
fn kl(&self, other: &Self) -> f64
[src]
fn kl(&self, other: &Self) -> f64
The KL divergence, KL(P|Q) between this distribution, P, and another, Q Read more
fn kl_sym(&self, other: &Self) -> f64
[src]
fn kl_sym(&self, other: &Self) -> f64
Symmetrised divergence, KL(P|Q) + KL(Q|P) Read more
impl Rv<f32> for Gaussian
[src]
impl Rv<f32> for Gaussian
fn ln_f(&self, x: &f32) -> f64
[src]
fn ln_f(&self, x: &f32) -> f64
Un-normalized probability function Read more
fn ln_normalizer(&self) -> f64
[src]
fn ln_normalizer(&self) -> f64
The log of the constant term in the PDF/PMF. Should not be a function of any of the parameters. Read more
fn draw<R: Rng>(&self, rng: &mut R) -> f32
[src]
fn draw<R: Rng>(&self, rng: &mut R) -> f32
Single draw from the Rv
Read more
fn sample<R: Rng>(&self, n: usize, rng: &mut R) -> Vec<f32>
[src]
fn sample<R: Rng>(&self, n: usize, rng: &mut R) -> Vec<f32>
Multiple draws of the Rv
Read more
fn f(&self, x: &X) -> f64
[src]
fn f(&self, x: &X) -> f64
Un-normalized probability function Read more
fn normalizer(&self) -> f64
[src]
fn normalizer(&self) -> f64
The constant term in the PDF/PMF. Should not be a function of any of the parameters. Read more
impl ContinuousDistr<f32> for Gaussian
[src]
impl ContinuousDistr<f32> for Gaussian
fn pdf(&self, x: &X) -> f64
[src]
fn pdf(&self, x: &X) -> f64
The value of the Probability Density Function (PDF) at x
Read more
fn ln_pdf(&self, x: &X) -> f64
[src]
fn ln_pdf(&self, x: &X) -> f64
The value of the log Probability Density Function (PDF) at x
Read more
impl Support<f32> for Gaussian
[src]
impl Support<f32> for Gaussian
impl Cdf<f32> for Gaussian
[src]
impl Cdf<f32> for Gaussian
fn cdf(&self, x: &f32) -> f64
[src]
fn cdf(&self, x: &f32) -> f64
The value of the Cumulative Density Function at x
Read more
fn sf(&self, x: &X) -> f64
[src]
fn sf(&self, x: &X) -> f64
Survival function, 1 - CDF(x)
impl InverseCdf<f32> for Gaussian
[src]
impl InverseCdf<f32> for Gaussian
fn invcdf(&self, p: f64) -> f32
[src]
fn invcdf(&self, p: f64) -> f32
The value of the x
at the given probability in the CDF Read more
fn quantile(&self, p: f64) -> X
[src]
fn quantile(&self, p: f64) -> X
Alias for invcdf
fn interval(&self, p: f64) -> (X, X)
[src]
fn interval(&self, p: f64) -> (X, X)
Interval containing p
proportion for the probability Read more
impl Mean<f32> for Gaussian
[src]
impl Mean<f32> for Gaussian
impl Median<f32> for Gaussian
[src]
impl Median<f32> for Gaussian
impl Mode<f32> for Gaussian
[src]
impl Mode<f32> for Gaussian
impl HasSuffStat<f32> for Gaussian
[src]
impl HasSuffStat<f32> for Gaussian
type Stat = GaussianSuffStat
fn empty_suffstat(&self) -> Self::Stat
[src]
fn empty_suffstat(&self) -> Self::Stat
impl Rv<f64> for Gaussian
[src]
impl Rv<f64> for Gaussian
fn ln_f(&self, x: &f64) -> f64
[src]
fn ln_f(&self, x: &f64) -> f64
Un-normalized probability function Read more
fn ln_normalizer(&self) -> f64
[src]
fn ln_normalizer(&self) -> f64
The log of the constant term in the PDF/PMF. Should not be a function of any of the parameters. Read more
fn draw<R: Rng>(&self, rng: &mut R) -> f64
[src]
fn draw<R: Rng>(&self, rng: &mut R) -> f64
Single draw from the Rv
Read more
fn sample<R: Rng>(&self, n: usize, rng: &mut R) -> Vec<f64>
[src]
fn sample<R: Rng>(&self, n: usize, rng: &mut R) -> Vec<f64>
Multiple draws of the Rv
Read more
fn f(&self, x: &X) -> f64
[src]
fn f(&self, x: &X) -> f64
Un-normalized probability function Read more
fn normalizer(&self) -> f64
[src]
fn normalizer(&self) -> f64
The constant term in the PDF/PMF. Should not be a function of any of the parameters. Read more
impl ContinuousDistr<f64> for Gaussian
[src]
impl ContinuousDistr<f64> for Gaussian
fn pdf(&self, x: &X) -> f64
[src]
fn pdf(&self, x: &X) -> f64
The value of the Probability Density Function (PDF) at x
Read more
fn ln_pdf(&self, x: &X) -> f64
[src]
fn ln_pdf(&self, x: &X) -> f64
The value of the log Probability Density Function (PDF) at x
Read more
impl Support<f64> for Gaussian
[src]
impl Support<f64> for Gaussian
impl Cdf<f64> for Gaussian
[src]
impl Cdf<f64> for Gaussian
fn cdf(&self, x: &f64) -> f64
[src]
fn cdf(&self, x: &f64) -> f64
The value of the Cumulative Density Function at x
Read more
fn sf(&self, x: &X) -> f64
[src]
fn sf(&self, x: &X) -> f64
Survival function, 1 - CDF(x)
impl InverseCdf<f64> for Gaussian
[src]
impl InverseCdf<f64> for Gaussian
fn invcdf(&self, p: f64) -> f64
[src]
fn invcdf(&self, p: f64) -> f64
The value of the x
at the given probability in the CDF Read more
fn quantile(&self, p: f64) -> X
[src]
fn quantile(&self, p: f64) -> X
Alias for invcdf
fn interval(&self, p: f64) -> (X, X)
[src]
fn interval(&self, p: f64) -> (X, X)
Interval containing p
proportion for the probability Read more
impl Mean<f64> for Gaussian
[src]
impl Mean<f64> for Gaussian
impl Median<f64> for Gaussian
[src]
impl Median<f64> for Gaussian
impl Mode<f64> for Gaussian
[src]
impl Mode<f64> for Gaussian
impl HasSuffStat<f64> for Gaussian
[src]
impl HasSuffStat<f64> for Gaussian
type Stat = GaussianSuffStat
fn empty_suffstat(&self) -> Self::Stat
[src]
fn empty_suffstat(&self) -> Self::Stat
impl Rv<Gaussian> for NormalGamma
[src]
impl Rv<Gaussian> for NormalGamma
fn ln_f(&self, x: &Gaussian) -> f64
[src]
fn ln_f(&self, x: &Gaussian) -> f64
Un-normalized probability function Read more
fn ln_normalizer(&self) -> f64
[src]
fn ln_normalizer(&self) -> f64
The log of the constant term in the PDF/PMF. Should not be a function of any of the parameters. Read more
fn draw<R: Rng>(&self, rng: &mut R) -> Gaussian
[src]
fn draw<R: Rng>(&self, rng: &mut R) -> Gaussian
Single draw from the Rv
Read more
fn f(&self, x: &X) -> f64
[src]
fn f(&self, x: &X) -> f64
Un-normalized probability function Read more
fn normalizer(&self) -> f64
[src]
fn normalizer(&self) -> f64
The constant term in the PDF/PMF. Should not be a function of any of the parameters. Read more
fn sample<R: Rng>(&self, n: usize, rng: &mut R) -> Vec<X>
[src]
fn sample<R: Rng>(&self, n: usize, rng: &mut R) -> Vec<X>
Multiple draws of the Rv
Read more
impl Support<Gaussian> for NormalGamma
[src]
impl Support<Gaussian> for NormalGamma
fn contains(&self, x: &Gaussian) -> bool
[src]
fn contains(&self, x: &Gaussian) -> bool
Returns true
if x
is in the support of the Rv
Read more
impl ContinuousDistr<Gaussian> for NormalGamma
[src]
impl ContinuousDistr<Gaussian> for NormalGamma
fn pdf(&self, x: &X) -> f64
[src]
fn pdf(&self, x: &X) -> f64
The value of the Probability Density Function (PDF) at x
Read more
fn ln_pdf(&self, x: &X) -> f64
[src]
fn ln_pdf(&self, x: &X) -> f64
The value of the log Probability Density Function (PDF) at x
Read more
impl ConjugatePrior<f64, Gaussian> for NormalGamma
[src]
impl ConjugatePrior<f64, Gaussian> for NormalGamma
type Posterior = Self
fn posterior(&self, x: &DataOrSuffStat<f64, Gaussian>) -> Self
[src]
fn posterior(&self, x: &DataOrSuffStat<f64, Gaussian>) -> Self
Computes the posterior distribution from the data
fn ln_m(&self, x: &DataOrSuffStat<f64, Gaussian>) -> f64
[src]
fn ln_m(&self, x: &DataOrSuffStat<f64, Gaussian>) -> f64
Log marginal likelihood
fn ln_pp(&self, y: &f64, x: &DataOrSuffStat<f64, Gaussian>) -> f64
[src]
fn ln_pp(&self, y: &f64, x: &DataOrSuffStat<f64, Gaussian>) -> f64
Log posterior predictive of y given x
fn m(&self, x: &DataOrSuffStat<X, Fx>) -> f64
[src]
fn m(&self, x: &DataOrSuffStat<X, Fx>) -> f64
Marginal likelihood of x
fn pp(&self, y: &X, x: &DataOrSuffStat<X, Fx>) -> f64
[src]
fn pp(&self, y: &X, x: &DataOrSuffStat<X, Fx>) -> f64
Posterior Predictive distribution