pub struct DatasetPlan { /* private fields */ }Expand description
Immutable training-data plan. Cheap to clone (TidyView holds
Rc<DataFrame>).
Implementations§
Source§impl DatasetPlan
impl DatasetPlan
pub fn from_view(source: TidyView) -> Self
pub fn from_dataframe(df: DataFrame) -> Self
pub fn with_features(self, cols: Vec<String>) -> Self
pub fn with_label(self, col: String) -> Self
pub fn with_encoding(self, col: String, enc: EncodingSpec) -> Self
pub fn with_split(self, split: SplitSpec) -> Self
pub fn with_batch(self, batch: BatchSpec) -> Self
pub fn nrows(&self) -> usize
pub fn n_features(&self) -> usize
pub fn feature_cols(&self) -> &[String]
pub fn label_col(&self) -> Option<&str>
pub fn split_spec(&self) -> &SplitSpec
pub fn batch_spec(&self) -> &BatchSpec
pub fn plan_hash(&self) -> Option<&[u8; 32]>
Sourcepub fn validate(&self) -> Result<(), DatasetError>
pub fn validate(&self) -> Result<(), DatasetError>
Validate the plan against the source schema. Cheap; no
materialization. Called automatically by iter_batches and
split_rows; useful in tests / dry-runs.
Sourcepub fn split_rows(&self, which: Split) -> Result<Vec<u32>, DatasetError>
pub fn split_rows(&self, which: Split) -> Result<Vec<u32>, DatasetError>
Ascending row IDs assigned to which. Row IDs are indices into the
materialized source (post-filter, post-select), not the raw
underlying DataFrame.
Sourcepub fn iter_batches(&self, which: Split) -> Result<BatchIterator, DatasetError>
pub fn iter_batches(&self, which: Split) -> Result<BatchIterator, DatasetError>
Iterate batches over which split. Each batch is fully resolved
into row-major Tensors. Categorical dictionaries are built over
the entire materialized source (so val/test see codes consistent
with train) and frozen before iteration begins.
Trait Implementations§
Source§impl Clone for DatasetPlan
impl Clone for DatasetPlan
Source§fn clone(&self) -> DatasetPlan
fn clone(&self) -> DatasetPlan
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DatasetPlan
impl RefUnwindSafe for DatasetPlan
impl !Send for DatasetPlan
impl !Sync for DatasetPlan
impl Unpin for DatasetPlan
impl UnsafeUnpin for DatasetPlan
impl UnwindSafe for DatasetPlan
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