Skip to main content

CategoricalHash

Struct CategoricalHash 

Source
pub struct CategoricalHash<T: Hash + Eq, P>(/* private fields */);
Expand description

A Categorical that performs deduplication using a Hashtable

Trait Implementations§

Source§

impl<T, P> Categorical<T, P> for CategoricalHash<T, P>
where T: Eq + Hash, P: NumAssignRef + NumRef + Clone,

Source§

fn iter<'a>(&'a self) -> impl 'a + Iterator<Item = (&'a T, &'a P)>
where T: 'a, P: 'a,

Source§

fn probabilities_mut<'a>(&'a mut self) -> impl 'a + Iterator<Item = &'a mut P>
where T: 'a, P: 'a,

Source§

fn probability_of(&self, x: &T) -> P

Returns the probability of some category.
Source§

fn new_uniform(it: impl Iterator<Item = T>) -> Self

Construct a Categorical with same probability for each category.
Source§

fn normalize_in_place(&mut self) -> &mut Self

Rescale probabilities such that they sum up to 1. Read more
Source§

fn combined<T1, C1, T2, C2, F>(c1: &C1, other: &C2, f: F) -> Self
where C1: Categorical<T1, P>, C2: Categorical<T2, P>, F: FnMut(&T1, &T2) -> T,

Combine with a different Categorical using a function that combines pairs of categories. Read more
Source§

impl<T: Hash + Eq, P: NumAssignRef + NumRef + Clone> FromIterator<(T, P)> for CategoricalHash<T, P>

Source§

fn from_iter<I: IntoIterator<Item = (T, P)>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<T: Hash + Eq, P> IntoIterator for CategoricalHash<T, P>

Source§

type Item = (T, P)

The type of the elements being iterated over.
Source§

type IntoIter = <HashMap<T, P> as IntoIterator>::IntoIter

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl<T, P> Freeze for CategoricalHash<T, P>

§

impl<T, P> RefUnwindSafe for CategoricalHash<T, P>

§

impl<T, P> Send for CategoricalHash<T, P>
where T: Send, P: Send,

§

impl<T, P> Sync for CategoricalHash<T, P>
where T: Sync, P: Sync,

§

impl<T, P> Unpin for CategoricalHash<T, P>
where T: Unpin, P: Unpin,

§

impl<T, P> UnsafeUnpin for CategoricalHash<T, P>

§

impl<T, P> UnwindSafe for CategoricalHash<T, P>
where T: UnwindSafe, P: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.