pub struct DatasetView<'a> { /* private fields */ }Expand description
A subset of a dataset’s rows, borrowed rather than copied.
Holds only row numbers into the dataset, so a view costs eight bytes per row however wide the rows are, and shuffling it reorders those numbers without touching the dataset.
Implementations§
Source§impl<'a> DatasetView<'a>
impl<'a> DatasetView<'a>
Sourcepub fn new(dataset: &'a Dataset, rows: Vec<usize>) -> Result<Self>
pub fn new(dataset: &'a Dataset, rows: Vec<usize>) -> Result<Self>
A view of the given rows of a dataset.
§Errors
Returns an error if the dataset’s labels don’t match its rows, or a row number is out of range.
Sourcepub fn class_counts(&self) -> (usize, usize)
pub fn class_counts(&self) -> (usize, usize)
Count the (benign, malicious) rows in the view.
Trait Implementations§
Source§impl<'a> Clone for DatasetView<'a>
impl<'a> Clone for DatasetView<'a>
Source§impl<'a> Debug for DatasetView<'a>
impl<'a> Debug for DatasetView<'a>
Source§impl TrainingData for DatasetView<'_>
impl TrainingData for DatasetView<'_>
Source§fn has_labels(&self) -> bool
fn has_labels(&self) -> bool
Whether every row has a label.
Source§fn labelled_rows(&self) -> impl Iterator<Item = (RowSlice<'_>, u8)> + '_
fn labelled_rows(&self) -> impl Iterator<Item = (RowSlice<'_>, u8)> + '_
Each row with its label, in the current order.
Source§fn column_sums(&self) -> Vec<f32>
fn column_sums(&self) -> Vec<f32>
Sum each feature column across every row.
Source§fn validate(&self) -> bool
fn validate(&self) -> bool
Whether the rows and features are consistent, see
Dataset::validate.Auto Trait Implementations§
impl<'a> Freeze for DatasetView<'a>
impl<'a> RefUnwindSafe for DatasetView<'a>
impl<'a> Send for DatasetView<'a>
impl<'a> Sync for DatasetView<'a>
impl<'a> Unpin for DatasetView<'a>
impl<'a> UnsafeUnpin for DatasetView<'a>
impl<'a> UnwindSafe for DatasetView<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more