regVarImp
From fscaret v0.8.5.1
by Jakub Szlek
regVarImp
The function uses the caret package advantage to perform fitting of numerous regression models.
Usage
regVarImp(model, xTrain, yTrain, xTest,
fitControl, myTimeLimit, no.cores,
lk_col, supress.output, mySystem)
Arguments
- model
- Chosed models as called from function fscaret(), argument Used.funcRegPred.
- xTrain
- Training data set, data frame of input vector
- yTrain
- Training data set, vector of observed outputs
- xTest
- Testing data set, data frame of input vector
- fitControl
- Fitting controls passed to caret function
- myTimeLimit
- Time limit in seconds for single model fitting
- no.cores
- Number of used cores for calculations
- lk_col
- Number of columns for whole data set (inputs + output)
- supress.output
- If TRUE output of models are supressed.
- mySystem
- Called from fscaret() result of function .Platform$OS.type
References
Kuhn M. (2008) Building Predictive Models in R Using the caret Package Journal of Statistical Software 28(5)
Examples
# Load library
library(fscaret)
# Read working directory
myWD <- getwd()
# Set working directory to tmp
setwd(tempdir())
# Load dataset
data(dataset.train)
data(dataset.test)
# Make objects
trainDF <- dataset.train
testDF <- dataset.test
model <- c("lm","pls","pcr")
fitControl <- trainControl(method = "boot", returnResamp = "all")
myTimeLimit <- 5
no.cores <- 2
supress.output <- TRUE
mySystem <- .Platform$OS.type
if(mySystem=="windows"){
no.cores <- 1
}
# Scan dimensions of trainDF [lk_row x lk_col]
lk_col = ncol(trainDF)
lk_row = nrow(trainDF)
# Read labels of trainDF
labelsFrame <- as.data.frame(colnames(trainDF))
# Create a train data set matrix
trainMatryca_nr <- matrix(data=NA,nrow=lk_row,ncol=lk_col)
row=0
col=0
for(col in 1:(lk_col)) {
for(row in 1:(lk_row)) {
trainMatryca_nr[row,col] <- (as.numeric(trainDF[row,col]))
}
}
# Pointing standard data set train
xTrain <- data.frame(trainMatryca_nr[,-lk_col])
yTrain <- as.vector(trainMatryca_nr[,lk_col])
#--------Scan dimensions of trainDataFrame1 [lk_row x lk_col]
lk_col_test = ncol(testDF)
lk_row_test = nrow(testDF)
testMatryca_nr <- matrix(data=NA,nrow=lk_row,ncol=lk_col)
row=0
col=0
for(col in 1:(lk_col_test)) {
for(row in 1:(lk_row_test)) {
testMatryca_nr[row,col] <- (as.numeric(testDF[row,col]))
}
}
# Pointing standard data set test
xTest <- data.frame(testMatryca_nr[,-lk_col])
yTest <- as.vector(testMatryca_nr[,lk_col])
myVarImp <- regVarImp(model, xTrain, yTrain, xTest,
fitControl, myTimeLimit, no.cores, lk_col,
supress.output, mySystem)
summary(myVarImp)
print(myVarImp)
# Get back to previous working directory
setwd(myWD)
Community examples
Looks like there are no examples yet.