r-caret

R - error installing caret package

核能气质少年 提交于 2019-12-04 14:42:12
> Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), > versionCheck = vI[[j]]) : namespace ‘pbkrtest’ 0.4-2 is being > loaded, but >= 0.4.4 is required > Error: package or namespace load > failed for ‘caret’ Caret was working fine until I tried to load Rcpp and it messed everything up. I searched the answers for a similar problem with caret but the solutions posted did not seem to work on mine. I followed: install.packages("caret", dependencies = TRUE) But it did not work. I would suggest you to check the R version. I updated the version to 3.5.1 and it works perfectly :) Mac only –

Selecting tuning parameters with caret using standard deviation of custom metric

放肆的年华 提交于 2019-12-04 13:22:24
I'm using caret with custom fitting metric, but I need to maximize not just this metric but lower bound of it's confidence interval. So I'd like to maximize something like mean(metric) - k * stddev(metric) . I know how to do this manually, but is there a way to tell caret to automatically select best parameters using this function? Yes, you can define your own selection metric through the "summaryFunction" parameter of your "trainControl" object and then with the "metric" parameter of your call to train() . Details on this are pretty well documented in the "Alternate Performance Metrics"

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

怎甘沉沦 提交于 2019-12-04 12:57:09
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 but only has 2" I'm using R version 3.1.1 on Windows 7 (64-bit), Caret version 6.0-41. I also have

Issues with tuneGrid parameter in random forest

喜你入骨 提交于 2019-12-04 12:28:42
问题 I've been dealing with some extremely imbalanced data and I would like to use stratified sampling to created more balanced random forests Right now, I'm using the caret package, mainly to for tuning the random forests. So I try to setup a tuneGrid to pass in the mtry and sampsize parameters into caret train method as follows. mtryGrid <- data.frame(.mtry = 100),.sampsize=80) rfTune<- train(x = trainX, y = trainY, method = "rf", trControl = ctrl, metric = "Kappa", ntree = 1000, tuneGrid =

caret train() predicts very different then predict.glm()

让人想犯罪 __ 提交于 2019-12-04 07:23:30
问题 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 <- na.omit(Chile) #remove "na's" chile <- chile[chile$vote == "Y" | chile$vote == "N" , ] #only "Y" and "N" required chile$vote <- factor(chile$vote) #required to remove unwanted levels chile$income <- factor(chile$income) # treat income as a factor Goal is to estimate a glm -

support vector machine train caret error kernlab class probability calculations failed; returning NAs

纵然是瞬间 提交于 2019-12-04 07:02:41
i have some data and Y variable is a factor - Good or Bad. I am building a Support vector machine using 'train' method from 'caret' package. Using 'train' function i was able to finalize values of various tuning parameters and got the final Support vector machine . For the test data i can predict the 'class'. But when i try to predict probabilities for test data, i get below error (for example my model tells me that 1st data point in test data has y='good', but i want to know what is the probability of getting 'good' ...generally in case of support vector machine, model will calculate

r caret estimate parameters on a subset fit to full data

元气小坏坏 提交于 2019-12-04 06:38:31
问题 I have a dataset of 550k items that I split 500k for training and 50k for testing. During the training stage it is necessary to establish the 'best' combination of each algorithms' parameter values. Rather than use the entire 500k for this I'd be happy to use a subset, BUT when it comes to training the final model, with the 'best' combination, I'd like to use the full 500k. In pseudo code the task looks like: subset the 500k training data to 50k for each combination of model parameters (3, 6,

R rfe function “caret” Package error: there should be the same number of samples in x and y

ぐ巨炮叔叔 提交于 2019-12-04 04:16:56
问题 As I'm trying the rfe example from the "caret" package taken from here, I kept on receiving this error Error in rfe.default(d[1:2901, ], c(1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, : there should be the same number of samples in x and y This question has been asked but its solution doesn't apply in this case. Here's the code: set.seed(7) # load the library library(mlbench) library(caret) # load the data d <- read.table("d.dat") # define the control using a random forest selection function control <

Why do results using caret::train(…, method = “rpart”) differ from rpart::rpart(…)?

拜拜、爱过 提交于 2019-12-04 03:12:11
I'm taking part in the Coursera Practical Machine Learning course, and the coursework requires building predictive models using this dataset . After splitting the data into training and testing datasets, based on the outcome of interest (herewith labelled y , but is in fact the classe variable in the dataset): inTrain <- createDataPartition(y = data$y, p = 0.75, list = F) training <- data[inTrain, ] testing <- data[-inTrain, ] I have tried 2 different methods: modFit <- caret::train(y ~ ., method = "rpart", data = training) pred <- predict(modFit, newdata = testing) confusionMatrix(pred,

Dependency issue while installing caret package in R

三世轮回 提交于 2019-12-04 02:58:33
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 status 3: In install.packages("caret") : installation of package ‘scales’ had non-zero exit status 4: In