View source: R/funKerasMnist.R
getMnistData | R Documentation |
Based on the setting kerasConf$encoding
either one-hot encoded data or
tensor-shaped data are returned.The labels are converted to binary class matrices using
the function to_categorical
.
getMnistData(kerasConf)
kerasConf |
List of additional parameters passed to keras as described
in |
list with training and test data, i.e.,
list(x_train, x_test, y_train, y_test)
.
getKerasConf
funKerasMnist
### These examples require an activated Python environment as described in ### Bartz-Beielstein, T., Rehbach, F., Sen, A., and Zaefferer, M.: ### Surrogate Model Based Hyperparameter Tuning for Deep Learning with SPOT, ### June 2021. http://arxiv.org/abs/2105.14625. PYTHON_RETICULATE <- FALSE if(PYTHON_RETICULATE){ library("SPOTMisc") kerasConf <- getKerasConf() kerasConf$encoding <- "oneHot" # default mnist <- getMnistData(kerasConf) # lots of zeros, but there are also some nonzero (greyscale) values, e.g.: mnist$x_train[1,150:160] str(mnist$x_train[1,]) # y-labels are one-hot encoded. The first entry represents "5" mnist$y_train[1,] ## kerasConf$encoding <- "tensor" mnist <- getMnistData(kerasConf) ## 28x28: str(mnist$x_train[1,,,]) mnist$y_train[1,] }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.