Learn R Programming

msgl (version 2.0.125.0)

features.msgl: Nonzero features

Description

Extracts the nonzero features for each model.

Usage

## S3 method for class 'msgl':
features(object, ...)

Arguments

object
a msgl object
...
ignored

Value

  • a list of of length nmod(x) containing the nonzero features (that is nonzero colums of the beta matrices)

Examples

Run this code
data(SimData)
x <- sim.data$x
classes <- sim.data$classes
lambda <- msgl.lambda.seq(x, classes, alpha = .5, d = 50, lambda.min = 0.05)
fit <- msgl(x, classes, alpha = .5, lambda = lambda)

# the nonzero features of model 1, 10 and 25
features(fit)[c(1,10,25)]

# count the number of nonzero features in each model
sapply(features(fit), length)

Run the code above in your browser using DataLab