在rmarkdown中绘制神经网络

时间:2018-09-24 19:17:30

标签: r rstudio r-markdown

我正在使用Neuronet软件包来训练神经网络。我使用的是rmarkdown html格式,但是在打印时不显示绘图。

---
title: "neuralnet"
author: "RED"
date: "`r Sys.Date()`"
output: 
  html_document: 
    toc: yes
---

```{r}
library(neuralnet)
data(infert, package="datasets")
net.infert <- neuralnet(case~parity+induced+spontaneous, infert, 
                    err.fct="ce", linear.output=FALSE, likelihood=TRUE)
```

```{r}
plot(net.infert)
```

任何想法如何解决此问题。

1 个答案:

答案 0 :(得分:1)

rep="best"添加到plot命令中。如果不这样做,plot.nn会不断地opening new graphics devices来绘制每个训练纪元

---
title: "neuralnet"
author: "RED"
date: "`r Sys.Date()`"
output: 
  html_document: 
    toc: yes
---

```{r}
library(neuralnet)
data(infert, package="datasets")
net.infert <- neuralnet(case~parity+induced+spontaneous, infert, 
                    err.fct="ce", linear.output=FALSE, likelihood=TRUE)
```

```{r}
plot(net.infert, rep="best")
```