Struct probability::distribution::Categorical
[−]
[src]
pub struct Categorical { // some fields omitted }
A categorical distribution.
Methods
impl Categorical
[src]
fn new(p: &[f64]) -> Categorical
Create a categorical distribution with success probability p
.
It should hold that p[i] >= 0
, p[i] <= 1
, and sum(p) == 1
.
fn k(&self) -> usize
Return the number of categories.
fn p(&self) -> &[f64]
Return the event probabilities.
Trait Implementations
impl Clone for Categorical
[src]
fn clone(&self) -> Categorical
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 Distribution for Categorical
[src]
type Value = usize
The type of outcomes.
fn cdf(&self, x: f64) -> f64
Compute the distribution function. Read more