pub struct Dataset {
pub data: Arc<Vec<MaskedSample>>,
pub weights: Vec<f64>,
}Expand description
Represents a dataset. This is a wrapper over a 2D array of dimensions
(n_samples, n_features).
§Note
All arrays involved have to be of data type float64.
Fields§
§data: Arc<Vec<MaskedSample>>The data rows of this dataset.
weights: Vec<f64>The weights associated with each sample. Use this only if you are using the PPCA as a component of a greater EM scheme (or otherwise know what you are doing). Else, let the package set it automatically to 1.
Implementations§
Source§impl Dataset
impl Dataset
Sourcepub fn new(data: Vec<MaskedSample>) -> Dataset
pub fn new(data: Vec<MaskedSample>) -> Dataset
Creates a new dataset from a set of masked samples.
Sourcepub fn new_with_weights(data: Vec<MaskedSample>, weights: Vec<f64>) -> Dataset
pub fn new_with_weights(data: Vec<MaskedSample>, weights: Vec<f64>) -> Dataset
Creates a new dataset from a set of weighted masked samples.
Sourcepub fn with_weights(&self, weights: Vec<f64>) -> Dataset
pub fn with_weights(&self, weights: Vec<f64>) -> Dataset
Creates a new dataset with the same sample, but with different weights. This operation is
cheap, since it does not clone the dataset (it’s protected by an Arc).
Sourcepub fn output_size(&self) -> Option<usize>
pub fn output_size(&self) -> Option<usize>
The number of dimensions in each sample. Returns None if dataset is empty.
Sourcepub fn empty_dimensions(&self) -> Vec<usize>
pub fn empty_dimensions(&self) -> Vec<usize>
Lists the dimensions which as masked in all samples in this dataset.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Dataset
impl<'de> Deserialize<'de> for Dataset
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<Vec<MaskedSample>> for Dataset
impl From<Vec<MaskedSample>> for Dataset
Source§fn from(value: Vec<MaskedSample>) -> Self
fn from(value: Vec<MaskedSample>) -> Self
Source§impl FromIterator<(MaskedSample, f64)> for Dataset
impl FromIterator<(MaskedSample, f64)> for Dataset
Source§impl FromIterator<MaskedSample> for Dataset
impl FromIterator<MaskedSample> for Dataset
Source§fn from_iter<T>(iter: T) -> Selfwhere
T: IntoIterator<Item = MaskedSample>,
fn from_iter<T>(iter: T) -> Selfwhere
T: IntoIterator<Item = MaskedSample>,
Source§impl FromParallelIterator<(MaskedSample, f64)> for Dataset
impl FromParallelIterator<(MaskedSample, f64)> for Dataset
Source§fn from_par_iter<T>(iter: T) -> Self
fn from_par_iter<T>(iter: T) -> Self
par_iter. Read moreSource§impl FromParallelIterator<MaskedSample> for Dataset
impl FromParallelIterator<MaskedSample> for Dataset
Source§fn from_par_iter<T>(iter: T) -> Selfwhere
T: IntoParallelIterator<Item = MaskedSample>,
fn from_par_iter<T>(iter: T) -> Selfwhere
T: IntoParallelIterator<Item = MaskedSample>,
par_iter. Read moreAuto Trait Implementations§
impl Freeze for Dataset
impl RefUnwindSafe for Dataset
impl Send for Dataset
impl Sync for Dataset
impl Unpin for Dataset
impl UnwindSafe for Dataset
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
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>
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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.