select_features: Select Features

View source: R/allgeneric.R

select_featuresR Documentation

Select Features

Description

Given a feature_selection specification object and a dataset, returns the set of selected features as a binary vector.

Usage

select_features(obj, X, Y, ...)

Arguments

obj

The feature_selection object specifying the feature selection method and its parameters.

X

The dataset containing the training features. This can be a matrix or a ROIVolume or ROISurface object.

Y

The dependent variable as a factor or numeric variable.

...

Additional arguments to be passed to the method-specific function.

Value

A logical vector indicating the columns of X matrix that were selected.

Examples

fsel <- feature_selector("FTest", "top_k", 2)
coords <- rbind(c(1,1,1), c(2,2,2), c(3,3,3))
ROI <- neuroim2::ROIVec(neuroim2::NeuroSpace(c(10,10,10)), coords=coords, matrix(rnorm(100*3), 100, 3))
Y <- factor(rep(c("a", "b"), each=50))
featureMask <- select_features(fsel, neuroim2::values(ROI), Y)
sum(featureMask) == 2

fsel2 <- feature_selector("FTest", "top_p", .1)
featureMask <- select_features(fsel2, neuroim2::values(ROI), Y)


bbuchsbaum/rMVPA documentation built on Feb. 1, 2024, 8:45 p.m.