Struct probability::distribution::Categorical [−][src]
pub struct Categorical { /* fields omitted */ }
A categorical distribution.
Methods
impl Categorical
[src]
impl Categorical
pub fn new(p: &[f64]) -> Self
[src]
pub fn new(p: &[f64]) -> Self
Create a categorical distribution with success probability p
.
It should hold that p[i] >= 0
, p[i] <= 1
, and sum(p) == 1
.
pub fn k(&self) -> usize
[src]
pub fn k(&self) -> usize
Return the number of categories.
pub fn p(&self) -> &[f64]
[src]
pub fn p(&self) -> &[f64]
Return the event probabilities.
Trait Implementations
impl Clone for Categorical
[src]
impl Clone for Categorical
fn clone(&self) -> Categorical
[src]
fn clone(&self) -> Categorical
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 Debug for Categorical
[src]
impl Debug for Categorical
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 Discrete for Categorical
[src]
impl Discrete for Categorical
impl Distribution for Categorical
[src]
impl Distribution for Categorical
type Value = usize
The type of outcomes.
fn distribution(&self, x: f64) -> f64
[src]
fn distribution(&self, x: f64) -> f64
Compute the cumulative distribution function.
impl Entropy for Categorical
[src]
impl Entropy for Categorical
impl Inverse for Categorical
[src]
impl Inverse for Categorical
impl Kurtosis for Categorical
[src]
impl Kurtosis for Categorical
impl Mean for Categorical
[src]
impl Mean for Categorical
impl Median for Categorical
[src]
impl Median for Categorical
impl Modes for Categorical
[src]
impl Modes for Categorical
impl Sample for Categorical
[src]
impl Sample for Categorical
impl Skewness for Categorical
[src]
impl Skewness for Categorical
impl Variance for Categorical
[src]
impl Variance for Categorical
Auto Trait Implementations
impl Send for Categorical
impl Send for Categorical
impl Sync for Categorical
impl Sync for Categorical