Brian,

This is all outlined in the package documentation. The final model is fit
automatically. For example, using 'verboseIter' provides details. From
?train

> knnFit1 <- train(TrainData, TrainClasses,

+                  method = "knn",

+                  preProcess = c("center", "scale"),

+                  tuneLength = 10,

+                  trControl = trainControl(method = "cv", verboseIter =
TRUE))

+ Fold01: k= 5

- Fold01: k= 5

+ Fold01: k= 7

- Fold01: k= 7

+ Fold01: k= 9

- Fold01: k= 9

+ Fold01: k=11

- Fold01: k=11

<snip>

+ Fold10: k=17

- Fold10: k=17

+ Fold10: k=19

- Fold10: k=19

+ Fold10: k=21

- Fold10: k=21

+ Fold10: k=23

- Fold10: k=23

Aggregating results

Selecting tuning parameters

Fitting model on full training set


Max


On Fri, Nov 23, 2012 at 5:52 PM, Brian Feeny <bfeeny@mac.com> wrote:

>
> 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 =
> 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,
>                method="svmRadial",
>                tuneGrid = expand.grid(.sigma=0.0118,.C=64),
>                trControl=MyTrainControl,
>                fit = FALSE
> )
>
> This is what I have been doing but I am new to caret and want to make sure
> I am doing this correctly.
>
> Brian
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 

Max

	[[alternative HTML version deleted]]


