在rmarkdown中绘制神经网络

3

我正在使用neuralnet包来训练神经网络。我正在使用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
可能是Knitr和绘制神经网络的重复问题。 - Werner
1个回答

5
plot命令中添加rep="best"。如果不这样做,plot.nn会通过不断打开新的图形设备来绘制每个训练时期
---
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")
```

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接