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 field
  • labels: counted labels with label-count association

Implementations§

source§

impl<L: Label, S: Labels<Elem = L>> CountedTargets<L, S>

source

pub fn new(targets: S) -> Self

Trait Implementations§

source§

impl<L: Label, T: AsTargets<Elem = L>> AsTargets for CountedTargets<L, T>

§

type Elem = L

§

type Ix = <T as AsTargets>::Ix

source§

fn as_targets(&self) -> ArrayView<'_, Self::Elem, Self::Ix>

source§

impl<L: Label, T: AsTargetsMut<Elem = L>> AsTargetsMut for CountedTargets<L, T>

§

type Elem = L

§

type Ix = <T as AsTargetsMut>::Ix

source§

fn as_targets_mut(&mut self) -> ArrayViewMut<'_, Self::Elem, Self::Ix>

source§

impl<L: Clone + Label, P: Clone> Clone for CountedTargets<L, P>

source§

fn clone(&self) -> CountedTargets<L, P>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<L: Debug + Label, P: Debug> Debug for CountedTargets<L, P>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a, L: Label + 'a, T> FromTargetArray<'a> for CountedTargets<L, T>
where T: FromTargetArray<'a, Elem = L>, T::Owned: Labels<Elem = L>, T::View: Labels<Elem = L>,

§

type Owned = CountedTargets<L, <T as FromTargetArray<'a>>::Owned>

§

type View = CountedTargets<L, <T as FromTargetArray<'a>>::View>

source§

fn new_targets(targets: Array<L, T::Ix>) -> Self::Owned

Create self object from new target array
source§

fn new_targets_view(targets: ArrayView<'a, L, T::Ix>) -> Self::View

source§

impl<L: Label, T: AsTargets<Elem = L>> Labels for CountedTargets<L, T>

Counted labels can act as labels

§

type Elem = L

source§

fn label_count(&self) -> Vec<HashMap<L, usize>>

source§

fn label_set(&self) -> Vec<HashSet<Self::Elem>>

source§

fn labels(&self) -> Vec<Self::Elem>

source§

impl<L: PartialEq + Label, P: PartialEq> PartialEq for CountedTargets<L, P>

source§

fn eq(&self, other: &CountedTargets<L, P>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<L: Eq + Label, P: Eq> Eq for CountedTargets<L, P>

source§

impl<L: Label, P> StructuralEq for CountedTargets<L, P>

source§

impl<L: Label, P> StructuralPartialEq for CountedTargets<L, P>

Auto Trait Implementations§

§

impl<L, P> RefUnwindSafe for CountedTargets<L, P>

§

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§

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> AsMultiTargets for T
where T: AsTargets<Ix = Dim<[usize; 2]>>,

source§

fn as_multi_targets(&self) -> ArrayView2<'_, Self::Elem>

source§

impl<T> AsMultiTargetsMut for T
where T: AsTargetsMut<Ix = Dim<[usize; 2]>>,

source§

fn as_multi_targets_mut(&mut self) -> ArrayViewMut2<'_, Self::Elem>

source§

impl<T> AsSingleTargets for T
where T: AsTargets<Ix = Dim<[usize; 1]>>,

source§

fn as_single_targets(&self) -> ArrayView1<'_, Self::Elem>

source§

impl<T> AsSingleTargetsMut for T
where T: AsTargetsMut<Ix = Dim<[usize; 1]>>,

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<L, S, T> ToConfusionMatrix<L, &ArrayBase<S, Dim<[usize; 1]>>> for T
where L: Label, S: Data<Elem = L>, T: AsSingleTargets<Elem = L> + Labels<Elem = L>,

source§

fn confusion_matrix( &self, ground_truth: &ArrayBase<S, Dim<[usize; 1]>> ) -> Result<ConfusionMatrix<L>, Error>

source§

impl<L, S, T> ToConfusionMatrix<L, ArrayBase<S, Dim<[usize; 1]>>> for T
where L: Label, S: Data<Elem = L>, T: AsSingleTargets<Elem = L> + Labels<Elem = L>,

source§

fn confusion_matrix( &self, ground_truth: ArrayBase<S, Dim<[usize; 1]>> ) -> Result<ConfusionMatrix<L>, Error>

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V