# The 'features' function
# Written by Kevin Potter
# email: kevin.w.potter@gmail.com
# Please email me directly if you
# have any questions or comments
# Last updated 2018-10-06
# Table of contents
# 1) features | no test needed
###
### 1) features
###
#' Selected Features for Binary Classification
#'
#' Generic function to determine what features
#' were selected by the model to determine
#' binary classification.
#'
#' @param x An R object. Currently there are methods for
#' \code{basic_cv}, \code{nested_cv}, \code{bc_simulate}
#' and \code{bc_estimate}.
#' @param ... Further arguments passed to or from other
#' methods.
#'
#' @return A character string with the column labels for the
#' features the model selected as major determinants in
#' binary classification.
#'
#' @export
#' @examples
#' # Simulate data
#' sim = bc_simulate( 300, 8, 4 )
#' # Determine which predictors were selected to be non-zero
#' features( sim )
#' # Set data up for estimation
#' dat = train_test( 2, c( rep(1,200), rep(2,100) ), sim$y, sim$X )
#' # Fit data
#' fit = bc_estimate( 'glm', dat )
#' # Features selected by model
#' features( fit )
#' # K-fold cross-validation
#' kf_cv = basic_cv( sim$y, sim$X, 'glm', K = 3 )
#' # Features selected by model
#' features( kf_cv )
#' # Nested K-fold cross-validation
#' nkf_cv = nested_cv( sim$y, sim$X, 'glm', K = c(3,10) )
#' features( kf_cv )
features = function( x, ... ) {
UseMethod("features", x)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.