Skip to main content

Dataset

Struct Dataset 

Source
pub struct Dataset { /* private fields */ }
Expand description

Lazy event dataset combining a source, read plan, and row transformations.

Implementations§

Source§

impl Dataset

Source

pub fn new<S>(source: S) -> Self
where S: EventSource + 'static,

Creates a dataset from an event source.

Source

pub fn from_arc(source: Arc<dyn EventSource>) -> Self

Creates a dataset from a shared dynamically dispatched source.

Source

pub fn from_batch(batch: EventBatch) -> Self

Creates an in-memory dataset from one batch.

Source

pub fn from_batches(batches: Vec<EventBatch>) -> LadduDataResult<Self>

Creates an in-memory dataset from schema-compatible batches.

§Errors

Returns LadduDataError when batch schemas are incompatible.

Source

pub fn from_events<I>(schema: Arc<Schema>, events: I) -> LadduDataResult<Self>
where I: IntoIterator<Item = OwnedEvent>,

Collects owned events into an in-memory dataset.

§Errors

Returns LadduDataError when an event does not match schema.

Source

pub fn schema(&self) -> LadduDataResult<Arc<Schema>>

Returns the source schema.

§Errors

Returns LadduDataError when the underlying source cannot determine or load its schema.

Source

pub fn capabilities(&self) -> SourceCapabilities

Returns source planning capabilities.

Source

pub fn num_events(&self) -> LadduDataResult<Option<u64>>

Returns the source event count when cheaply available.

§Errors

Returns an error when source metadata cannot be read.

Source

pub fn stats(&self) -> LadduDataResult<DatasetStats>

Returns cached event-count and weight-sum statistics, computing them once if needed.

Clones of a dataset view share this cache. Failed traversals are not cached and may be retried.

§Errors

Returns LadduDataError when reading or transforming the dataset fails.

Source

pub fn read_plan(&self) -> ReadPlan

Returns the current read plan.

Source

pub fn cache_storage(&self) -> CacheStorage

Returns the compiled-cache memory policy.

Source

pub fn memory_policy(&self) -> MemoryPolicy

Returns the memory-first cache selection policy.

Source

pub fn memory_budget(&self) -> MemoryBudget

Returns the dataset’s host-memory budget.

Source

pub fn last_memory_decision(&self) -> Option<MemoryDecision>

Returns the most recent memory-derived read decision.

Source

pub fn source_traversals(&self) -> u64

Returns the number of transformed source iterators opened by this dataset view.

Source

pub fn with_memory_budget(self, budget: MemoryBudget) -> Self

Returns this dataset with a host-memory budget.

Source

pub fn fastest(self) -> Self

Select the fastest strategy allowed by the active memory budget.

Source

pub fn resident(self) -> Self

Retain compiled event-dependent values for every local event.

This strict policy is intended for repeatedly evaluating a likelihood and returns an error if the resident cache cannot fit. Dataset::fastest is the default.

Source

pub fn streaming(self) -> Self

Re-read the source and rebuild one batch cache during each parameter evaluation.

Only fixed dataset statistics are retained. This minimizes memory use but requires a repeatable source and is expected to be slower than Dataset::resident.

Source

pub fn chunked(self, chunk_size: usize) -> LadduDataResult<Self>

Returns this dataset with a low-level nonzero maximum event count.

Prefer Dataset::with_memory_budget for portable application code. This explicit read-plan override remains available for source debugging and reproducibility and is always capped by execution memory planning.

§Errors

Returns LadduDataError::InvalidArgument when chunk_size is zero.

Source

pub fn unchunked(self) -> Self

Returns this dataset with source-native batch sizes.

Source

