[−][src]Struct scholar::Dataset
A collection of input vectors matched with their expected output.
Methods
impl Dataset
[src]
pub fn from_csv(
file_path: impl AsRef<Path>,
includes_headers: bool,
num_inputs: usize
) -> Result<Self, ParseCsvError>
[src]
file_path: impl AsRef<Path>,
includes_headers: bool,
num_inputs: usize
) -> Result<Self, ParseCsvError>
Parses a dataset from a CSV file.
Arguments
file_path
- The path to the CSV fileincludes_headers
- Whether the CSV has a header row or notnum_inputs
- The number of columns in the CSV that are designated as inputs (to a Machine Learning model)
Examples
// Parses the first four columns of 'iris.csv' as inputs, // and the remaining columns as target outputs let dataset = scholar::Dataset::from_csv("iris.csv", false, 4);
pub fn split(self, train_portion: f64) -> (Self, Self)
[src]
Splits the dataset into two, with the size of each determined by
the given train_portion
.
Examples
let dataset = scholar::Dataset::from_csv("iris.csv", false, 4)?; // Randomly allocates 75% of the original dataset to 'training_data', // and the rest to 'testing_data' let (training_data, testing_data) = dataset.split(0.75);
Panics
This method panics if the given train_portion
isn't between 0 and 1.
pub fn rows(&self) -> usize
[src]
Returns the number of rows in the dataset.
Examples
// Data for the XOR problem let data = vec![ (vec![0.0, 0.0], vec![0.0]), (vec![0.0, 1.0], vec![1.0]), (vec![1.0, 0.0], vec![1.0]), (vec![1.0, 1.0], vec![0.0]), ]; let dataset = scholar::Dataset::from(data); assert_eq!(dataset.rows(), 4);
Trait Implementations
impl Debug for Dataset
[src]
impl From<Vec<(Vec<f64>, Vec<f64>)>> for Dataset
[src]
impl<'a> IntoIterator for &'a Dataset
[src]
Auto 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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn is_in_subset(&self) -> bool
fn to_subset_unchecked(&self) -> SS
fn from_subset(element: &SS) -> SP
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,