FetchBuddle {Buddle} R Documentation

Predicting Classification and Regression.

Description

Yield prediction (softmax value or value) for regression and classification for given data based on the results of training.

Usage

FetchBuddle(X, lW, lb, lParam)

Arguments

 X a matrix of real values which will be used for predicting classification or regression. lW a list of weight matrices obtained after training. lb a list of bias vectors obtained after training. lParam a list of parameters used for training. It includes: label, hiddenlayer, batch, drop, drop.ratio, lr, init.weight, activation, optim, type, rand.eff, distr, and disp.

Value

A list of the following values:

predicted

predicted real values (regression) or softmax values (classification).

One.Hot.Encoding

one-hot encoding values of the predicted softmax values for classification. For regression, a zero matrix will be returned. To convert the one-hot encoding values to labels, use OneHot2Label().

References

 Geron, A. Hand-On Machine Learning with Scikit-Learn and TensorFlow. Sebastopol: O'Reilly, 2017. Print.

 Han, J., Pei, J, Kamber, M. Data Mining: Concepts and Techniques. New York: Elsevier, 2011. Print.

 Weilman, S. Deep Learning from Scratch. O'Reilly Media, 2019. Print.

CheckNonNumeric(), GetPrecision(), MakeConfusionMatrix(), OneHot2Label(), Split2TrainTest(), TrainBuddle()

Examples

### Using mnist data again

data(mnist_data)

X1 = mnist_data\$Images       ### X1: 100 x 784 matrix
Y1 = mnist_data\$Labels       ### Y1: 100 x 1 vector

############################# Train Buddle

lst = TrainBuddle(Y1, X1, train.ratio=0.6, arrange=TRUE, batch.size=10, total.iter = 100,
hiddenlayer=c(20, 10), batch.norm=TRUE, drop=TRUE,
drop.ratio=0.1, lr=0.1, init.weight=0.1,
type = "Classification", rand.eff=TRUE, distr = "Logistic", disp=TRUE)

lW = lst[]
lb = lst[]
lParam = lst[]

X2 = matrix(rnorm(20*784,0,1), 20,784)  ## Genderate a 20-by-784 matrix

lst = FetchBuddle(X2, lW, lb, lParam)   ## Pass X2 to FetchBuddle for prediction

[Package Buddle version 2.0.1 Index]