load_mnist: Load the MNIST images

Description Usage Arguments Details Examples

View source: R/rmnist.R

Description

Load the MNIST images. There are two sets "train" and "t10k"; the train argument switches between these. The actual images are not shipped with the package as they are ~11MB. Instead these can be downloaded with download_mnist or by passing download_if_missing = TRUE to this function.

Usage

1
load_mnist(train = FALSE, download_if_missing = FALSE, cache_dir = NULL)

Arguments

train

Logical, indicating if the training data set should be loaded. If FALSE then the "t10k" set is loaded. By default, the smaller file is loaded.

download_if_missing

Logical, indicating if the images should be downloaded if not present. See download_mnist for details about the downloading and where files will be stored.

cache_dir

Path to look for the rmnist cache. If not given (or given as NULL) then a cache based on rappdirs is used (see download_mnist).

Details

The first time within a session that the images are loaded, the loading process may be slow as the files are read from disk (this is particularly true for the "train = TRUE" data set, which is the larger of the two). Subsequent loads will be much faster though, as the processed images are cached within a session.

Examples

1
2
3
4
5
6
7
mnist <- load_mnist(FALSE)
mnist

x <- mnist[[2]]
x
print(x, TRUE)
plot(x)

richfitz/rmnist documentation built on May 27, 2019, 8:42 a.m.