Struct linfa::dataset::CountedTargets
source · [−]pub struct CountedTargets<L: Label, P> { /* private fields */ }
Expand description
Targets with precomputed, counted labels
This extends plain targets with pre-counted labels. The label map is useful when, for example, a prior probability is estimated (e.g. in Naive Bayesian implementation) or the samples are weighted inverse to their occurence.
Fields
targets
: wrapped target fieldlabels
: counted labels with label-count association
Implementations
Trait Implementations
sourceimpl<L: Label, T: AsTargets<Elem = L>> AsTargets for CountedTargets<L, T>
impl<L: Label, T: AsTargets<Elem = L>> AsTargets for CountedTargets<L, T>
type Elem = L
sourcefn as_multi_targets(&self) -> ArrayView2<'_, L>
fn as_multi_targets(&self) -> ArrayView2<'_, L>
Returns a view on targets as two-dimensional array
sourcefn try_single_target(&self) -> Result<ArrayView1<'_, Self::Elem>>
fn try_single_target(&self) -> Result<ArrayView1<'_, Self::Elem>>
Convert to single target, fails for more than one target Read more
sourceimpl<L: Label, T: AsTargetsMut<Elem = L>> AsTargetsMut for CountedTargets<L, T>
impl<L: Label, T: AsTargetsMut<Elem = L>> AsTargetsMut for CountedTargets<L, T>
type Elem = L
sourcefn as_multi_targets_mut(&mut self) -> ArrayViewMut2<'_, Self::Elem>
fn as_multi_targets_mut(&mut self) -> ArrayViewMut2<'_, Self::Elem>
Returns a mutable view on targets as two-dimensional array
sourcefn try_single_target_mut(&mut self) -> Result<ArrayViewMut1<'_, Self::Elem>>
fn try_single_target_mut(&mut self) -> Result<ArrayViewMut1<'_, Self::Elem>>
Convert to single target, fails for more than one target
sourceimpl<'a, L: Label + 'a, T> FromTargetArray<'a, L> for CountedTargets<L, T> where
T: AsTargets<Elem = L> + FromTargetArray<'a, L>,
T::Owned: Labels<Elem = L>,
T::View: Labels<Elem = L>,
impl<'a, L: Label + 'a, T> FromTargetArray<'a, L> for CountedTargets<L, T> where
T: AsTargets<Elem = L> + FromTargetArray<'a, L>,
T::Owned: Labels<Elem = L>,
T::View: Labels<Elem = L>,
type Owned = CountedTargets<L, T::Owned>
type View = CountedTargets<L, T::View>
sourcefn new_targets(targets: Array2<L>) -> Self::Owned
fn new_targets(targets: Array2<L>) -> Self::Owned
Create self object from new target array
fn new_targets_view(targets: ArrayView2<'a, L>) -> Self::View
Auto Trait Implementations
impl<L, P> RefUnwindSafe for CountedTargets<L, P> where
L: RefUnwindSafe,
P: RefUnwindSafe,
impl<L, P> Send for CountedTargets<L, P> where
L: Send,
P: Send,
impl<L, P> Sync for CountedTargets<L, P> where
L: Sync,
P: Sync,
impl<L, P> Unpin for CountedTargets<L, P> where
L: Unpin,
P: Unpin,
impl<L, P> UnwindSafe for CountedTargets<L, P> where
L: UnwindSafe,
P: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more