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.
Here is my code:
library(caret)
set.seed(32343)
modelFit = train(type~.,data=training, method='glm')
It's pretty standard but I am getting the error message:
Error in library(e1071) : there is no package called ‘e1071’
What's the cause, and how…
When I run 2 random forests in caret, I get the exact same results if I set a random seed:
library(caret)
library(doParallel)
set.seed(42)
myControl <- trainControl(method='cv', index=createFolds(iris$Species))
set.seed(42)
model1 <-…
I am using the caret package to train a model with "rpart" package;
tr = train(y ~ ., data = trainingDATA, method = "rpart")
Data has no missing values or NA's, but when running the command a warning message comes up;
Warning message:
In…
Using the R package caret, how can I generate a ROC curve based on the cross-validation results of the train() function?
Say, I do the following:
data(Sonar)
ctrl <- trainControl(method="cv",
summaryFunction=twoClassSummary,
…
I am trying to estimate a logistic regression, using the 10-fold cross-validation.
#import libraries
library(car); library(caret); library(e1071); library(verification)
#data import and preparation
data(Chile)
chile <-…
I've build a model using caret. When the training was completed I got the following warning:
Warning message:
In train.default(x, y, weights = w, ...) :
At least one of the class levels are not valid R variables names; This may cause errors if…
I've trained a tree model with R caret. I'm now trying to generate a confusion matrix and keep getting the following error:
Error in confusionMatrix.default(predictionsTree, testdata$catgeory)
: the data and reference factors must have the same…
I'm using caret package to model the data using rpart package.
library('caret')
data(iris)
formula <- as.formula(Species ~.)
t <- train(formula,iris,method = "rpart",cp=0.002,maxdepth=8)
plot(t)
As a result I get object 't' and I'm trying to plot…
When I train just using glm, everything works, and I don't even come close to exhausting memory. But when I run train(..., method='glm'), I run out of memory.
Is this because train is storing a lot of data for each iteration of the cross-validation…
I am trying to build model using train function from caret package:
model <- train(training$class ~ .,data=training, method = "nb")
Training set contains about 20K observations, each observation has above 100 variables. I would like to know if…
I've tried to use machine learning to make prediction based on time-series data. In one of the stackoverflow question (createTimeSlices function in CARET package in R) is an example of using createTimeSlices to cross-validation for model training…
I do not understand which is the difference between varImp function (caret package) and importance function (randomForest package) for a Random Forest model:
I computed a simple RF classification model and when computing variable importance, I found…
I have used caret package's train function with 10-fold cross validation. I also have got class probabilities for predicted classes by setting classProbs = TRUE in trControl, as follows:
myTrainingControl <- trainControl(method = "cv",
…