Questions tagged [caret]

Caret is an R package containing a set of functions that attempt to streamline the process of creating predictive models.

Filter by
Sorted by
Tagged with
30
votes
3answers
47k views

R: Random Forest throwing NaN/Inf in “foreign function call” error despite no NaN's in dataset [closed]

I'm using caret to run a cross validated random forest over a dataset. The Y variable is a factor. There are no NaN's, Inf's, or NA's in my dataset. However when running the random forest, I get <...
30
votes
2answers
35k views

In caret what is the real difference between cv and repeatedcv?

This is similar to question Caret re-sampling methods, although that really never answered this part of the question in an agreed upon way. caret's train function offers ...
27
votes
3answers
31k views

R caret and NAs

I very much prefer caret for its parameter tuning ability and uniform interface, but I have observed that it always requires complete datasets (i. e. without NAs) even if the applied "naked" model ...
22
votes
4answers
36k views

Caret and randomForest number of trees [duplicate]

I am puzzled as to why the caret package in R does not allow tuning on the number of trees (ntree) in a random forest (specifically in the randomForest package)? I cant imagine this is an oversight on ...
21
votes
1answer
20k views

Caret and coefficients (glmnet)

I am interested in utilizing caret for making inferences on a particular data set. Is it possible to do the following: produce coefficients of a glmnet model I trained in caret. I would like to use ...
21
votes
2answers
16k views

Does caret train function for glmnet cross-validate for both alpha and lambda?

Does the R caret package cross-validate over both alpha and lambda for the ...
21
votes
3answers
16k views

Stacking/ensembling models with caret

I often find myself training several different predictive models using caret in R. I'll train them all on the same cross validation folds, using ...
21
votes
5answers
1k views

Overfitting: No silver bullet?

My understanding is that even when following proper cross validation and model selection procedures, overfitting will happen if one searches for a model hard enough, unless one imposes restrictions on ...
21
votes
2answers
19k views

Caret re-sampling methods

I am using the library caret in R to test various modelling procedures. The trainControl object allows one to specify a re-...
17
votes
0answers
8k views

R - how to let glmnet choose lambda range when using caret? [closed]

To fit a lasso model using glmnet, you can simply do the following and glmnet will automatically calculate a reasonable range of ...
16
votes
2answers
17k views

PCA and k-fold cross-validation in caret package in R

I just re-watched a lecture from the Machine Learning course on Coursera. In the section where the professor discusses PCA for pre-processing data in supervised learning applications, he says PCA ...
16
votes
1answer
3k views

Caret - Repeated K-fold cross-validation vs Nested K-fold cross validation, repeated n-times

The caret package is a brilliant R library for building multiple machine learning models, and has several functions for model building and evaluation. For parameter tuning and model training, the ...
15
votes
4answers
11k views

Gradient boosting machine accuracy decreases as number of iterations increases

I'm experimenting with the gradient boosting machine algorithm via the caret package in R. Using a small college admissions dataset, I ran the following code: <...
15
votes
3answers
12k views

Is there a way to disable the parameter tuning (grid) feature in CARET?

CARET will automatically use a pre-specified tuning grid to build various models before selecting a final model, and then training the final model on the full training data. I can supply my own tuning ...
15
votes
1answer
18k views

Caret glmnet vs cv.glmnet

There seems to be a lot of confusion in the comparison of using glmnet within caret to search for an optimal lambda and using <...
14
votes
2answers
39k views

Using the caret package is it possible to obtain confusion matrices for specific threshold values?

I've obtained a logistic regression model (via train) for a binary response, and I've obtained the logistic confusion matrix via ...
14
votes
2answers
17k views

Different results from randomForest via caret and the basic randomForest package

I am a bit confused: How can the results of a trained Model via caret differ from the model in the original package? I read Whether preprocessing is needed before prediction using FinalModel of ...
13
votes
1answer
16k views

GBM package vs. Caret using GBM

I have been model tuning using caret, but then re-running the model using the gbm package. It is my understanding that the <...
12
votes
1answer
15k views

Is preprocessing needed before prediction using FinalModel of RandomForest with caret package?

I use the caret package for training a randomForest object with 10x10CV. ...
12
votes
2answers
27k views

Caret varImp for randomForest model

I'm having trouble understanding how the varImp function works for a randomForest model with the caret package. In the example ...
12
votes
2answers
4k views

Feature selection and parameter tuning with caret for random forest

I have data with a few thousand features and I want to do recursive feature selection (RFE) to remove uninformative ones. I do this with caret and RFE. However, I started thinking, if I want to get ...
12
votes
1answer
4k views

How to find a GBM Prediction Interval

I am working with GBM models using the caret package and looking to find a method to solve the prediction intervals for my predicted data. I have searched extensively but only come up with a few ...
11
votes
1answer
8k views

Number of principal components when preprocessing using PCA in caret package in R

I am using the caret package in R for training of binary SVM classifiers. For reduction of features I am preprocessing with PCA ...
11
votes
1answer
13k views

Check a status of training process in R [closed]

I'm training a model using caret package in R for almost 3 days. The calculations are running in parallel (multiple processes). Unfortunately there is no output in ...
10
votes
1answer
2k views

mlr compared to caret

I’ve been using mlr a little to learn about machine learning, but recently found out about caret. The way I understand it is that both are wrappers to various ML packages, but have slightly different ...
9
votes
1answer
10k views

How does cross-validation in train (caret) precisely work?

I have read quite a number of posts on the caret package and I am specifically interested in the train function. However, I am not completely sure if I have understood correctly how the train function ...
9
votes
1answer
4k views

