predict.rpudl {rpud} | R Documentation |
Predict the classification outcome of a collection of input vectors based on a trained RPUDL model.
## S3 method for class 'rpudl'
predict(
model,
x,
...,
log.level = 1
)
model |
a trained |
x |
An m by n matrix, where m is the size of each input vector, and n is the number of input vectors |
... |
further arguments to be passed to or from methods |
log.level |
level of the method output (0 = silent, 1 = basic output, 2 = detailed output) |
A vector whose length is the number of input vectors.
the 'i-th' entry in the vector is the prediction class
of the 'i-th' input vector.
The probability output of each input vector is stored in the
"decision.values"
.
Chi Yau
chi.yau@r-tutor.com
rpudl,
rpudlDataSource,
rpudlTestDataSample,
rpudlTrain
## Not run:
# create data source
ds <- rpudlDataSource(
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 <- rpudlTestDataSample(ds, c(1, num))
# predictions
res <- predict(model, obj$x)
# find num of errors
sum((obj$y+1) == res)
## End(Not run)