Struct rusty_machine::stats::dist::exponential::Exponential
[−]
[src]
pub struct Exponential { /* fields omitted */ }
An Exponential random variable.
Methods
impl Exponential
[src]
fn new(lambda: f64) -> Exponential
Constructs a new Exponential random variable with given lambda parameter.
fn lambda(&self) -> f64
Returns the lambda parameter.
Trait Implementations
impl Debug for Exponential
[src]
impl Clone for Exponential
[src]
fn clone(&self) -> Exponential
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Copy for Exponential
[src]
impl Default for Exponential
[src]
The default Exponential random variable.
The defaults are:
- lambda = 1
fn default() -> Exponential
Returns the "default value" for a type. Read more
impl Distribution<f64> for Exponential
[src]
fn pdf(&self, x: f64) -> f64
The pdf of the exponential distribution.
Examples
use rusty_machine::stats::dist::Exponential; use rusty_machine::stats::dist::Distribution; // Construct an exponential with lambda parameter 7.0. let exp = Exponential::new(7f64); let pdf_zero = exp.pdf(0f64); assert!((pdf_zero - exp.lambda()).abs() < 1e-20);
fn logpdf(&self, x: f64) -> f64
The log pdf of the exponential distribution.
Examples
// Construct an exponential with lambda parameter 5.0. use rusty_machine::stats::dist::Exponential; use rusty_machine::stats::dist::Distribution; // Construct an exponential with lambda parameter 5.0. let exp = Exponential::new(5f64); let log_pdf = exp.logpdf(3f64); assert!((log_pdf - exp.lambda().ln() + exp.lambda() * 3f64).abs() < 1e-20);
fn cdf(&self, x: f64) -> f64
The cdf of the exponential distribution.
Examples
use rusty_machine::stats::dist::Exponential; use rusty_machine::stats::dist::Distribution; // Construct an exponential with lambda parameter 5.0. let exp = Exponential::new(5f64); let cdf_zero = exp.cdf(0f64); assert!((cdf_zero).abs() < 1e-20);
impl Sample<f64> for Exponential
[src]
fn sample<R: Rng>(&mut self, rng: &mut R) -> f64
Generate a random value of Support
, using rng
as the source of randomness. Read more
impl IndependentSample<f64> for Exponential
[src]
fn ind_sample<R: Rng>(&self, rng: &mut R) -> f64
Generate a random value.