Questions tagged [r-caret]

caret is an R package for classification and regression training. It provides a standardized interface to several of R's machine learning packages, along with utilities for training and plotting.

caret is an package for and training. It provides a standardized interface to several of R's packages, along with utilities for and ting.

Repositories

Vignettes

Books

Other resources

Related tags

Unrelated tags

  • refers to an onscreen text cursor. Please re-tag any questions with both the and tags as .
2088 questions
13
votes
2 answers

using caret package to find optimal parameters of GBM

I'm using the R GBM package for boosting to do regression on some biological data of dimensions 10,000 X 932 and I want to know what are the best parameters settings for GBM package especially (n.trees, shrinkage, interaction.depth and…
DOSMarter
  • 1,485
  • 5
  • 21
  • 29
12
votes
1 answer

R: using ranger with caret, tuneGrid argument

I'm using the caret package to analyse Random Forest models built using ranger. I can't figure out how to call the train function using the tuneGrid argument to tune the model parameters. I think I'm calling the tuneGrid argument wrong, but can't…
Mark
  • 596
  • 1
  • 4
  • 14
12
votes
1 answer

Extract the coefficients for the best tuning parameters of a glmnet model in caret

I am running elastic net regularization in caret using glmnet. I pass sequence of values to trainControl for alpha and lambda, then I perform repeatedcv to get the optimal tunings of alpha and lambda. Here is an example where the optimal tunings for…
pd441
  • 2,644
  • 9
  • 30
  • 41
12
votes
1 answer

Parallel processing with xgboost and caret

I want to parallelize the model fitting process for xgboost while using caret. From what I have seen in xgboost's documentation, the nthread parameter controls the number of threads to use while fitting the models, in the sense of, building the…
drgxfs
  • 1,097
  • 1
  • 8
  • 19
12
votes
1 answer

Caret Package: Stratified Cross Validation in Train Function

Is there a way to perform stratified cross validation when using the train function to fit a model to a large imbalanced data set? I know straight forward k fold cross validation is possible but my categories are highly unbalanced. I've seen…
Windstorm1981
  • 2,564
  • 7
  • 29
  • 57
12
votes
3 answers

Improving model training speed in caret (R)

I have a dataset consisting of 20 features and roughly 300,000 observations. I'm using caret to train model with doParallel and four cores. Even training on 10% of my data takes well over eight hours for the methods I've tried (rf, nnet, adabag,…
Alexander David
  • 769
  • 2
  • 8
  • 19
12
votes
3 answers

Error when using predict() on a randomForest object trained with caret's train() using formula

Using R 3.2.0 with caret 6.0-41 and randomForest 4.6-10 on a 64-bit Linux machine. When trying to use the predict() method on a randomForest object trained with the train() function from the caret package using a formula, the function returns an…
Adrien Combaz
  • 123
  • 1
  • 1
  • 6
12
votes
1 answer

How to change metrics using the library(caret)?

I would like to change the metric from RMSE to RMSLE using the caret library Given some sample data: ivar1<-rnorm(500, mean = 3, sd = 1) ivar2<-rnorm(500, mean = 4, sd = 1) ivar3<-rnorm(500, mean = 5, sd = 1) ivar4<-rnorm(500, mean = 4, sd…
user3833190
12
votes
8 answers

Dependency issue while installing caret package in R

I am trying to install R package caret Which gives me ERROR: dependencies ‘ggplot2’, ‘reshape2’, ‘BradleyTerry2’ are not available for package ‘caret’ I tried to install each of this individually, which again shows installation going on, ending with…
user123
  • 5,269
  • 16
  • 73
  • 121
12
votes
2 answers

Creating folds for k-fold CV in R using Caret

I'm trying to make a k-fold CV for several classification methods/hiperparameters using the data available at http://archive.ics.uci.edu/ml/machine-learning-databases/undocumented/connectionist-bench/sonar/sonar.all-data. This set is made of 208…
gcolucci
  • 438
  • 1
  • 5
  • 21
12
votes
1 answer

Caret::train - Values Not Imputed

I am trying to impute values by passing "knnImpute" to the preProcess argument of Caret's train() method. Based on the following example, it appears that the values are not imputed, remain as NA and are then ignored. What am I doing wrong? Any…
Nick Allen
  • 1,443
  • 1
  • 11
  • 29
12
votes
2 answers

Is there a way to set up a multi-hidden layer neural network with the mlp method in the caret package?

The mlp method in package caret calls the mlp function in RSNNS. In the RSNNS package, I can set up as many hidden layers in the neural net as I like by setting the size parameter, e.g. data(iris) #shuffle the vector iris <-…
Tommy Levi
  • 771
  • 5
  • 12
11
votes
2 answers

Automatic caret parameter tuning fails in glmnet

Context and error message I try to fit a two-class prediction model using glmnet within caret. I incur an error when using the caret default tune grids. I don't think it is due to wrongly formatted data because, when specifying my own tuning grid,…
workingonit
  • 113
  • 1
  • 10
11
votes
1 answer

Caret package - cross-validating GAM with both smooth and linear predictors

I would like to cross validate a GAM model using caret. My GAM model has a binary outcome variable, an isotropic smooth of latitude and longitude coordinate pairs, and then linear predictors. Typical syntax when using mgcv is: gam1 <- gam( y ~ s(lat…
Paul Lantos
  • 113
  • 1
  • 6
11
votes
1 answer

Different results with randomForest() and caret's randomForest (method = "rf")

I am new to caret, and I just want to ensure that I fully understand what it’s doing. Towards that end, I’ve been attempting to replicate the results I get from a randomForest() model using caret’s train() function for method="rf". Unfortunately, I…
ej5607
  • 309
  • 2
  • 12