Description Usage Arguments Value Author(s)
Applies the elastic net regression algorithm to learn a sparse linear model for predicting a response vector from a set of input feature vectors.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | elasticNet(
featureMat,
responseVec,
standardize = TRUE,
standardizeY = FALSE,
fitIntercept = TRUE,
alphaVals = seq(0.2, 1, length = 9),
lambdaVals = NULL,
nFoldsForParamSelection = 10,
nCvRepeats = 10,
nTrainingRuns = 200,
minFeatureFrequencyPctl = 0.95,
cumCorNumPredictors = 10,
useLambdaMin = TRUE,
useOneStdErrRule = FALSE,
id = "",
obsFractionForModelSelection = 0.75,
verbose = TRUE
)
|
featureMat |
p x n matrix with input feature vectors along rows. |
responseVec |
n-dimensional response vector to be predicted using a sparse linear combination of input feature vectors specified in featureMat. |
standardize |
Logical flag for feature variable standardization (across observations), passed in to glmnet functions (glmnet documentation: if variables are already in the same units, standardization may not be necessary). |
standardizeY |
Logical flag for response variable standardization across observations. |
fitIntercept |
Logical flag indicating whether intercept term should be fit. |
alphaVals |
a vector of alpha values to be optimized over |
lambdaVals |
a vector of lambda values to be optimized over |
nFoldsForParamSelection |
the number of cross-validation folds to perform |
nTrainingRuns |
number of training runs to perform |
minFeatureFrequencyPctl |
a fractional value (0-1). Features in the x percentile defined by this parameter after the removal of features with zero weights are retained. |
cumCorNumPredictors |
the maximum number of predictors to be returned |
useLambdaMin |
a boolean, whether to use the minimum lambda (lambda.min) from cross-validation as the optimum lambda, if FALSE then the largest value of lambda such that error is within 1 standard error of the minimum (lambda.1se) is used. |
useOneStdErrRule |
Use one standard error rule for model selection, i.e., select smallest model (in terms of number of predictors) for which the estimated error (by cross-validation) is within one standard error of the minimum estimated error. |
id |
a optional string identifier for the EN run |
obsFractionForModelSelection |
The fraction of the number of observations. This is to limit the maximum possible number of predictors considered during model selection (default = 0.75). |
verbose |
a boolean, whether debugging information should be displayed |
a list with members:
predictorWts Coefficient weights for the selected predictors.
predictorSelectionFreq The selection frequency for the final set of predictors, i.e., the fraction of training set iterations in which the predictor was selected.
cvPredRsqVals A vector with the k-th entry indicating the square of the Pearson's correlation coefficient between the actual response and the cross-validation predicted response with linear models based on the top k elastic net selected predictors (by coeff. weight magnitude).
cvPredRVals A vector with the k-th entry indicating the Pearson's correlation coefficient between the actual response and the cross-validation predicted response with linear models based on the top k elastic net selected predictors (by coeff. weight magnitude).
cvMeanSqErrVals A vector with the k-th entry indicating the mean cross-validation error estimate for a model based on the top k predictors (by coeff. weight magnitude).
cvSdMeanSqErrVals A vector with the k-th entry indicating the standard deviation of the cross-validation error estimate for a model based on the top k predictors (by coeff. weight magnitude).
predictedResponse A matrix with the k-th column giving the predicted response with respect to the top k predictors (by coefficient weight magnitude).
predictedResponseCor a vector whose nth element gives the correlation of the response with the linear combination of the first n predictors, with coefficient weights given in predictorWts.
call the command used to call the function with parameters described
alpha the optimized alpha value used
lambda the optimized lambda value used
foldIdsParamSelection The cross-validation fold IDs used during elastic net parameter selection.
foldIdsModelSelection The cross-validation fold IDs used during final model selection (selecting among models with different numbers of predictors).
cvm mean cross-validated errors for alpha values tried
featureWtMat A matrix with the feature weights for all features across all training runs (with each run based on a different random data subset).
Vinodh Rajapakse
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.