predict.rpudl {rpud}R Documentation

Predictions of an RPUDL Model

Description

Predict the classification outcome of a collection of input vectors based on a trained RPUDL model.

Usage

## S3 method for class 'rpudl'
predict(
    model,
    x,
    ...,
    log.level = 1
    )

Arguments

model

a trained rpudl model object for prediction

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)

Value

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".

Author(s)

Chi Yau
chi.yau@r-tutor.com

See Also

rpudl,
rpudlDataSource,
rpudlTestDataSample,
rpudlTrain

Examples

## 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)

[Package rpud version 0.7.1 Index]