r-caret

Dependency issue while installing caret package in R

烈酒焚心 提交于 2019-12-05 19:05:38
问题 I am trying to install R package caret Which gives me ERROR: dependencies ‘ggplot2’, ‘reshape2’, ‘BradleyTerry2’ are not available for package ‘caret’ I tried to install each of this individually, which again shows installation going on, ending with message that installation of package ‘X’ had non-zero exit status 1: In install.packages("caret") : installation of package ‘minqa’ had non-zero exit status 2: In install.packages("caret") : installation of package ‘RcppEigen’ had non-zero exit

Something is wrong; all the ROC metric values are missing:

限于喜欢 提交于 2019-12-05 16:40:18
I'm training a model in R with the caret package: ctrl <- trainControl(method = "repeatedcv", repeats = 3, summaryFunction = twoClassSummary) logitBoostFit <- train(LoanStatus~., credit, method = "LogitBoost", family=binomial, preProcess=c("center", "scale", "pca"), trControl = ctrl) I'm getting the following warnings: Warning message: In train.default(x, y, weights = w, ...): The metric "Accuracy" was not in the result set. ROC will be used instead.Warning message: In nominalTrainWorkflow(x = x, y = y, wts = weights, info = trainInfo, : There were missing values in resampled performance

“length of 'dimnames' [1] not equal to array extent” error in linear regression summary in r

ε祈祈猫儿з 提交于 2019-12-05 15:57:13
I'm running a straightforward linear regression model fit on the following dataframe: > str(model_data_rev) 'data.frame': 128857 obs. of 12 variables: $ ENTRY_4 : num 186 218 208 235 256 447 471 191 207 250 ... $ ENTRY_8 : num 724 769 791 777 707 237 236 726 773 773 ... $ ENTRY_12: num 2853 2989 3174 3027 3028 ... $ ENTRY_16: num 2858 3028 3075 2992 3419 ... $ ENTRY_20: num 7260 7188 7587 7560 7165 ... $ EXIT_4 : num 70 82 105 114 118 204 202 99 73 95 ... $ EXIT_8 : num 1501 1631 1594 1576 1536 ... $ EXIT_12 : num 3862 3923 4158 3970 3895 ... $ EXIT_16 : num 1559 1539 1737 1681 1795 ... $ EXIT

r caret predict returns fewer output than input

允我心安 提交于 2019-12-05 10:02:53
I used caret to train an rpart model below. trainIndex <- createDataPartition(d$Happiness, p=.8, list=FALSE) dtrain <- d[trainIndex, ] dtest <- d[-trainIndex, ] fitControl <- trainControl(## 10-fold CV method = "repeatedcv", number=10, repeats=10) fitRpart <- train(Happiness ~ ., data=dtrain, method="rpart", trControl = fitControl) testRpart <- predict(fitRpart, newdata=dtest) dtest contains 1296 observations, so I expected testRpart to produce a vector of length 1296. Instead it's 1077 long, i.e. 219 short. When I ran the prediction on the first 220 rows of dtest , I got a predicted result of

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

北城余情 提交于 2019-12-05 09:11:30
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 the train function. Does anyone know how to get a confidence interval from such an object? Preferably

r package caret-Print iteration when using parallel

早过忘川 提交于 2019-12-05 08:40:43
Is there anyway we could print iteration when using the caret::train function in parallel? I know there is option called verbose but it seems it doesn't print anything if I use multicore. I've found a solution. All we need is to register cores via makeCluster function. library(doSNOW) cl <- makeCluster(30, outfile="") registerDoSNOW(cl) In this way, the log will be printed in console. I've tested on regular R/ Rstudio/ Rserver in mac/window/ubuntu (even AWS) For example, iris <- iris[1:100,] iris$Species <- as.factor(as.character(iris$Species)) tc <- trainControl(method="LGOCV",

How to implement a hold-out validation in R

旧城冷巷雨未停 提交于 2019-12-05 07:47:52
问题 Let's say I'm using the Sonar data and I'd like to make a hold-out validation in R. I partitioned the data using the createFolds from caret package as folds <- createFolds(mydata$Class, k=5) . I would like then to use exactly the fold mydata[i] as test data and train a classifier using mydata[-i] as train data. My first thought was to use the train function, but I couldn't find any support for hold-out validation. Am I missing something here? Also, I'd like to be able to use exactly the pre

Error: Package “ggplot2” could not be found, when loading the caret package

安稳与你 提交于 2019-12-05 06:39:11
When I install caret with. install.packages("caret", dependencies=c("Depends", "Suggests")) library(caret) ## Loading required package: lattice ## Loading required package: ggplot2 Error in LoadNamespace(i, c(lib.loc, .libPaths()), versionCheck=vI[[i]]): there is no package called 'digest' Error: package 'ggplot2' could not be loaded. So I resolve the issue with the package digest by installing caret using this code and what do I get again: install.packages("caret", dep="TRUE") library(caret) ## Loading required package: lattice ## Loading required package: ggplot2 Error in LoadNamespace(i, c

Can't install the caret package in R (in my Linux machine)

我们两清 提交于 2019-12-05 06:21:52
I am facing the following errors while trying to install the caret package in R. g++: error: /tmp/Rtmp2Tos7n/R.INSTALL2e6e30153a74/nloptr/nlopt-2.4.2/lib/libnlopt_cxx.a: No such file or directory make: *** [nloptr.so] Error 1 ERROR: compilation failed for package ‘nloptr’ * removing ‘/rmt/csfiles/pgrads/mava290/R/x86_64-suse-linux-gnu-library/3.1/nloptr’ Warning in install.packages : installation of package ‘nloptr’ had non-zero exit status ERROR: dependency ‘nloptr’ is not available for package ‘lme4’ * removing ‘/rmt/csfiles/pgrads/mava290/R/x86_64-suse-linux-gnu-library/3.1/lme4’ Warning in

R Confusion Matrix sensitivity and specificity labeling

别来无恙 提交于 2019-12-05 05:55:09
问题 I am using R v3.3.2 and Caret 6.0.71 (i.e. latest versions) to construct a logistic regression classifier. I am using the confusionMatrix function to create stats for judging its performance. logRegConfMat <- confusionMatrix(logRegPrediction, valData[,"Seen"]) Reference 0, Prediction 0 = 30 Reference 1, Prediction 0 = 14 Reference 0, Prediction 1 = 60 Reference 1, Prediction 1 = 164 Accuracy : 0.7239 Sensitivity : 0.3333 Specificity : 0.9213 The target value in my data (Seen) uses 1 for true