Displaying 20 results from an estimated 2000 matches similar to: "Choosing glmnet lambda values via caret"
2012 Feb 10
1
Custom caret metric based on prob-predictions/rankings
I'm 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
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 =
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 <-
2008 Sep 18
1
caret package: arguments passed to the classification or regression routine
Hi,
I am having problems passing arguments to method="gbm" using 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,
2009 Jul 12
1
Splitting dataset for Tuning Parameter with Cross Validation
Hi,
My question might be a little general.
I have a number of values to select for the complexity parameters in some classifier, e.g. the C and gamma in SVM with RBF kernel. The selection is based on which values give the smallest cross validation error.
I wonder if the randomized splitting of the available dataset into folds is done only once for all those choices for the parameter values, or
2013 Mar 06
1
CARET and NNET fail to train a model when the input is high dimensional
The following code fails to train a nnet model in a random dataset using
caret:
nR <- 700
nCol <- 2000
myCtrl <- trainControl(method="cv", number=3, preProcOptions=NULL,
classProbs = TRUE, summaryFunction = twoClassSummary)
trX <- data.frame(replicate(nR, rnorm(nCol)))
trY <- runif(1)*trX[,1]*trX[,2]^2+runif(1)*trX[,3]/trX[,4]
trY <-
2009 Jun 08
3
caret package
Hi all
I am using the caret package and having difficulty in obtaining the results
using regression, 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);
2012 May 30
1
caret() train based on cross validation - split dataset to keep sites together?
Hello all,
I have searched and have not yet identified a solution so now I am sending
this message. In short, I need to split my data into training, validation,
and testing subsets that keep all observations from the same sites together
? preferably as part of a cross validation procedure. Now for the longer
version. And I must confess that although my R skills are improving, they
are not so
2023 May 09
1
RandomForest tuning the parameters
Hi Sacha,
On second thought, perhaps this is more the direction that you want ...
X2 = cbind(X_train,y_train)
colnames(X2)[3] = "y"
regr2<-randomForest(y~x1+x2, data=X2,maxnodes=10, ntree=10)
regr
regr2
#Make prediction
predictions= predict(regr, X_test)
predictions2= predict(regr2, X_test)
HTH,
Eric
On Tue, May 9, 2023 at 6:40?AM Eric Berger <ericjberger at gmail.com>
2010 Jan 25
0
glmnet in caret packge
Dear all,
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
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
2010 Nov 22
1
Sporadic errors when training models using CARET
Hi. I am trying to construct a svmLinear model using the "caret" package
(see code below). Using the same data, without changing any setting,
sometimes it constructs the model successfully, and sometimes I get an index
out of bounds error. Is this unexpected behaviour? I would appreciate any
insights this issue.
Thanks.
~Kendric
> train.y
[1] S S S S R R R R R R R R R R R R R R R
2011 Aug 28
1
Trying to extract probabilities in CARET (caret) package with a glmStepAIC model
Dear developers,
I have jutst started working with caret and all the nice features it offers. But I just encountered a problem:
I am working 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
2012 May 15
1
caret: Error when using rpart and CV != LOOCV
Hy,
I got the following problem when trying to build a rpart model and using
everything but LOOCV. Originally, I wanted to used k-fold partitioning,
but every partitioning except LOOCV throws the following warning:
----
Warning message: In nominalTrainWorkflow(dat = trainData, info =
trainInfo, method = method, : There were missing values in resampled
performance measures.
-----
Below are some
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')
2013 Jun 11
1
Caret train with glmnet give me Error "arguments imply differing number of rows"
Hello,
I'm training a set of data with Caret package using an elastic net (glmnet).
Most of the time train works ok, but when the data set grows in size I get
the following error:
Error en { :
task 1 failed - "arguments imply differing number of rows: 9, 10"
and several warnings like this one:
1: In eval(expr, envir, enclos) :
model fit failed for Resample01
My call to train
2013 Mar 02
2
caret pls model statistics
Greetings,
I have been exploring the use of the caret package to conduct some plsda
modeling. Previously, I have come across methods that result in a R2 and
Q2 for the model. Using the 'iris' data set, I wanted to see if I could
accomplish this with the caret package. I use the following code:
library(caret)
data(iris)
#needed to convert to numeric in order to do regression
#I
2011 May 05
1
[caret package] [trainControl] supplying predefined partitions to train with cross validation
Hi all,
I run R 2.11.1 under ubuntu 10.10 and caret version 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
2009 Jun 30
2
NaiveBayes fails with one input variable (caret and klarR packages)
Hello,
We have a system which creates thousands of regression/classification models and in cases where we have only one input variable NaiveBayes throws an error. Maybe I am mistaken and I shouldn't expect to have a model with only one input variable.
We use R version 2.6.0 (2007-10-03). We use caret (v4.1.19), but have tested similar code with klaR (v.0.5.8), because caret relies on
2013 Nov 15
1
Inconsistent results between caret+kernlab versions
I'm using caret to assess classifier performance (and it's great!). However, I've found that my results differ between R2.* and R3.* - reported accuracies are reduced dramatically. I suspect that a code change to kernlab ksvm may be responsible (see version 5.16-24 here: http://cran.r-project.org/web/packages/caret/news.html). I get very different results between caret_5.15-61 +