Displaying 17 results from an estimated 17 matches for "tunelength".
Did you mean:
linelength
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='nnet',trCon...
2013 Nov 06
1
R help-classification accuracy of DFA and RF using caret
...for help. Would someone 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 =...
2010 Apr 06
1
Caret package and lasso
...r 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 which I got :*
you can see some of the predictors are missing like V4, V6, V7
V1 V2 V3...
2011 Aug 28
1
Trying to extract probabilities in CARET (caret) package with a glmStepAIC model
...time 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 = "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
))
Thanks,
James...
2011 Jan 24
5
Train error:: subscript out of bonds
...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]<-tune_best[[1]]
}
--
View this message in context:...
2013 Feb 12
1
caret: Errors with createGrid for rf (randomForest)
...;)
## data needed for SVM with RBF:
## Not run:
tmp <- iris
names(tmp)[5] <- ".outcome"
head(tmp)
createGrid("svmRadial", data = tmp, len = 4)
## End(Not run)
What I am doing wrong?
Also, what is the connection between len above and tuneLength in the
argument for train?
Thanks,
James
[[alternative HTML version deleted]]
2011 Jun 22
1
caret's Kappa for categorical resampling
...tation. The data is about 20,000 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.0011...
2010 Mar 23
1
caret package, how can I deal with RFE+SVM wrong message?
...n I
do? I have try RFE+SVM, also wrong message:> set.seed(1)
> svmProfile<-rfe(trx,try,sizes=c(1:3),
+ rfeControl=rfeControl(functions=caretFuncs,method="cv",
+ verbose=F,returnResamp="final",number=10),
+ method="svmRadial",tuneLength=5)
Fitting: sigma=0.009246713, C=0.1
Fitting: sigma=0.009246713, C=1
Fitting: sigma=0.009246713, C=10
Fitting: sigma=0.009246713, C=100
Fitting: sigma=0.009246713, C=1000
Error in rfeControl$functions$rank(fitObject, .x, y) :
need importance columns for each class
thank you!
--
View this...
2013 Feb 07
4
Sourcing my file does not print command outputs
I looked at the documentation of source() and summary(), and I could not
find the reason why calling something like:
> summary(resamps)
from the command line, works (it prints the summary)
whereas calling
summary(resampls)
from a file that I source with source("my_file.r") does not print anything.
How can I get summary(resamps) to print when I source a file with this
command?
2012 Nov 29
1
Help with this error "kernlab class probability calculations failed; returning NAs"
...method = "repeatedcv",
number=10,
repeats=5,
returnResamp = "all",
classProbs = TRUE
)
## MODEL
rbfSVM <- train(outcome~., data = trainset,
method="svmRadial",
preProc = c("scale"),
tuneLength = 10,
trControl=MyTrainControl,
fit = FALSE
)
There were 50 or more warnings (use warnings() to see the first 50)
> warnings()
Warning messages:
1: In train.default(x, y, weights = w, ...) :
At least one of the class levels are not valid R variables names; This m...
2013 Feb 07
0
FW: Sourcing my file does not print command outputs
...#39;))
#Create bootstrap samples for fitting models
library(caret)
print("Creating bootstrap samples")
tmp <- createResample(Y,times = 25)
myCtrl <- trainControl(method = "boot", index = tmp, timingSamps = 10)
RFmodel <- train(X,Y,method='rf',trControl=myCtrl,tuneLength=1)
NNmodel <- train(X,Y,method='nnet',trControl=myCtrl,tuneLength=3, trace = FALSE)
## GLMnet = GLMmodel,
...
#Assess re-sampled (out of sample) accuracy
print("Assessing re-sampled (OOB) accuracy")
resamps <- resamples(
list( RF = RFmodel,...
2013 Nov 15
1
Inconsistent results between caret+kernlab versions
...ht on this?
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...
2010 Jan 25
0
glmnet in caret packge
...I want to train my model with LASSO using caret package
(glmnet). So, in glmnet, there are two parameters, alpha and lambda. How can
I fix my alpha=1 to get a lasso model?
con<-trainControl(method="cv",number=10)
model <- train(X, y, "glmnet", metric="RMSE",tuneLength = 10, trControl =
con)
Thanks
Alex Roy
[[alternative HTML version deleted]]
2011 May 28
0
how to train ksvm with spectral kernel (kernlab) in caret?
...)
library(kernlab)
data(iris)
TrainData<- iris[,1:4]
TrainClasses<- iris[,5]
set.seed(2)
fitControl$summaryFunction<- Rand
svmNew<- train(TrainData, TrainClasses,
method = "svmRadial",
preProcess = c("center", "scale"),
metric = "cRand",
tuneLength = 4)
svmNew
-------------------
here is an example on how to train the
ksvm with spectral kernel
-------------------
# Load the data
data(reuters)
y <- rlabels
x <- reuters
sk <- stringdot(type="spectrum", length=4, normalized=TRUE)
svp <- ksvm(x,y,kernel=sk,scale=c(),cros...
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 =
2010 Mar 24
0
R-help ordinal regression
...essage:>
> set.seed(1)
> > svmProfile<-rfe(trx,try,sizes=c(1:3),
> +? ? ? ? ?
> ???rfeControl=rfeControl(functions=caretFuncs,method="cv",
> +? ? ? ? ?
> ???verbose=F,returnResamp="final",number=10),
> +? ? ? ? ?
> ???method="svmRadial",tuneLength=5)
> Fitting: sigma=0.009246713, C=0.1
> Fitting: sigma=0.009246713, C=1
> Fitting: sigma=0.009246713, C=10
> Fitting: sigma=0.009246713, C=100
> Fitting: sigma=0.009246713, C=1000
> Error in rfeControl$functions$rank(fitObject, .x, y) :
> ? need importance columns for ea...