r-caret

R Crashes when training using caret and method = gamLoess

十年热恋 提交于 2021-01-28 08:32:51
问题 When I run the code below, R crashes. If I comment out the tuneGrid line in the call to train, there is no crash. I've tried this with another dataset, and still crash R. Crash message is R Session Aborted R encountered a fatal error The session was terminated Start new session. The code is: library(splines) library(foreach) library(gam) library(lattice) library(ggplot2) library(caret) # crashes when I uncomment the tuneGrid = tuneGrid line Set_seed_seed <- 100 data_set <- diamonds[, c(1, 5,

R - Caret train() “Error: Stopping” with “Not all variable names used in object found in newdata”

寵の児 提交于 2021-01-28 07:13:02
问题 I am trying to build a simple Naive Bayes classifer for mushroom data. I want to use all of the variables as categorical predictors to predict if a mushroom is edible. I am using caret package. Here is my code in full: ################################################################################## # Prepare R and R Studio environment ################################################################################## # Clear the R studio console cat("\014") # Remove objects from environment

object 'pkgInfo' not found, r

社会主义新天地 提交于 2021-01-28 02:18:08
问题 I'm trying to run a script that worked well in the past few days, but has been causing me much grief recently. When I try to load the caret library, it says that there is a problem with ggplot2. Here is the output: > library(caret) Loading required package: lattice Loading required package: ggplot2 Error: package or namespace load failed for ‘ggplot2’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]): object 'pkgInfo' not found Error: package ‘ggplot2’ could not be loaded I

Machine learning with caret: How to specify a timeout?

房东的猫 提交于 2021-01-28 00:53:56
问题 Is it possible to specify a timeout when training a model in R using train from the caret library? If not, does a R construct exist that wraps the code and can be terminated after a certain amount of time? 回答1: Caret options are configured with the trainControl() object. It does not have a parameter to specify a timeout period. The two settings in trainControl() that make the most impact on runtime performance are method= and number= . The default method in caret is boot , or bootstrapping.

Caret and GBM: task 1 failed - “arguments imply differing number of rows”

北城以北 提交于 2021-01-27 14:36:34
问题 I'm trying to run a GBM with caret with the code below: library(caret) library(doParallel) detectCores() registerDoParallel(detectCores() - 1) set.seed(668) in.train <- createDataPartition(y = dat$target, p = 0.80, list = T) ctrl <- trainControl(method = 'cv', number = 2, classProbs = T, verboseIter = T, summaryFunction = LogLossSummary2) gbm.grid <- expand.grid(interaction.depth = 10, n.trees = (2:7) * 50, shrinkage = 0.1) Sys.time() set.seed(1234) gbm.fit <- train(target ~., data = otto.new

Optimising caret for sensitivity still seems to optimise for ROC

梦想与她 提交于 2021-01-20 08:06:46
问题 I'm trying to maximise sensitivity in my model selection in caret using rpart . To this end, I tried to replicate the method given here (scroll down to the example with the user-defined function FourStat) caret's github page # create own function so we can use "sensitivity" as our metric to maximise: Sensitivity.fc <- function (data, lev = levels(data$obs), model = NULL) { out <- c(twoClassSummary(data, lev = levels(data$obs), model = NULL)) c(out, Sensitivity = out["Sens"]) } rpart_caret_fit

Optimising caret for sensitivity still seems to optimise for ROC

不羁的心 提交于 2021-01-20 08:05:37
问题 I'm trying to maximise sensitivity in my model selection in caret using rpart . To this end, I tried to replicate the method given here (scroll down to the example with the user-defined function FourStat) caret's github page # create own function so we can use "sensitivity" as our metric to maximise: Sensitivity.fc <- function (data, lev = levels(data$obs), model = NULL) { out <- c(twoClassSummary(data, lev = levels(data$obs), model = NULL)) c(out, Sensitivity = out["Sens"]) } rpart_caret_fit

Training Model in Caret Using F1 Metric

↘锁芯ラ 提交于 2020-12-31 15:05:05
问题 I am trying to fit a random forest model to my dataset and I would like to select the best model based off of the F1 score. I saw a post here describing the code necessary. I attempted to copy the code but I am getting the error "Error in { : task 1 failed - "could not find function "F1_Score" while I run the train function. (FYI the variable I am trying to predict ("pass") is a two class factor "Fail" and "Pass") See Code Below: library(MLmetrics) library(caret) library(doSNOW) f1 <-

Training Model in Caret Using F1 Metric

岁酱吖の 提交于 2020-12-31 14:56:19
问题 I am trying to fit a random forest model to my dataset and I would like to select the best model based off of the F1 score. I saw a post here describing the code necessary. I attempted to copy the code but I am getting the error "Error in { : task 1 failed - "could not find function "F1_Score" while I run the train function. (FYI the variable I am trying to predict ("pass") is a two class factor "Fail" and "Pass") See Code Below: library(MLmetrics) library(caret) library(doSNOW) f1 <-

Training Model in Caret Using F1 Metric

爱⌒轻易说出口 提交于 2020-12-31 14:55:38
问题 I am trying to fit a random forest model to my dataset and I would like to select the best model based off of the F1 score. I saw a post here describing the code necessary. I attempted to copy the code but I am getting the error "Error in { : task 1 failed - "could not find function "F1_Score" while I run the train function. (FYI the variable I am trying to predict ("pass") is a two class factor "Fail" and "Pass") See Code Below: library(MLmetrics) library(caret) library(doSNOW) f1 <-