search for: trcontrol

Displaying 20 results from an estimated 33 matches for "trcontrol".

2013 Feb 19
0
CARET. Relationship between data splitting trainControl
...n caret (e.g. createDataPartition, createResample, createFolds and createMultiFolds) To better frame my questions, let me use the following example from the documentation: ************************************* data(BloodBrain) set.seed(1) tmp <- createDataPartition(logBBB,p = .8, times = 100) trControl = trainControl(method = "LGOCV", index = tmp) ctreeFit <- train(bbbDescr, logBBB, "ctree",trControl=trControl) ************************************* My questions are: 1) If I use createDataPartition (which I assume that does stratified bootstrapping), as in the above exampl...
2012 Nov 23
1
caret train and trainControl
...method = "cv", number=5, returnResamp = "all", classProbs = TRUE ) rbfSVM <- train(label~., data = trainset, method="svmRadial", tuneGrid = expand.grid(.sigma=c(0.0118),.C=c(8,16,32,64,128)), trControl=MyTrainControl, fit = FALSE ) Once this returns my ideal parameters, in this case Cost of 64, do I simply just re-run the whole process again, passing a grid only containing the specific parameters? like so? rbfSVM <- train(label~., data = trainset,...
2013 Feb 10
1
Training with very few positives
...=================== library(caret) tmp <- createDataPartition(Y, p = 9/10, times = 3, list = TRUE) myCtrl <- trainControl(method = "boot", index = tmp, timingSamps = 2, classProbs = TRUE, summaryFunction = twoClassSummary) RFmodel <- train(X,Y,method='rf',trControl=myCtrl,tuneLength=1, metric="ROC") SVMmodel <- train(X,Y,method='svmRadial',trControl=myCtrl,tuneLength=3, metric="ROC") KNNmodel <- train(X,Y,method='knn',trControl=myCtrl,tuneLength=10, metric="ROC") NNmodel <- train(X,Y,method=...
2012 Jul 12
1
Caret: Use timingSamps leads to error
...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 'Girth' not found Timing stopped at: 0 0 0.003 ---------------------------- As you can see, the model generation works without the timingSamps option but fa...
2011 Jan 24
5
Train error:: subscript out of bonds
...<-d[x,] train1<-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[...
2009 Jun 08
3
caret package
...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]]
2008 Sep 18
1
caret package: arguments passed to the classification or regression routine
...the train() 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" matche...
2012 May 15
1
caret: Error when using rpart and CV != LOOCV
...ormula, 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, method='rpart', trControl=tc) --- Thanks! -- Dominik Bruhn mailto: domin...
2013 Mar 02
2
caret pls model statistics
...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) dat.indices=seq(1,n) timematrix=with(training1, classvec2classmat(Species[dat.indices])) pls.dat=plsr(timematrix ~...
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"),
2010 Oct 22
2
Random Forest AUC
Guys, I used Random Forest with a couple of data sets I had to predict for binary response. In all the cases, the AUC of the training set is coming to be 1. Is this always the case with random forests? Can someone please clarify this? I have given a simple example, first using logistic regression and then using random forests to explain the problem. AUC of the random forest is coming out to be
2013 Nov 06
1
R help-classification accuracy of DFA and RF using caret
...omeone be willing 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 =...
2009 Jun 30
2
NaiveBayes fails with one input variable (caret and klarR packages)
...trix (Y); > 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...
2013 Nov 15
1
Inconsistent results between caret+kernlab versions
...Thanks very 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-processi...
2010 Apr 06
1
Caret package and lasso
...m(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 which I got :* you can see some of the predictors are missing like V4, V6, V7 V1 V2 V3 V5...
2011 Aug 28
1
Trying to extract probabilities in CARET (caret) package with a glmStepAIC model
...n 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 = "glmStepAIC",tuneLength = 4,trControl = fitControl) Thank you. Best regards, Jon Toledo, MD Postdoctoral fellow University of Pennsylvania School of Medicine Center for Neurodegenerative Disease Research 3600 Spruce Street 3rd Floor Maloney Building Philadelphia, Pa 19104 [[alternative HTML version deleted]]
2013 Feb 07
1
Saving model and other objects from caret
Say I train a model in caret, e.g.: RFmodel <- train(X,Y,method='rf',trControl=myCtrl,tuneLength=1) How can I save this to disk and load it later in R? How about an object of the class "resamples"? resamps <- resamples( list( RF = RFmodel, SVM = SVMmodel, KNN = KNNmodel, NN = NNmodel ))...
2011 May 12
2
Can ROC be used as a metric for optimal model selection for randomForest?
Dear all, I am using the "caret" Package for predictors selection with a randomForest model. The following is the train function: rfFit<- train(x=trainRatios, y=trainClass, method="rf", importance = TRUE, do.trace = 100, keep.inbag = TRUE, tuneGrid = grid, trControl=bootControl, scale = TRUE, metric = "ROC") I wanted to use ROC as the metric for variable selection. I know that this works with the logit model by making sure that classProbs = TRUE and summaryFunction = twoClassSummary in the trainControl function. However if I do the same with random...
2011 Jun 22
1
caret's Kappa for categorical resampling
...0 rows and a few dozen columns, and the categories are quite asymmetrical, 4.1% in one category and 95.9% in the other. When I train a ctree model as: model <- train(dat.dts, dat.dts.class, method='ctree', tuneLength=8, trControl=trainControl(number = 5, workers=1), metric='Kappa') I get the following puzzling numbers: mincriterion Accuracy Kappa Accuracy SD Kappa SD 0.01 0.961 0.0609 0.00151 0.0264 0.15 0.962 0.049 0.00116 0.0248 0.29...
2023 May 09
1
RandomForest tuning the parameters
...line the grid of parameters > > tunegrid <- expand.grid(.maxnodes=c(10,20,30,50), .ntree=c(100, 200, > 300)) > > set.seed(seed) > > > > # Train the model > > rf_gridsearch <- train(x=X_train_, y=y_train_, method=customRF, > metric=metric, tuneGrid=tunegrid, trControl=control) > > > > plot(rf_gridsearch) > > > > rf_gridsearch$bestTune > > > > ################################################# > > > > ______________________________________________ > > R-help at r-project.org mailing list -- To UNSUBSCRIBE and m...