r-caret

caret - random-forests not working: “Something is wrong; all the Accuracy metric values are missing:”

旧时模样 提交于 2019-12-07 05:22:32
问题 Related to these: getting this error in Caret https://github.com/topepo/caret/issues/160 I'm getting this error: Something is wrong; all the Accuracy metric values are missing: Accuracy Kappa Min. : NA Min. : NA 1st Qu.: NA 1st Qu.: NA Median : NA Median : NA Mean :NaN Mean :NaN 3rd Qu.: NA 3rd Qu.: NA Max. : NA Max. : NA NA's :5 NA's :5 Error in train.default(x, y, weights = w, ...) : Stopping In addition: Warning message: In nominalTrainWorkflow(x = x, y = y, wts = weights, info = trainInfo

Error occurring in caret when running on a cluster

时光怂恿深爱的人放手 提交于 2019-12-07 05:08:10
问题 I am running the train function in caret on a cluster via doRedis. For the most part, it works, but every so often I get errors at the very end of this nature: error calling combine function: <simpleError: obj$state$numResults <= obj$state$numValues is not TRUE> and Error in names(resamples) <- gsub("^\\.", "", names(resamples)) : attempt to set an attribute on NULL when I run traceback() I get: 5: nominalTrainWorkflow(dat = trainData, info = trainInfo, method = method, ppOpts = preProcess,

Is there a way to generate a confidence interval from a caret lm object?

ⅰ亾dé卋堺 提交于 2019-12-07 01:53:59
问题 I would like to be able to generate a confidence interval from a model that I create with the package caret. This can be done using predict(model, data, interval = "confidence") when the model is created with lm() . However, when I try the same command with a model created with caret's train() function, I get the following error: Error in extractPrediction(list(object), unkX = newdata, unkOnly = TRUE, : unused argument (interval = "confidence") This is true even when I set method = "lm" in

Parallelizing Caret code

痞子三分冷 提交于 2019-12-06 14:57:44
问题 I am having hard time to figure out why this code does not parallelize. I am taking the reproducible example straight from the caret web page. library(caret) library(mlbench) library(Hmisc) library(randomForest) library(doMC) registerDoMC(cores = 3) n <- 100 p <- 40 sigma <- 1 set.seed(1) sim <- mlbench.friedman1(n, sd = sigma) colnames(sim$x) <- c(paste("real", 1:5, sep = ""), paste("bogus", 1:5, sep = "")) bogus <- matrix(rnorm(n * p), nrow = n) colnames(bogus) <- paste("bogus", 5+(1:ncol

train() in caret package returns an error about names & gsub

余生长醉 提交于 2019-12-06 13:41:11
I am using caret package to predict the improvementNoticed variable library(caret) head(trainData) improvementNoticed V1 V2 681 0 0.06451613 0.006060769 1484 0 0.77924586 0.331009145 1356 0 0.22222222 0.017538684 541 0 0.21505376 0.011102470 2214 1 0.59195217 0.064764408 1111 0 0.97979798 0.036445064 V3 V4 V5 681 0.008182531 0.05263158 0 1484 0.316603794 0.88825188 0 1356 0.016182822 0.20000000 0 541 0.012665610 0.10000000 0 2214 0.051008693 0.55000000 0 1111 0.034643632 0.93333333 0 and I run myControl = trainControl(method='cv',number=5,repeats=2,returnResamp='none') model1 = train

Using ordinal variables in rpart and caret without converting to dummy categorical variables

核能气质少年 提交于 2019-12-06 07:52:35
问题 I am trying to create an ordinal regression tree in R using rpart , with the predictors mostly being ordinal data, stored as factor in R. When I created the tree using rpart , I get something like this: where the values are the factor values (E.g. A170 has labels ranging from -5 to 10). However, when I use caret to train the data using rpart , when I extract the final model, the tree no longer has ordinal predictors. See below for a sample output tree As you see above, it seems the ordinal

R Caret's rfe [Error in { : task 1 failed - “rfe is expecting 184 importance values but only has 2”]

江枫思渺然 提交于 2019-12-06 07:18:30
问题 I am using Caret's rfe for a regression application. My data (in data.table ) has 176 predictors (including 49 factor predictors). When I run the function, I get this error: Error in { : task 1 failed - "rfe is expecting 176 importance values but only has 2" Then, I used model.matrix( ~ . - 1, data = as.data.frame(train_model_sell_single_bid)) to convert the factor predictors to dummy variables. However, I got similar error: Error in { : task 1 failed - "rfe is expecting 184 importance values

caret: combine createResample and groupKFold

主宰稳场 提交于 2019-12-06 04:20:44
I want to do a custom sampling with caret . My specifications are the following: I have 1 observation per day, and my grouping factor is the month (12 values); so in the first step I create 12 resamples with 11 months in the training (11*30 points) and 1 in the testing (30 points). This way I get 12 resamples in total. But that's not enough to me and I would like to make it a little more complex, by adding some bootstrapping of the training points of each partition. So, instead of having 11*30 points in Resample01, I would have several bootstrapped resamples of these 330 points. So in the end,

'car' dependency error: Installing caret in R 3.1.2

落爺英雄遲暮 提交于 2019-12-05 22:04:17
Cannot install caret package !! install.packages("caret") Installing package into ‘/home/timekeeper/R/x86_64-unknown-linux-gnu-library/3.1’ (as ‘lib’ is unspecified) Warning: dependency ‘car’ is not available trying URL 'http://mirrors.softliste.de/cran/src/contrib/caret_6.0-52.tar.gz' Content type 'application/x-gzip' length 3665293 bytes (3.5 Mb) opened URL ================================================== downloaded 3.5 Mb ERROR: dependency ‘car’ is not available for package ‘caret’ * removing ‘/home/timekeeper/R/x86_64-unknown-linux-gnu-library/3.1/caret’ The downloaded source packages

Plot decision tree in R (Caret)

夙愿已清 提交于 2019-12-05 20:13:15
I have trained a dataset with rf method. For example: ctrl <- trainControl( method = "LGOCV", repeats = 3, savePred=TRUE, verboseIter = TRUE, preProcOptions = list(thresh = 0.95) ) preProcessInTrain<-c("center", "scale") metric_used<-"Accuracy" model <- train( Output ~ ., data = training, method = "rf", trControl = ctrl, metric=metric_used, tuneLength = 10, preProc = preProcessInTrain ) After thath, I want to plot the decission tree, but when I wirte plot(model) , I get this: plot(model) . If I write plot(model$finalModel) , I get this : plot(model$finalModel) I would like to plot the