I have the following simple example Rmarkdown
document (test.Rmd):
---
title: "Test Knit Caret Paralell VerboseIter"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
require(caret)
require(doParallel)
```
## data
```{r data}
set.seed(998)
training <- twoClassSim()
```
## model
```{r fitmodel}
fitControl <- trainControl(
method = "repeatedcv",
number = 3,
repeats = 2,
verboseIter = T)
ncores <- detectCores()-1
cl <<- makePSOCKcluster(ncores, verbose = TRUE, outfile = "")
registerDoParallel(cl)
set.seed(825)
Fit <- train(Class ~ .,
data = training,
method = "nnet",
trControl = fitControl,
trace = FALSE
)
stopCluster(cl)
registerDoSEQ()
```
## results
```{r results}
Fit
```
I have several options to run this code or knit the document
- Use 'Run all chuncks' in Rstudio
- Use
Knit
button in Rstudio Knit
document withrender("test.Rmd")
The following happens
- No info gets printed in output or console on iterations
- Info gets printed in the
R markdown
panel - No info gets printed in console
In the project I work on I want to knit
the document with different parameters, so I want to use the last option. However I also want to see the progress on fitting the model. Therefor I want to use option 3.
How can I get the info of the iterations printed in console when the documents are rendered?
This is the expected output I want to see:
+ Fold1.Rep1: size=1, decay=0e+00
+ Fold1.Rep1: size=3, decay=0e+00
+ Fold1.Rep1: size=5, decay=0e+00
- Fold1.Rep1: size=1, decay=0e+00
+ Fold1.Rep1: size=1, decay=1e-01
- Fold1.Rep1: size=3, decay=0e+00
+ Fold1.Rep1: size=3, decay=1e-01
- Fold1.Rep1: size=5, decay=0e+00
+ Fold1.Rep1: size=5, decay=1e-01
- Fold1.Rep1: size=1, decay=1e-01
+ Fold1.Rep1: size=1, decay=1e-04
- Fold1.Rep1: size=3, decay=1e-01
+ Fold1.Rep1: size=3, decay=1e-04
- Fold1.Rep1: size=1, decay=1e-04
etc.