selectedFeatures: Accessors for the 'selectedFeatures' slot.

selectedFeaturesR Documentation

Accessors for the 'selectedFeatures' slot.

Description

This slot, if not NULL, stores the selected features/variables for sparse model.

Usage

## S4 method for signature 'nblda'
selectedFeatures(object)

## S4 method for signature 'nblda_trained'
selectedFeatures(object)

Arguments

object

an nblda or nblda_trained object.

Value

a list of selected features info including the followings:

idx

column indices of selected features/variables

names

column names of selected features/variables if input data have pre-defined column names.

Note

If return.selected.features = FALSE within nbldaControl or all features/variables are selected and used in discrimination function, idx and names are returned NULL.

See Also

trainNBLDA, nblda, nblda_trained

Examples

set.seed(2128)
counts <- generateCountData(n = 20, p = 50, K = 2, param = 1, sdsignal = 0.5, DE = 0.6,
                            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, return.selected.features = TRUE,
                     transform = TRUE, phi.epsilon = 0.10)

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

selectedFeatures(fit)


NBLDA documentation built on March 18, 2022, 7:51 p.m.