baseGLMnet | R Documentation |
Prediction by generalized regression models with lasso or elastic net regularization.
baseGLMnet( trainData, testData, predMode = c("classification", "probability", "regression"), paramlist = list(family = "binomial", alpha = 0.5, typeMeasure = "mse", typePred = "class") )
trainData |
The input training dataset. The first column is named the 'label'. |
testData |
The input test dataset. The first column is named the 'label'. |
predMode |
The prediction mode. Available options are c('classification', 'probability', 'regression'). |
paramlist |
A set of model parameters defined in an R list object. The valid option: list(family, alpha, typeMeasure, typePred).
|
The predicted output for the test data.
Junfang Chen
## Load data methylfile <- system.file('extdata', 'methylData.rds', package='BioMM') methylData <- readRDS(methylfile) dataY <- methylData[,1] ## select a subset of genome-wide methylation data at random methylSub <- data.frame(label=dataY, methylData[,c(2:2001)]) trainIndex <- sample(nrow(methylSub), 16) trainData = methylSub[trainIndex,] testData = methylSub[-trainIndex,] library(glmnet) ## classification predY <- baseGLMnet(trainData, testData, predMode='classification', paramlist=list(family='binomial', alpha=0.5, typeMeasure='mse', typePred='class')) testY <- testData[,1] accuracy <- classifiACC(dataY=testY, predY=predY) print(accuracy)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.