ggDigit: Plot a single mnist digit

Description Usage Arguments Details Value Examples

View source: R/basicPlotting.R

Description

ggDigit plots a single mnist digit with ggplot.

Usage

1
ggDigit(digit, trueLab, predLab)

Arguments

digit

A single row from the mnist dataset, i.e. a 1 by 784 vector. This can e.g. be the first digit from the mnist dataset trainSet$x[1,].

trueLab

The true label of the digit. Can be a factor or character.

predLab

The predicted label, e.g. from a classifier. Can be a factor or character.

Details

This functions returns a ggplot object of a single digit. The goal is to keep the plot as minimal as possible, only showing the true digit information. Additional parameters are given to create a title with the digit label and a predicted label.

Value

Return a ggplot object of the digit.

Examples

1
2
3
4
5
6
7
8
9
# Create some random data to plot
dat <- matrix(sample(0:255,784,replace=TRUE),nrow = 1)
# Get the ggplot object
myRandomNonDigit <- ggDigit(dat)
## Not run: 
# Display the digit
(myRandomNonDigit)

## End(Not run)

gumeo/mnistr documentation built on May 17, 2019, 9:27 a.m.