rpudlGetTestingDataSamples {rpud}R Documentation

Test Data Sample Extraction

Description

Extract a sequence of data items from the test database.

Usage

rpudlGetTestingDataSamples(
    data.source,
    data.interval,
    label.offset = 1
    )

Arguments

data.source

An S3 object that inherits the class rpudl.data.source

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.

Value

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

Author(s)

Chi Yau
chi.yau@r-tutor.com

See Also

rpudl,
rpudlCreateDataSource,
rpudlTrain,
predict.rpudl

Examples

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

[Package rpud version 0.7.2 Index]