pub struct InMemoryDataset { /* private fields */ }Expand description
A concrete implementation of Dataset trait for in-memory datasets
Implementations§
Source§impl InMemoryDataset
impl InMemoryDataset
Sourcepub fn new(features: Array2<f64>, targets: Option<Array1<f64>>) -> Self
pub fn new(features: Array2<f64>, targets: Option<Array1<f64>>) -> Self
Create a new in-memory dataset
Sourcepub fn with_metadata(
features: Array2<f64>,
targets: Option<Array1<f64>>,
metadata: HashMap<String, String>,
) -> Self
pub fn with_metadata( features: Array2<f64>, targets: Option<Array1<f64>>, metadata: HashMap<String, String>, ) -> Self
Create with metadata
Sourcepub fn add_metadata(&mut self, key: String, value: String)
pub fn add_metadata(&mut self, key: String, value: String)
Add metadata entry
Trait Implementations§
Source§impl Clone for InMemoryDataset
impl Clone for InMemoryDataset
Source§fn clone(&self) -> InMemoryDataset
fn clone(&self) -> InMemoryDataset
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Dataset for InMemoryDataset
impl Dataset for InMemoryDataset
Source§fn n_features(&self) -> usize
fn n_features(&self) -> usize
Get the number of features in the dataset
Source§fn features(&self) -> DatasetTraitResult<ArrayView2<'_, f64>>
fn features(&self) -> DatasetTraitResult<ArrayView2<'_, f64>>
Get features as an array view
Source§fn sample(&self, index: usize) -> DatasetTraitResult<ArrayView1<'_, f64>>
fn sample(&self, index: usize) -> DatasetTraitResult<ArrayView1<'_, f64>>
Get a specific sample (row) by index
Source§fn has_targets(&self) -> bool
fn has_targets(&self) -> bool
Check if the dataset has target values
Source§fn targets(&self) -> DatasetTraitResult<Option<ArrayView1<'_, f64>>>
fn targets(&self) -> DatasetTraitResult<Option<ArrayView1<'_, f64>>>
Get targets as an array view (if available)
Source§impl Debug for InMemoryDataset
impl Debug for InMemoryDataset
Source§impl MutableDataset for InMemoryDataset
impl MutableDataset for InMemoryDataset
Source§fn set_sample(
&mut self,
index: usize,
sample: ArrayView1<'_, f64>,
) -> DatasetTraitResult<()>
fn set_sample( &mut self, index: usize, sample: ArrayView1<'_, f64>, ) -> DatasetTraitResult<()>
Set a specific sample
Source§fn set_targets(
&mut self,
targets: ArrayView1<'_, f64>,
) -> DatasetTraitResult<()>
fn set_targets( &mut self, targets: ArrayView1<'_, f64>, ) -> DatasetTraitResult<()>
Set targets (if supported)
Source§fn add_sample(
&mut self,
sample: ArrayView1<'_, f64>,
_target: Option<f64>,
) -> DatasetTraitResult<()>
fn add_sample( &mut self, sample: ArrayView1<'_, f64>, _target: Option<f64>, ) -> DatasetTraitResult<()>
Add a new sample to the dataset
Source§fn remove_sample(&mut self, index: usize) -> DatasetTraitResult<()>
fn remove_sample(&mut self, index: usize) -> DatasetTraitResult<()>
Remove a sample from the dataset
Auto Trait Implementations§
impl Freeze for InMemoryDataset
impl RefUnwindSafe for InMemoryDataset
impl Send for InMemoryDataset
impl Sync for InMemoryDataset
impl Unpin for InMemoryDataset
impl UnwindSafe for InMemoryDataset
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