search for: traincontrol

Displaying 20 results from an estimated 45 matches for "traincontrol".

2013 Feb 19
0
CARET. Relationship between data splitting trainControl
I have carefully read the CARET documentation at: http://caret.r-forge.r-project.org/training.html, the vignettes, and everything is quite clear (the examples on the website help a lot!), but I am still a confused about the relationship between two arguments to trainControl: "method" "index" and the interplay between trainControl and the data splitting functions in caret (e.g. createDataPartition, createResample, createFolds and createMultiFolds) To better frame my questions, let me use the following example from the documentation: ***********...
2012 Nov 23
1
caret train and trainControl
I am used to packages like e1071 where you have a tune step and then pass your tunings to train. It seems with caret, tuning and training are both handled by train. I am using train and trainControl to find my hyper parameters like so: MyTrainControl=trainControl( method = "cv", number=5, returnResamp = "all", classProbs = TRUE ) rbfSVM <- train(label~., data = trainset, method="svmRadial", tuneGrid = ex...
2011 May 05
1
[caret package] [trainControl] supplying predefined partitions to train with cross validation
...2.88. I use the caret package to compare different models on a dataset. In order to compare their different performances I would like to use the same data partitions for every models. I understand that using a LGOCV or a boot type re-sampling method along with the "index" argument of the trainControl function, one is able to supply a training partition to the train function. However, I would like to apply a 10-fold cross validation to validate the models and I did not find any way to supply some predefined partition (created with createFolds) in this setting. Any help ? Thank you and great pa...
2012 May 15
1
caret: Error when using rpart and CV != LOOCV
...e I: Throws warning --- library(caret) data(trees) formula=Volume~Girth+Height train(formula, data=trees, method='rpart') --- Simlified Testcase II: Every other CV-method also throws the warning, for example using 'cv': --- library(caret) data(trees) formula=Volume~Girth+Height tc=trainControl(method='cv') train(formula, data=trees, method='rpart', trControl=tc) --- Simlified Testcase III: The only CV-method which is working is 'LOOCV': --- library(caret) data(trees) formula=Volume~Girth+Height tc=trainControl(method='LOOCV') train(formula, data=trees,...
2012 Apr 13
1
caret package: custom summary function in trainControl doesn't work with oob?
Hi all, I've been using a custom summary function to optimise regression model methods using the caret package. This has worked smoothly. I've been using the default bootstrapping resampling method. For bagging models (specifically randomForest in this case) caret can, in theory, uses the out-of-bag (oob) error estimate from the model instead of resampling, which (in theory) is largely
2011 Aug 28
1
Trying to extract probabilities in CARET (caret) package with a glmStepAIC model
...king with a dataset that include 4 predictor variables in Descr and a two-category outcome in Categ (codified as a factor). Everything was working fine I got the results, confussion matrix etc. BUT for obtaining the AUC and predicted probabilities I had to add " classProbs = TRUE," in the trainControl. Thereafter everytime I run train I get this message: "undefined columns selected" I copy the syntax: fitControl <- trainControl(method = "cv", number = 10, classProbs = TRUE,returnResamp = "all", verboseIter = FALSE) glmFit <- train(Descr, Categ, method = &quot...
2012 Jul 12
1
Caret: Use timingSamps leads to error
I want to use the caret package and found out about the timingSamps obtion to obtain the time which is needed to predict results. But, as soon as I set a value for this option, the whole model generation fails. Check this example: ------------------------- library(caret) tc=trainControl(method='LGOCV', timingSamps=10) tcWithout=trainControl(method='LGOCV') x=train(Volume~Girth+Height, method="lm", data=trees, trControl=tcWithout) x=train(Volume~Girth+Height, method="lm", data=trees, trControl=tc) Error in eval(expr, envir, enclos) : object ...
2009 Jun 08
3
caret package
...on, I used the glmnet to model and trying to get the coefficients and the model parameters I am trying to use the extractPrediction to obtain a confusion matrix and it seems to be giving me errors. x<-read.csv("x.csv", header=TRUE); y<-read.csv("y.csv", header=TRUE); tc=trainControl(method="cv", number=10 ); glmmat<-train(x,y,method="glmnet", trControl=tc); extractPrediction(list(glmmat,testX=x,testY = y)); any help would be great thanks vss [[alternative HTML version deleted]]
2009 Jan 15
2
problems with extractPrediction in package caret
Hi list, I´m working on a predictive modeling task using the caret package. I found the best model parameters using the train() and trainControl() command. Now I want to evaluate my model and make predictions on a test dataset. I tried to follow the instructions in the manual and the vignettes but unfortunately I´m getting an error message I can`t figure out. Here is my code: rfControl <- trainControl(method = "oob", returnResa...
2008 Sep 18
1
caret package: arguments passed to the classification or regression routine
...) function. I would like to train gbm using the laplace distribution or the quantile distribution. here is the code I used and the error: gbm.test <- train(x.enet, y.matrix[,7], method="gbm", distribution=list(name="quantile",alpha=0.5), verbose=FALSE, trControl=trainControl(method="cv",number=5), tuneGrid=gbmGrid ) Model 1: interaction.depth=1, shrinkage=0.1, n.trees=300 collapsing over other values of n.trees Error in gbm.fit(trainX, modY, interaction.depth = tuneValue$.interaction.depth, : formal argument "distribution" matched by multiple...
2011 Jan 24
5
Train error:: subscript out of bonds
...rain1<-trainset[,-ncol(trainset)] train1<-train1[,-(1)] test_t<-testset[,-ncol(testset)] species_test<-as.factor(testset[,ncol(testset)]) test_t<-test_t[,-(1)] #### #CARET::TRAIN #### fit1<-train(train1,as.factor(trainset[,ncol(trainset)]),"svmpoly",trControl = trainControl((method = "cv"),10,verboseIter = F),tuneLength=3) pred<-predict(fit1,test_t) t_train[[i]]<-table(predicted=pred,observed=testset[,ncol(testset)]) tune_result[[i]]<-fit1$results; tune_best<-fit1$bestTune; scale1[i]<-tune_best[[3]] degree[i]<-tune_best[[2]] c1[i]<...
2012 Feb 10
1
Custom caret metric based on prob-predictions/rankings
...dealing with classification problems, and I'm trying to specify a custom scoring metric (recall at p, ROC, etc.) that depends on not just the class output but the probability estimates, so that caret::train can choose the optimal tuning parameters based on this metric. However, when I supply a trainControl summaryFunction, the data given to it contains only class predictions, so the only metrics possible are things like accuracy, kappa, etc. Is there any way to do this that I'm looking? If not, could I put this in as a feature request? Thanks! -- Yang Zhang http://yz.mit.edu/
2013 Apr 07
2
Working with createFolds
Hello! I have a question. I am working with createFolds: folds<- trainControl(method='cv', index=createFolds(data$Score,list = TRUE)) I need to iterate over folds to extract the indexes from each fold. For example, if I do folds$index$Fold01, it contains: 5 11 17 29 44 50 52 64 65 I need to iterate over each $Fold_i to extract the indexes, but I can't d...
2013 Mar 02
2
caret pls model statistics
...to do regression #I don't fully understand this but if I left as a factor I would get an error following the summary function iris$Species=as.numeric(iris$Species) inTrain1=createDataPartition(y=iris$Species, p=.75, list=FALSE) training1=iris[inTrain1,] testing1=iris[-inTrain1,] ctrl1=trainControl(method="cv", number=10) plsFit2=train(Species~., data=training1, method="pls", trControl=ctrl1, metric="Rsquared", preProc=c("scale")) data(iris) training1=iris[inTrain1,] datvars=training1[,1:4] dat.sc=scale(datvars) n=nrow(dat.sc)...
2007 Oct 30
1
NAIVE BAYES with 10-fold cross validation
hi there!! i am trying to implement the code of the e1071 package for naive bayes, but it doens't really work, any ideas?? i am very glad about any help!! i need a naive bayes with 10-fold cross validation: code: library(e1071) model <- naiveBayes(code ~ ., mydata) tune.control <- tune.control(random = FALSE, nrepeat = 1, repeat.aggregate = min, sampling = c("cross"),
2018 May 31
2
predicciones sobre el OOB de randomForest
Gracias Carlos. No uso caret, pero lo miraré. Quoting Carlos Ortega <cof en qualityexcellence.es>: > Hola, > > Creo que si utilizas "caret" y en la función "trainControl()" defines "oob" > como criterio de randomización, puedes luego recuperar del objeto del > modelo, las predicciones individuales... > > Saludos, > Carlos Ortega > www.qualityexcellence.es > > > > 2018-05-31 12:56 GMT+02:00 Manuel Mendoza <mmendoza en...
2013 Nov 06
1
R help-classification accuracy of DFA and RF using caret
...lling to help me? Thanks, Robin http://www.epa.gov/wed/pages/models/rivpacs/rivpacs.htm > TrainDataDFAgrps2 <-predcal > TrainClassesDFAgrps2 <-grp.2; > DFAgrps2Fit1 <- train(TrainDataDFAgrps2, TrainClassesDFAgrps2, + method = "lda", + tuneLength = 10, + trControl = trainControl(method = "cv")); Error in train.default(TrainDataDFAgrps2, TrainClassesDFAgrps2, method = "lda", : wrong model type for regression > RFgrps2Fit1 <- train(TrainDataRFgrps2, TrainClassesRFgrps2, + method = "rf", + tuneLength = 10, + trControl = trainControl(me...
2009 Jun 30
2
NaiveBayes fails with one input variable (caret and klarR packages)
...t; cY<-factor(mnY); > d <- data.frame (cbind(mnX,cY)); > m<-NaiveBayes(cY~mnX, data=d); > predict(m); Error in as.vector(x, mode) : invalid argument 'mode' > library(caret); Loading required package: lattice > mCaret<-train(mnX,cY,method="nb",trControl = trainControl(method = "cv", number = 10)); Loading required package: class Fitting: usekernel=TRUE Fitting: usekernel=FALSE > predicted <- predict(mCaret, newdata=mnX); Error in 1:nrow(newdata) : NA/NaN argument > We use caret to call NaiveBayes and we don't have any error messages in ca...
2013 Nov 15
1
Inconsistent results between caret+kernlab versions
...y much! ### To replicate: require(repmis) # For downloading from https df <- source_data('https://dl.dropboxusercontent.com/u/47973221/data.csv', sep=',') require(caret) svm.m1 <- train(df[,-1],df[,1],method='svmRadial',metric='Kappa',tunelength=5,trControl=trainControl(method='repeatedcv', number=10, repeats=10, classProbs=TRUE)) svm.m1 sessionInfo() ### Results - R2.15.2 > svm.m1 1241 samples 7 predictors 10 classes: ?O27479?, ?O31403?, ?O32057?, ?O32059?, ?O32060?, ?O32078?, ?O32089?, ?O32663?, ?O32668?, ?O32676? No pre-processing Resampling...
2010 Apr 06
1
Caret package and lasso
...have used following code but everytime I encounter a problem of not having coefficients for all the variables in the predictor set. # code rm(list=ls()) library(caret) # generating response and design matrix X<-matrix(rnorm(50*100),nrow=50) y<-rnorm(50*1) # Applying caret package con<-trainControl(method="cv",number=10) data<-NULL data<- train(X,y, "lasso", metric="RMSE",tuneLength = 10, trControl = con) coefs<-predict(data$finalModel,s=data$bestTune$.fraction, type ="coefficients", mode ="fraction")$coef coefs *This is the output...