R/caret: train and test sets vs. cross-validation?

This may be perhaps a silly question, but when generating a model with caret and using something like LOOCV or (even more to the point) ...
9
votes
2answers
6k views

Neural Network: Why can't I overfit?

I have a (feed-forward single layer) neural network with which I try to predict an environment-related variable from two financial variables (regression). I use the "train" function from the caret ...
8
votes
3answers
41k views

Caret package in R - get top Variable of Importance [closed]

I am facing two problems while using caret package in R. I am reproducing an example below: ...
8
votes
2answers
6k views

Poisson xgboost with exposure

I was trying to model a count dependent variable with uneven exposure. Classical glms would use log(exposure) as offset, also gbm does, but xgboost does not allow for offset until now... Trying to ...
8
votes
1answer
10k views

How do I compute class probabilities in caret package using 'glmnet' method?

If i do a modelLookup('glmnet') it says TRUE for probModel (and in fact, I'd expect it to be usable as a model to predict probabilities in a binary outcome prediction problem as glmnet has a 'binomial'...
8
votes
1answer
10k views

Interpret Variable Importance (varImp) for Factor Variables

When I run variable importance on a random forest (or any other model), the factor/categorical variable names have the factor name as the suffix. For example, ...
8
votes
2answers
5k views

Packages or libraries for multiple-output learning

I have a learning problem from $X$ to $Y$ where: $X$ = $n$ input numeric vectors of $m$ dimensions $Y$ = $n$ output numeric vectors of $k$ dimensions In other words:       I am ...
7
votes
2answers
138 views

How should two cross-validated logistic regression models be compared?

I'm using 100 times 10-fold repeated cross-validation to assess the ROC-AUC performance improvement of adding a biomarker to an existing model: Model_A : pred1 + pred2 Model_B :pred1 + pred2 + pred3 I'...
7
votes
1answer
4k views

How do you get lmFuncs functions of the rfe function in caret to do a logistic regression?

I've been experimenting with the rfe function in the caret package to do logistic regression with feature selection. I used the <...
6
votes
3answers
14k views

R caret Naive Bayes (untuned) results differ from klaR

I'm running a naive bayes classification model and I noticed that the caret package returns a different result than does klaR (which caret references) or e1071. My question is: is there something ...
6
votes
4answers
2k views

Do we have to fix splits before 10-folds cross validation if we want to compare different algorithms?

I work with R and let's say that I have a train set and a test set. I want to test different algorithms (for example neural networks and svm). I will perform a first 10-folds cross validation on my ...
6
votes
1answer
644 views

How to interpret coefficients of a multinomial elastic net (glmnet) regression

I'm trying to model a membership in one of three well-being clusters (flourisher, normative, languisher) based on a set of predictors, using elastic net for both variable selection & modelling. I ...
6
votes
1answer
8k views

R knn variable selection

I have a data set that's 200k rows X 50 columns. I'm trying to use a knn model on it but there is huge variance in performance depending on which variables are ...
6
votes
3answers
2k views

Use Random Forest model to make predictions from sensor data

say I have a sensor that measures temperature, pressure ++, and want to use this data to predict some quantity "A". If I use multivariate regression, I can simply implement a model of the form A=a0+...
6
votes
1answer
3k views

Odd error with caret function rfe

library(caret) set.seed(1) x <- data.frame(runif(10),runif(10)) y <- rnorm(10) rfeModel <- rfe(x,y,rfeControl = rfeControl(functions = lmFuncs)) returns:...
6
votes
1answer
9k views

Do categorical variables have to be dummy coded in SVM?

I am using R with the packages kernlab / caret and doing some analysis with SVM (ksvm). I am using a Radial Based kernel for classification. I have a few ...
6
votes
1answer
5k views

One class SVM with caret in R using cross validation [closed]

I am using one class SVM to train and predict anomalies. I would like to train the model using cross validation in an easy way as I have done with a multiclass SVM with caret in R. Now, I train the ...
6
votes
1answer
4k views

Model Selection and RFE using caret

I'm faced with a high dimensional (samples=148, features=20000), supervised binary classification problem. Which I would like to approach with an ensemble of classifiers, that will classify using a ...
6
votes
1answer
1k views

Recommend classification algorithms to try

I am working on a binary classification problem that is reasonably-sized (100k observations). I extracted 60 numerical features; the classes in the training set are well balanced. There are some ...
6
votes
0answers
7k views

How to interpret caret's variable importance and feature selection plots? [duplicate]

I am having some problems understanding the variable importance and feature selection graphs from ...
5
votes
3answers
12k views

Feature selection before neural network classification

I have a training set of 87 samples and 9480 variables. My predictors are continuous and my response variable is binary. I'd like to use the caret package in R to tune a neural network classification ...
5
votes
1answer
8k views

Class weights in caret [closed]

I'm using the R package caret to generate classifiers using a variety of different models on an imbalanced dataset. To overcome the class imbalance problem, I am using the "weights" parameter in the "...
5
votes
1answer
6k views

How to retrieve model-specific information when using the caret package?

CARET is a convenient tool that wraps dozens of modelling methods. CARET allows the user to access performance statistics such as RMSE, confusion matrices, etc. in a generic way without having to ...
5
votes
1answer
740 views

Parameter tuning with vs without nested cross-validation

Disclaimer: This question has been inspired by this one, which is a good question but has unfortunately not attracted an answer that actually answers OPs question. Statistical models often times have ...

1
2 3 4 5
9