pub struct DataReader { /* private fields */ }Expand description
Reads a delimited text file into a Dataset.
The default format is one instance per line, whitespace separated, the
label in column 0, # starting a comment, and no header row.
Labels must be non-negative integers. They are treated as a dense encoding,
so num_labels is max_label + 1 and a file whose labels are {0, 2}
simply has an empty class 1.
Implementations§
Source§impl DataReader
impl DataReader
Sourcepub fn with_format(self, format: DataFormat) -> Self
pub fn with_format(self, format: DataFormat) -> Self
Sets the column delimiter.
Sourcepub fn with_headers(self, has_headers: bool) -> Self
pub fn with_headers(self, has_headers: bool) -> Self
Whether the first data line is a header to skip.
Sourcepub fn with_comment_char(self, comment_char: Option<char>) -> Self
pub fn with_comment_char(self, comment_char: Option<char>) -> Self
Lines starting with this character are ignored.
Sourcepub fn with_label_column(self, label_column: usize) -> Self
pub fn with_label_column(self, label_column: usize) -> Self
Which column holds the label. Defaults to 0.
Sourcepub fn auto_detect_format(self, path: &Path) -> Self
pub fn auto_detect_format(self, path: &Path) -> Self
Picks the delimiter from the file extension (.csv, .tsv, otherwise
whitespace).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DataReader
impl RefUnwindSafe for DataReader
impl Send for DataReader
impl Sync for DataReader
impl Unpin for DataReader
impl UnsafeUnpin for DataReader
impl UnwindSafe for DataReader
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