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, Global>> for Dataset
impl From<Vec<MaskedSample, Global>> 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§fn from_iter<T>(iter: T) -> Selfwhere
T: IntoIterator<Item = (MaskedSample, f64)>,
fn from_iter<T>(iter: T) -> Selfwhere
T: IntoIterator<Item = (MaskedSample, f64)>,
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) -> Selfwhere
T: IntoParallelIterator<Item = (MaskedSample, f64)>,
fn from_par_iter<T>(iter: T) -> Selfwhere
T: IntoParallelIterator<Item = (MaskedSample, f64)>,
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 RefUnwindSafe for Dataset
impl Send for Dataset
impl Sync for Dataset
impl Unpin for Dataset
impl UnwindSafe for Dataset
Blanket Implementations§
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§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).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.