r-caret

Train function from R caret package error: “Something is wrong; all the Accuracy metric values are missing”

三世轮回 提交于 2020-01-17 05:31:45
问题 I want to run a logreg regression. I obtain the following error after running my code on R: 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 :9 NA's :9 Error in train.default(x, y, weights = w, ...) : Stopping In addition: There were 19 warnings (use warnings() to see them) Here is my code: ## Data donner <- read.delim("http:/

Set seed parallel random forest in caret for reproducible result

本小妞迷上赌 提交于 2020-01-13 19:57:05
问题 I wish to run random forest in parallel using caret package, and I wish to set the seeds for reproducible result as in Fully reproducible parallel models using caret. However, I don't understand line 9 in the following code taken from caret help: why do we sample 22 (plus the last model in line 12, 23) integer numbers (12 values for parameter k are evaluated)? For information, I wish to run 5-fold CV to evaluate 584 values for RF parameter 'mtry'. Any help is much appreciated. Thank you. ##

Set seed parallel random forest in caret for reproducible result

狂风中的少年 提交于 2020-01-13 19:56:45
问题 I wish to run random forest in parallel using caret package, and I wish to set the seeds for reproducible result as in Fully reproducible parallel models using caret. However, I don't understand line 9 in the following code taken from caret help: why do we sample 22 (plus the last model in line 12, 23) integer numbers (12 values for parameter k are evaluated)? For information, I wish to run 5-fold CV to evaluate 584 values for RF parameter 'mtry'. Any help is much appreciated. Thank you. ##

'car' dependency error: Installing caret in R 3.1.2

社会主义新天地 提交于 2020-01-13 19:06:56
问题 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’ *

Feature selection with caret rfe and training with another method

随声附和 提交于 2020-01-13 06:41:47
问题 Right now, I'm trying to use Caret rfe function to perform the feature selection, because I'm in a situation with p>>n and most regression techniques that don't involve some sort of regularisation can't be used well. I already used a few techniques with regularisation (Lasso), but what I want to try now is reduce my number of feature so that I'm able to run, at least decently, any kind of regression algorithm on it. control <- rfeControl(functions=rfFuncs, method="cv", number=5) model <- rfe

Feature selection with caret rfe and training with another method

╄→гoц情女王★ 提交于 2020-01-13 06:41:09
问题 Right now, I'm trying to use Caret rfe function to perform the feature selection, because I'm in a situation with p>>n and most regression techniques that don't involve some sort of regularisation can't be used well. I already used a few techniques with regularisation (Lasso), but what I want to try now is reduce my number of feature so that I'm able to run, at least decently, any kind of regression algorithm on it. control <- rfeControl(functions=rfFuncs, method="cv", number=5) model <- rfe

Different results with randomForest() and caret's randomForest (method = “rf”)

笑着哭i 提交于 2020-01-12 03:27:16
问题 I am new to caret, and I just want to ensure that I fully understand what it’s doing. Towards that end, I’ve been attempting to replicate the results I get from a randomForest() model using caret’s train() function for method="rf". Unfortunately, I haven’t been able to get matching results, and I’m wondering what I’m overlooking. I’ll also add that given that randomForest uses bootstrapping to generate samples to fit each of the ntrees, and estimates error based on out-of-bag predictions, I’m

Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]): contrasts can be applied only to factors with 2 or more levels

无人久伴 提交于 2020-01-11 05:36:09
问题 I'm using the R caret package to generate a model. I'm using PCA in the pre-process for dimensionality reduction and then trying to generate a logistic regression model. I'm getting this error: Error in contrasts<- ( *tmp* , value = contr.funs[1 + isOF[nn]]): contrasts can be applied only to factors with 2 or more levels credit <- read.csv('~Loans Question/RequiredAttributesWithLoanStatus.csv') credit$LoanStatus <- as.factor(credit$LoanStatus) str(credit) 'data.frame': 8580 obs. of 45

Creating a data partition using caret and data.table

一笑奈何 提交于 2020-01-11 05:32:05
问题 I have a data.table in R which I want to use with caret package set.seed(42) trainingRows<-createDataPartition(DT$variable, p=0.75, list=FALSE) head(trainingRows) # view the samples of row numbers However, I am not able to select the rows with data.table. Instead I had to convert to a data.frame DT_df <-as.data.frame(DT) DT_train<-DT_df[trainingRows,] dim(DT_train) the data.table alternative DT_train <- DT[.(trainingRows),] requires the keys to be set. Any better option other than converting

R caret package rfe never finishes error task 1 failed - “replacement has length zero”

和自甴很熟 提交于 2020-01-10 04:14:09
问题 I recently started to look into caret package for a model I'm developing. I'm using the latest version. As the first step, I decided to use it for feature selection. The data I'm using has about 760 features and 10k observations. I created a simple function based on the training material on line. Unfortunately, I consistently get an error and so the process never finishes. Here is the code that produces error. In this example I am using a small subset of features. I started with the full set