Struct mnist::MnistBuilder
[−]
[src]
pub struct MnistBuilder<'a> { /* fields omitted */ }
Struct used for configuring how to load the MNIST data.
- lbl_format - Specify how to format the label vectors. Options include:
- Digit (default) - a single number from 0-9 representing the corresponding digit.
- OneHotVector - a 1x10 one-hot vector of all 0's except for a 1 at the index of the digit.
- ex.)
3 -> [0, 0, 0, 1, 0, 0, 0, 0, 0, 0]
- ex.)
- trn_len - the length of the training set
(default = 60,000)
- val_len - the length of the validation set
(default = 0)
- tst_len - the length of the test set
(default = 10,000)
- base_path - the path to the directory in which to look for the MNIST data files.
(default = "data/")
- trn_img_filename - the filename of the training images data file.
(default = "train-images-idx3-ubyte")
- trn_lbl_filename - the filename of the training labels data file.
(default = "train-labels-idx1-ubyte")
- tst_img_filename - the filename of the test images data file.
(default = "10k-images-idx3-ubyte")
- tst_lbl_filename - the filename of the test labels data file.
(default = "t10k-labels-idx1-ubyte")
Methods
impl<'a> MnistBuilder<'a>
[src]
fn new() -> MnistBuilder<'a>
fn label_format_digit(&mut self) -> &mut MnistBuilder<'a>
Set the labels format to scalar.
Examples
let mnist = MnistBuilder::new() .label_format_digit() .finalize();
fn label_format_one_hot(&mut self) -> &mut MnistBuilder<'a>
Set the labels format to vector.
Examples
let mnist = MnistBuilder::new() .label_format_one_hot() .finalize();
fn training_set_length(&mut self, length: u32) -> &mut MnistBuilder<'a>
Set the training set length.
Examples
let mnist = MnistBuilder::new() .training_set_length(40_000) .finalize();
fn validation_set_length(&mut self, length: u32) -> &mut MnistBuilder<'a>
Set the validation set length.
Examples
let mnist = MnistBuilder::new() .validation_set_length(10_000) .finalize();
fn test_set_length(&mut self, length: u32) -> &mut MnistBuilder<'a>
Set the test set length.
Examples
let mnist = MnistBuilder::new() .test_set_length(10_000) .finalize();
fn base_path(&mut self, base_path: &'a str) -> &mut MnistBuilder<'a>
Set the base path to look for the MNIST data files.
Examples
let mnist = MnistBuilder::new() .base_path("data_sets/mnist") .finalize();
fn training_images_filename(
&mut self,
trn_img_filename: &'a str
) -> &mut MnistBuilder<'a>
&mut self,
trn_img_filename: &'a str
) -> &mut MnistBuilder<'a>
Set the training images data set filename.
Examples
let mnist = MnistBuilder::new() .training_images_filename("training_images") .finalize();
fn training_labels_filename(
&mut self,
trn_lbl_filename: &'a str
) -> &mut MnistBuilder<'a>
&mut self,
trn_lbl_filename: &'a str
) -> &mut MnistBuilder<'a>
Set the training labels data set filename.
Examples
let mnist = MnistBuilder::new() .training_labels_filename("training_labels") .finalize();
fn test_images_filename(
&mut self,
tst_img_filename: &'a str
) -> &mut MnistBuilder<'a>
&mut self,
tst_img_filename: &'a str
) -> &mut MnistBuilder<'a>
Set the test images data set filename.
Examples
let mnist = MnistBuilder::new() .test_images_filename("test_images") .finalize();
fn test_labels_filename(
&mut self,
tst_lbl_filename: &'a str
) -> &mut MnistBuilder<'a>
&mut self,
tst_lbl_filename: &'a str
) -> &mut MnistBuilder<'a>
Set the test labels data set filename.
Examples
let mnist = MnistBuilder::new() .test_labels_filename("test_labels") .finalize();