Struct rv::dist::Crp [−][src]
Chinese Restaurant Process
Example
extern crate rand; use::rv::prelude::*; let mut rng = rand::thread_rng(); let crp = Crp::new(1.0, 10).expect("Invalid parameters"); let partition = crp.draw(&mut rng); assert_eq!(partition.len(), 10);
Fields
alpha: f64
Discount parameter
n: usize
number of items in the partition
Methods
impl Crp
[src]
impl Crp
Trait Implementations
impl Debug for Crp
[src]
impl Debug for Crp
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 Crp
[src]
impl Clone for Crp
fn clone(&self) -> Crp
[src]
fn clone(&self) -> Crp
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)
1.0.0
[src]Performs copy-assignment from source
. Read more
impl Rv<Partition> for Crp
[src]
impl Rv<Partition> for Crp
fn ln_f(&self, x: &Partition) -> f64
[src]
fn ln_f(&self, x: &Partition) -> 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) -> Partition
[src]
fn draw<R: Rng>(&self, rng: &mut R) -> Partition
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<Partition> for Crp
[src]
impl Support<Partition> for Crp