pub fn filter<F>(self, f: F) -> Self
where F: Fn(Event<'_>) -> bool + Send + Sync + 'static,

Lazily retains events satisfying f.

Source

pub fn subsample(self, fraction: f64, seed: u64) -> LadduDataResult<Self>

Lazily retains a deterministic fraction of events.

§Errors

Returns LadduDataError::InvalidArgument when fraction is outside [0, 1] or is NaN.

Source

pub fn bootstrap(self, seed: u64) -> Self

Applies deterministic Poisson bootstrap multiplicities to event weights.

Source

pub fn for_each_event<F>(&self, f: F) -> LadduDataResult<()>
where F: FnMut(Event<'_>),

Visits each transformed event.

§Errors

Returns LadduDataError when reading or transforming the source fails.

Source

pub fn try_for_each_event<F>(&self, f: F) -> LadduDataResult<()>
where F: FnMut(Event<'_>) -> LadduDataResult<()>,

Visits each transformed event and stops at the first error.

§Errors

Returns the first LadduDataError produced by the source, transformations, or callback.

Source

pub fn try_map_events<T, F>(&self, f: F) -> LadduDataResult<Vec<T>>
where F: FnMut(Event<'_>) -> LadduDataResult<T>,

Fallibly maps transformed events into a vector.

§Errors

Returns the first LadduDataError produced while reading, transforming, or mapping an event.

Source

pub fn map_events<T, F>(&self, f: F) -> LadduDataResult<Vec<T>>
where F: FnMut(Event<'_>) -> T,

Maps transformed events into a vector.

§Errors

Returns LadduDataError when reading or transforming the source fails.

Source

pub fn try_fold_events<T, F>(&self, init: T, f: F) -> LadduDataResult<T>
where F: FnMut(T, Event<'_>) -> LadduDataResult<T>,

Fallibly folds transformed events into an owned accumulator.

§Errors

Returns the first LadduDataError produced while reading, transforming, or folding an event.

Source

pub fn fold_events<T, F>(&self, init: T, f: F) -> LadduDataResult<T>
where F: FnMut(T, Event<'_>) -> T,

Folds transformed events into an owned accumulator.

§Errors

Returns LadduDataError when reading or transforming the source fails.

Source

pub fn try_accumulate_events<T, F>(&self, acc: T, f: F) -> LadduDataResult<T>
where F: FnMut(&mut T, Event<'_>) -> LadduDataResult<()>,

Fallibly updates a mutable accumulator for every transformed event.

§Errors

Returns the first LadduDataError produced while reading, transforming, or accumulating an event.

Source

pub fn accumulate_events<T, F>(&self, acc: T, f: F) -> LadduDataResult<T>
where F: FnMut(&mut T, Event<'_>),

Updates a mutable accumulator for every transformed event.

§Errors

Returns LadduDataError when reading or transforming the source fails.

Source

pub fn sum_weights(&self) -> LadduDataResult<f64>

Sums effective event weights.

§Errors

Returns LadduDataError when reading or transforming the source fails.

Source

pub fn weighted_sum<F>(&self, f: F) -> LadduDataResult<f64>
where F: FnMut(Event<'_>) -> f64,

Sums weight * f(event) over transformed events.

§Errors

Returns LadduDataError when reading or transforming the source fails.

Source

pub fn weighted_complex_sum<F>(&self, f: F) -> LadduDataResult<Complex64>
where F: FnMut(Event<'_>) -> Complex64,

Sums complex weight * f(event) contributions.

§Errors

Returns LadduDataError when reading or transforming the source fails.

Source

pub fn batches( &self, ) -> LadduDataResult<Box<dyn Iterator<Item = LadduDataResult<EventBatch>> + Send>>

Opens an iterator of fully transformed event batches.

§Errors

Returns LadduDataError when the underlying source cannot initialize a batch stream for the current plan.

Source

pub fn try_for_each_batch<F>(&self, f: F) -> LadduDataResult<()>

Visits each transformed batch and stops at the first error.

§Errors

Returns the first LadduDataError produced by the source, transformations, or callback.

Source

pub fn map_batches<T, F>(&self, f: F) -> LadduDataResult<Vec<T>>
where F: FnMut(EventBatch) -> T,

Maps transformed batches into a vector.

§Errors

Returns LadduDataError when reading or transforming a batch fails.

Source

pub fn write_to<S: EventSink>(&self, sink: &mut S) -> LadduDataResult<()>

Streams the transformed dataset into an event sink.

§Errors

Returns LadduDataError when reading, transforming, or writing a batch fails, or the sink cannot begin or finish the stream.

Trait Implementations§

Source§

impl Clone for Dataset

Source§

fn clone(&self) -> Dataset

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more

Auto Trait Implementations§

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> Any for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Source§

fn type_name(&self) -> &'static str

Source§

impl<T> AnySync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

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

Source§

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

Source§

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

Source§

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.