Download MNIST database of handwritten digits.
Base URL that the MNIST files are located at.
A data frame with 785 variables:
Integer pixel value, from 0 (white) to 255 (black).
The digit represented by the image, in the range 0-9.
Pixels are organized row-wise. The
Label variable is stored as a
There are 70,000 digits in the data set. The first 60,000 are the training
set, as found in the
train-images-idx3-ubyte.gz file. The remaining
10,000 are the test set, from the
For more information see http://yann.lecun.com/exdb/mnist.
Downloads the image and label files for the training and test datasets from http://yann.lecun.com/exdb/mnist and converts them to a data frame.
Data frame containing the MNIST digits.
Originally based on a function by Brendan O'Connor.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
## Not run: # download the MNIST data set mnist <- download_mnist() # first 60,000 instances are the training set mnist_train <- head(mnist, 60000) # the remaining 10,000 are the test set mnist_test <- tail(mnist, 10000) # PCA on 1000 random training examples mnist_r1000 <- mnist_train[sample(nrow(mnist_train), 1000), ] pca <- princomp(mnist_r1000[, 1:784], scores = TRUE) # plot the scores of the first two components plot(pca$scores[, 1:2], type = 'n') text(pca$scores[, 1:2], labels = mnist_r1000$Label, col = rainbow(length(levels(mnist_r1000$Label)))[mnist_r1000$Label]) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.