View source: R/cssr_old.R View source: R/cssr.R
cssSelect | R Documentation |
Takes in data X and y and returns a set of clusters (and a set of features) that are useful for predicting y from the data in X. This is a wrapper function for css and getCssSelections. Using cssSelect is simpler, but it has fewer options, and it executes the full (computationally expensive) subsampling procedured every time it is called. In contrast, css can be called just once, and then getCssSelections can quickly return results using different values of cutoff, max_num_clusts, etc. from the calculations done in one call to css.
cssSelect( X, y, clusters = list(), lambda = NA, cutoff = NA, max_num_clusts = NA )
X |
An n x p numeric matrix (preferably) or a data.frame (which will be coerced internally to a matrix by the function model.matrix) containing the p >= 2 features/predictors. |
y |
A length-n numeric vector containing the responses; |
clusters |
Optional; either an integer vector of a list of integer vectors; each vector should contain the indices of a cluster of features (a subset of 1:p). (If there is only one cluster, clusters can either be a list of length 1 or an integer vector.) All of the provided clusters must be non-overlapping. Every feature not appearing in any cluster will be assumed to be unclustered (that is, they will be treated as if they are in a "cluster" containing only themselves). If clusters is a list of length 0 (or a list only containing clusters of length 1), then css() returns the same results as stability selection (so feat_sel_mat will be identical to clus_sel_mat). Names for the clusters will be needed later; any clusters that are not given names in the list clusters will be given names automatically by css. Default is list() (so no clusters are specified, and every feature is assumed to be in a "cluster" containng only itself). |
lambda |
Optional; the tuning parameter to be used by the lasso for feature selection in each subsample. If lambda is not provided, cssSelect will choose one automatically by cross-validation. Default is NA. |
cutoff |
Numeric; cssSelect will only select those clusters with selection proportions equal to at least cutoff. Must be between 0 and 1. Default is NA (in which case max_num_clusts are used). |
max_num_clusts |
Integer or numeric; the maximum number of clusters to use regardless of cutoff. (That is, if the chosen cutoff returns more than max_num_clusts clusters, the cutoff will be decreased until at most max_num_clusts clusters are selected.) Default is NA (in which case either cutoff is used to choose the number of clusters, or if cutoff was also unspecified, cssSelect chooses max_num_clusts by cross-validation). |
A named list with two items.
selected_clusts |
A list of integer vectors; each vector contains the indices of one of the selected clusters. |
selected_feats |
An integer vector; the indices of the all of the selected features within all of the selected clusters (typically only one feature is selected from each cluster). |
Gregory Faletto, Jacob Bien
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.