| rpudlCreateDataSource {rpud} | R Documentation |
Creates an S3 object that contains training and testing data.
rpudlCreateDataSource(
data.format = c("lmdb", "cifar10", "cifar100", "minst"),
data.dir,
data.shape = NULL,
data.channels = 1,
train.data = NULL,
test.data = NULL,
url = NULL
)
data.format |
format of the data set |
data.dir |
path location of the data set |
data.shape |
the width and height of each data item |
data.channels |
number of channels of each data item |
train.data |
name of the training |
test.data |
name of the testing |
url |
if non-null, specifies alternative URL for downloading |
The supported data formats include MNIST, CIFAR, and LMDB.
If the data format is MNIST or CIFAR,
it will automatically download the data from its origin.
For LMDB data, the database must locally exists beforehand.
To use custom data for model training, it must be
imported into an LMDB database.
Each record in the database is a protobuf message with
the following type:
message Datum {
required bytes data = 1;
required uint32 label = 2;
}
An S3 object that inherits the class rpudlDataSource containing:
data.format |
format of the data set |
data.dir |
path location of the data set |
data.shape |
the width and height of each data item |
data.channels |
number of channels of each data item |
train.data |
name of the training |
test.data |
name of the testing |
Chi Yau
chi.yau@r-tutor.com
rpudl,
predict.rpudl,
rpudlTrain,
rpudlPretrain,
rpudlGetTestingDataSamples,
rpudlFindTrainingDataMean,
rpudlWriteLMDB
## 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)
## End(Not run)