Description Usage Arguments Value Examples
This is an implementation of the backward selection algorithm in which you start with a full model and iteratively remove the least useful feature at each step. This function is built for the specific case of backward selection in linear regression models.
1 2 |
X_train |
Training data. Represented as a 2D matrix or dataframe of (observations, features). |
y_train |
Target class for training data. Represented as a 1D vector of target classes for |
X_val |
Validation data. Represented as a 2D matrix or dataframe of (observations, features). |
y_val |
Target class for validation data. Represented as a 1D vector of target classes for |
n_features |
The number of features to select, expressed either as a proportion (0,1)
or whole number with range (0,total_features). Note: |
min_change |
The smallest change in criterion score to be considered significant.
Note: |
criterion |
Model selection criterion to measure relative model quality. Can be one of:
|
verbose |
if |
A vector of indices that represent the best features of the model.
1 2 3 4 5 6 | X_train <- matrix(runif(50, 0, 50), ncol=5)
y_train <- runif(10, 0, 50)
X_val <- matrix(runif(50, 0, 20), ncol=5)
y_val <- runif(10, 0, 20)
backward(X_train, y_train, X_val, y_train, min_change=0.1, n_features=NULL, criterion="r-squared")
backward(X_train, y_train, X_val, y_train, n_features=0.1, min_change=NULL, criterion="aic")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.