predict: Extract predictions from NBLDA model

Description Usage Arguments Value Note Author(s) Examples

Description

This function predicts the class labels of test data for a given model.

Usage

1
2
3
4
5
6
7
## S3 method for class 'nblda'
predict(object, test.data, return = c("predictions",
  "everything"), ...)

## S4 method for signature 'nblda'
predict(object, test.data, return = c("predictions",
  "everything"), ...)

Arguments

object

a nblda object returned from trainNBLDA.

test.data

a data frame or matrix whose class labels to be predicted.

return

what should be returned? Predicted class labels or eveything?

...

further arguments to be passed to or from methods.

Value

It is possible to return only predicted class labels or a list with elements which are used within prediction process. These arguements are as follows:

xte

count data for test set.

nste

normalized count data for test set.

ds

estimates of offset parameter for each variable. See notes.

discriminant

discriminant scores of each subject.

prior

prior probabilities for each class.

ytehat

predicted class labels for test set.

alpha

power transformation parameter. If no transformation is requested, it returns NULL.

type

normalization method.

dispersions

dispersion estimates of each variable.

Note

d_kj is simply used to re-parameterize the Negative Binomial mean as s_i*g_j*d_kj where s_i is the size factor for subject i, g_j is the total count of variable j and d_kj is the offset parameter for variable j at class k.

Author(s)

Dincer Goksuluk

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
set.seed(2128)
counts <- generateCountData(n = 20, p = 10, K = 2, param = 1, sdsignal = 0.5, DE = 0.8,
                            allZero.rm = FALSE, tag.samples = TRUE)
x <- t(counts$x + 1)
y <- counts$y
xte <- t(counts$xte + 1)
ctrl <- nbldaControl(folds = 2, repeats = 2)

fit <- trainNBLDA(x = x, y = y, type = "mle", tuneLength = 10,
                  metric = "accuracy", train.control = ctrl)

predict(fit, xte)

NBLDA documentation built on May 2, 2019, 12:21 p.m.