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.
I'm trying to build a predictive model in caret using PCA as pre-processing. The pre-processing would be as follows:
preProc <- preProcess(IL_train[,-1], method="pca", thresh = 0.8)
Is it possible to pass the thresh argument directly to caret's…
I was told to use the caret package in order to perform Support Vector Machine regression with 10 fold cross validation on a data set I have. I'm plotting my response variable against 151 variables. I did the following:-
> ctrl <-…
I am trying to obtain the variable importance of a rf model in any way. This is the approach I have tried so far, but alternate suggestions are very welcome.
I have trained a model in R:
require(caret)
require(randomForest)
myControl =…
Trying to better understand how train(tuneLength = ) works in {caret}. My confusion happened when trying to understand some of the differences between the SVM methods from {kernlab} I've reviewed the documentation (here) and the caret training page…
I am solving a multiclass classification problem and trying to use Generalized Boosted Models (gbm package in R). The issue I faced: caret's train function with method="gbm" seems not to work with multiclass data properly. A simple example is…
I would like to use the R package rsample to generate resamples of my data.
The package offers the function rolling_origin to produce resamples that keep the time series structure of the data. This means that training data (in the package called…
In R, I specify a model with no intercept as follows:
data(iris)
lmFit <- lm(Sepal.Length ~ 0 + Petal.Length + Petal.Width, data=iris)
> round(coef(lmFit),2)
Petal.Length Petal.Width
2.86 -4.48
However, if I fit the same model…
Having an issue while running a logistic regression model using caret::train().
LR = caret::train(Satisfaction ~., data= log_train, method = "glm", preProcess = c("scale"), family="binomial")
keep getting the following line of error:
Error in…
While using Caret package for machine learning, I am struck with Caret's default "Positive" outcome picking i.e the first level of the outcome factor in binary classification problems.
Package says it can be set to the alternative level. Can any…
I was using caret package to tune a glmnet logistic regression model. While the lambda value from best tune is one of the values I specified in the tuneGrid, the lambda values of the final model are totally different:
require(caret)
set.seed(1)
x <-…
In R caret library, if I got a confusion matrix like this below, if there a way to retrieve the overall accuracy 0.992? I can't get this single value out, since I need to store this value and use it for later processing. Is this possible at all?
…
I am working with multivariate financial time series data and having problems using the createTimeSlices function. I cannot find any use of the function except the one used by Max Kuhn. Can anybody help me in understanding the usage of the function?
My question is related to this one regarding categorical data (factors in R terms) when using the Caret package. I understand from the linked post that if you use the "formula interface", some features can be factors and the training will work…
I'm using the caret function "train()" in one of my project and I'd like to add
a "custom metric" F1-score. I looked at this url caret package
But I cannot understand how I can build this score with the parameter available.
There is an example of…
On numerous occasions I've been getting this error when trying to fit a gbm or rpart model. Finally I was able to reproduce it consistently using publicly available data. I have noticed that this error happens when using CV (or repeated cv). When I…