Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [caret]

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

1
vote
1answer
29 views

How do I avoid time leakage in my KNN model?

I am building a KNN model to predict housing prices. I'll go through my data and my model and then my problem. Data - ...
0
votes
0answers
9 views

KNN works in `class` but not `caret` (Too many ties) [on hold]

I am making a KNN algorithm to predict close_price with about 80,000 rows of this data. ...
0
votes
0answers
11 views

caret extractProb [closed]

I am following the example of the caret package paper, when I try to use extractProb, I get this: probValues <- extractProb(models, testX = testDescr, testY = testClass) Error in ...
1
vote
0answers
28 views

What is the basis for the default sigma value used by svmRadial in caret? [closed]

I am looking at the source code (I think) for the "svmRadial" function in the caret package. It looks like the default sigma values are calculated by first using the kernlab package's "sigest" ...
0
votes
0answers
9 views

svm model caret package

I am trying to reproduce the svm model example reported in the original caret paper by khun. But it runs forever and I don't get the output. not even after 2 days. What's wrong? this is the paper: ...
0
votes
0answers
23 views

textclassification caret(svm): very low accuracy for testset because few words matching with trainingset

I am doing text analysis of tweets with caret ("classif.svm). I have manually classified 1500 documents (consisting of 1-5 tweets). When I tune the parameters it shows me an accuracy of about 80% and ...
0
votes
0answers
12 views

NA and missing values preprocessing within caret with cross-validation

I wanted to use caret package to train a model on some messy data (many NAs and missing values) but I cannot find a solution that would fit to my problem. While NAs are part of numerical features I ...
0
votes
0answers
13 views

In the book “Applied Predictive Modeling”, why it repeats over the same fold when doing recursive feature elimination?

I'm trying to conduct recursive feature elimination (RFE) referring to Ch19.7 of the book "Applied Predictive Modeling" by Max Kuhn. In the book, it uses 5 repeated 10-fold cv for RFE. To do this, it ...
1
vote
1answer
27 views

Conflict between predicated outcomes in logistic regression

I was using caret in R to use logistic regression to make prediction. I only have one predictor named OEI and the outcome variable is pass/fail. However, although I was able to perform that task and ...
1
vote
1answer
16 views

Construction of confusion matrix when cross-validating with k-NN in R

I've a dataset looking like this: ...
0
votes
1answer
14 views

How do I run cross validation on a decision tree in an uplift model?

I have this model from the uplift package, ...
2
votes
1answer
38 views

Caret: gradient vs gam boosting

What is the difference between a boosted additive model (e.g. caret model: gamboost) and a general stochastic gradient boosting model (caret model: gbm)? A gradient boosting model is additive by ...
1
vote
0answers
22 views

What's the purpose of `tunegrid` in the caret package?

I am deciding the parameters for a random forest classification model. I am using the caret package and read, here, about the tuning grid. My understanding is that it helps determine the best values ...
0
votes
0answers
49 views

variable importance for multi-class classification using caret (penalized discriminant analysis")

I have data with three classes and have performed classification using caret (pda). My question is about interpreting predictors based on variable importance (varImp). In two class data, we get ...
0
votes
0answers
23 views

How does multicollinearity affect the feature selection process?

I have a classification problem with a modest number of records (approx. 10,000) and dimensions (30 dimensions, 25 are categoric and 5 are numeric). The response variable has two classes (T/F). I'm ...
1
vote
0answers
49 views

LDA Fit using Caret does not give Standard Deviation

I am following the steps outlined in this tutorial. I have followed along and running into an issue at step 5.3. The output of the LDA model gives me all the expected information, except the Accuracy ...
0
votes
0answers
29 views

How do I diagnose collinearity with rfe() from the caret package?

I have 12,000 records and I"d like to predict a two-class outcome. I'm deciding which predictors to keep and I'm having trouble with two problems. 1- I get an error message because I have categories ...
3
votes
2answers
117 views

Can the alpha, lambda values of a glmnet object output determine whether ridge or Lasso?

Given a glmnet object using train() where trControl method is "cv" and number of iterations is 5, I obtained that the bestTune alpha and lambda values are alpha=0.1 and lambda= 0.007688342. On ...
1
vote
0answers
96 views

Random forest vs Random Forest tuned with caret

Looking for some help please. I have used the randomForest package extensively and have been happy with its performance. I am currently writing a journal paper investigating match outcomes in sport, ...
0
votes
0answers
53 views

Linear discriminant scores using caret

I'm using the caret package in R to undertake an LDA. I'm having problems trying to extract the linear discriminant scores once I've used predict. The model is ... ...
0
votes
0answers
118 views

SMOTE and ROSE methods in CARET (R) do not work for balancing a multi-class dataset

SMOTE and ROSE methods in CARET (R) do not work for balancing a multi-class data set. Specifically, ROSE throws an error telling that it needs two levels. It means that it does not work for multi-...
0
votes
1answer
43 views

How to do backward subset selection on a random forest model for classification?

I'd like to identify the most predictive features for my classification model. I'm using this data. Here is a sample. This is my code. I'd like to use the predictors to predict loan status. ...
0
votes
0answers
39 views

Caret: Feature selection with Chi2 / f_classif

I try to classify texts which I have converted to term-document matrices before. I would like to perform feature selection to reduce the number of predictors. In Python, you can do this by means of ...
0
votes
1answer
60 views

SMOTE - What is the difference in sampling before or inside train() [closed]

I have an unbalanced dataset and would like to apply SMOTE to the training data. I can either do one of the following: Inside trainControl() add ...
0
votes
1answer
49 views

Differences in calibration plots for machine learning models

I'm using machine learning methods in R for descriptive regression modelling of a small dataset. I have fit random forest (randomForest), unbiased random forest (cforest) and boosted regression trees (...
1
vote
0answers
29 views

How to approach memory issues with up/down-sampling problem across millions of rows in database that can't be loaded locally? (class imbalance)

I'm faced with fairly typical class imbalance problem across a dataset with nearly 9MM rows (hard drive failures) that's not stored locally (it's in Postgres table; downloading a .csv of it is not ...
0
votes
0answers
66 views

how to extract rules from final model made by caret

I have a made cross-validation (k=5) by caret package using C5.0 method. I have 21 features and 7000 instances. The C5.0 trials default is 40. The problem is C5.0 made > 1600 rules over 40 trials, ...
0
votes
0answers
24 views

k-fold optimization in C5.0 algorithm

How can I do k-fold cross validation for C5.0 algorithm, I know caret package has createFolds function but I think in k-fold process we must do kind of averaging from all models. Because I didn't ...
0
votes
0answers
54 views

Using Caret is there a way to explicityly state what the true class is in binary classification?

I'm using caret + XGBoost to make binary predictions on a dataset. The data are very imbalanced so I'm using prAUC metric. My results using 5 fold cross validation are a prAUC of 0.99+ which is not ...
0
votes
0answers
54 views

caret chooses non-optimal RMSE?

I run a linear regression via caret / glmnet method with "RMSE" as metric. In the final model, caret tells me which values of the tuning parameters alpha and lambda were selected to minimize RMSE. If ...
0
votes
0answers
76 views

what does scale hyperparameter mean in svm polynomial kernel using kernlab in r

I'm trying to train my svm model with polynomial kernel. I'm using caret package with method ...
0
votes
0answers
48 views

How does Caret's PCA function work?

I've been reading through this question: PCA and k-fold cross-validation in caret package in R . In one of the answers, it was suggested to do PCA within the train function rather than before. However,...
0
votes
1answer
602 views

How can I one-hot encode a variable that has only 2 levels? [closed]

I'm trying to do OHC in R to convert categorical into numerical data. However R's caret package requires one to use factors with greater than 2 levels. Any idea how to go around this? I've searched ...
2
votes
1answer
210 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 ...
0
votes
2answers
390 views

dummy vs one-hot encoding - ML for prediction

I understand there is a lack of consensus in the difference (if any) between one-hot (k variables) and dummy (k - 1 variables) encoding from a k-level factor. The caret package seems to auto-encode ...
0
votes
0answers
108 views

Repeated CV evaluation with confidence intervals in R caret?

it occurs to me that there is a part of model evaluation that I have not understood yet. The problem that I am working on now illustrates the point well I think. I need to fit a model of >400 ...
0
votes
0answers
100 views

Difference between AUPRC in caret and PRROC

I'm working in a very unbalanced classification problem, and I'm using AUPRC as metric in caret. I'm getting very differents results for the test set in AUPRC from caret and in AUPRC from package ...
1
vote
0answers
46 views

Feature selection method based on target variable in R [closed]

I have dataset from 30 different features and a result variable. All the features have values like -1,0,1 and my result variable contains -1 and 1 , which 1 means record is healthy and -1 means ...
1
vote
0answers
150 views

Using An ROC Curve to Evaluate a model

I have a number of questions on the ROC curves when being used to evaluate a model. My understanding of them is they can be used to determine the probability cutoff when classifying a row in a dataset ...
0
votes
0answers
348 views

Train function metric option

I have a question based on the train function from the caret package. I am relatively new to ML and am a little confused. I am using the random forest algorithm attempting to predict a continuous ...
0
votes
1answer
543 views

How to prevent overfitting with regression using ranger (randomforest)

I use caret to train the model (on Boston dataset from the mlbench package). Here is the code ...
0
votes
2answers
272 views

Logistic Regression: multicollinearity and Kappa statistics

I may be wrong but from my understanding logistic regression requires there to be little or no multicollinearity among the independent variables, and yet Kappa statistics as part of postResample() ...
2
votes
1answer
414 views

Other distances than euclidean distance in knn [closed]

Suppose I want to fit a k-nearest-neighbour using caret package in R: ...
1
vote
0answers
266 views

Drawing ROC curves from RFE() training results in caret

I want to generate ROC curves using the training data and results from the rfe function in caret. I have managed to do this with the code below but there is some inconsistency between the ROC value ...
1
vote
0answers
180 views

How to use Elastic Net Model to Reduce Collinearity

I am using R to perform a linear regression with a dataset that has clearly correlated independent variables (collinearity). I am using the vif (variance inflation factor) function from the car ...
1
vote
2answers
671 views

Do I have to preprocess my new data for a prediction, if I have used preprocessing for building the model?

In this example preprocessing is used to construct a NN: ...
0
votes
0answers
266 views

Model ensemble with caretStack

I'm building a model ensemble with caretStack (package caretEnsemble). Here is a basic example : ...
0
votes
0answers
31 views

Sample size of each resample

I am calculating a performance metric based on the resamples obtained from cross-validation and bootstrap using the R-package caret: ...
1
vote
1answer
692 views

ridge and lasso models in caret with lambda=0

As far as I know, if I run a lasso model and a ridge model on the same data, and if i keep lambda=0, I'm getting the OLS. Then, how is it possible that I get different results? ...