caret (version 4.75)

sbf: Selection By Filtering (SBF)


Model fitting after applying univariate filters


sbf(x, ...)

## S3 method for class 'default': sbf(x, y, sbfControl = sbfControl(), ...)

## S3 method for class 'formula': sbf(form, data, ..., subset, na.action, contrasts = NULL)

## S3 method for class 'sbf': predict(object, newdata = NULL, ...)


a data frame containing training data where samples are in rows and features are in columns.
a numeric or factor vector containing the outcome for each sample.
A formula of the form y ~ x1 + x2 + ...
Data frame from which variables specified in formula are preferentially to be taken.
An index vector specifying the cases to be used in the training sample. (NOTE: If given, this argument must be named.)
A function to specify the action to be taken if NAs are found. The default action is for the procedure to fail. An alternative is na.omit, which leads to rejection of cases with missing values on any required variable. (NOTE: If given, this argument must
a list of contrasts to be used for some or all of the factors appearing as variables in the model formula.
a list of values that define how this function acts. See sbfControl. (NOTE: If given, this argument must be named.)
an object of class sbf
a matrix or data frame of predictors. The object must have non-null column names
for sbf: arguments passed to the classification or regression routine (such as randomForest). For predict.sbf: augments cannot be passed to the prediction function


  • for sbf, an object of class sbf with elements:
  • predif sbfControl$saveDetails is TRUE, this is a list of predictions for the hold-out samples at each resampling iteration. Otherwise it is NULL
  • variablesa list of variable names that survived the filter at each resampling iteration
  • resultsa data frame of results aggregated over the resamples
  • fitthe final model fit with only the filtered variables
  • optVariablesthe names of the variables that survived the filter using the training set
  • callthe function call
  • controlthe control object
  • resampleif sbfControl$returnResamp is "all", a data frame of the resampled performance measures. Otherwise, NULL
  • metricsa character vector of names of the performance measures
  • dotsa list of optional arguments that were passed in
  • For predict.sbf, a vector of predictions.


This function can be used to get resampling estimates for models when simple, filter-based feature selection is applied to the training data.

For each iteration of resampling, the predictor variables are univariately filtered prior to modeling. Performance of this approach is estimated using resampling. The same filter and model are then applied to the entire training set and the final model (and final features) are saved.

The modeling and filtering techniques are specified in sbfControl. Example functions are given in lmSBF.

See Also




## Use a GAM is the filter, then fit a random forest model
RFwithGAM <- sbf(bbbDescr, logBBB,
                 sbfControl = sbfControl(functions = rfSBF,
                                         verbose = FALSE, 
                                         method = "cv"))

predict(RFwithGAM, bbbDescr[1:10,])