rpudlGetTestingDataSamples {rpud} | R Documentation |
Extract a sequence of data items from the test database.
rpudlGetTestingDataSamples(
data.source,
data.interval,
label.offset = 1
)
data.source |
An S3 object that inherits the class |
data.interval |
An integer pair that denotes the range of test data to be retrieved. |
label.offset |
Integer offset for having 1-based vector index of the labels. |
A list of the following:
x |
m by n matrix where m is the size of each input data, n is the number of test data. |
y |
classification values from the test data |
Chi Yau
chi.yau@r-tutor.com
rpudl,
rpudlCreateDataSource,
rpudlTrain,
predict.rpudl
## Not run:
# create data source
ds <- rpudlCreateDataSource(
data.format="lmdb",
data.dir="data/mnist",
train.data="mnist-official-data_train_lmdb",
test.data="mnist-official-data_test_lmdb",
data.shape=c(28, 28)
)
# create model
model <- rpudl(
"mnist_mpl_lenet.prototxt",
data.source=ds
)
# train model
model <- rpudlTrain(model, batch=100, iter=1000)
# extract some test samples
num <- 12
obj <- rpudlGetTestingDataSamples(ds, c(1, num))
# predictions
res <- predict(model, obj$x)
# find num of errors
sum((obj$y+1) == res)
## End(Not run)