R中的神经网络包 - 如何在训练收敛之前获得权重?

Raf*_*eta 7 r neural-network

我想绘制一条学习曲线,以了解神经网络在训练过程中的进展情况.水平轴是迭代的总数,垂直轴表示错误率.随着网络培训的进展,我希望看到测试和训练集错误率.

nn <- neuralnet(f, 
            data = train, 
            hidden = 2, 
            linear.output = F, 
            threshold = 0.01,
            stepmax = 10,
            lifesign = "full",
            learningrate = .1,
            algorithm='backprop')
Run Code Online (Sandbox Code Playgroud)

通过设置stepmax = 10(或50或?),我希望能够在收敛之前检查网络,查看测试和训练集的错误率,然后继续训练另外10个步骤.(部分)训练的神经网络命名为nn,我计划将startweights设置为在中断训练中获得的权重,如下所示:

# Try to further train alerady trained net
nn <- neuralnet(f, 
            data = train, 
            hidden = 2, 
            linear.output = F, 
            threshold = 0.01,
            lifesign = "full",
            learningrate = .1,
            startweights = nn$weights,
            algorithm='backprop')
Run Code Online (Sandbox Code Playgroud)

然而,训练发出警告,"算法在stepmax中的1次重复中没有收敛".我没想到会收敛,但是那10个完成的训练步骤应该修改了最初的随机权重.唉,nn $ weights是NULL.

有没有人知道使用神经网络实现这一目标的方法?

Raf*_*eta 6

我直接写信给神经网络包的一位作者Frauke Guenther,并得到了他的明确答案:

"目前不幸的是,只有在网络融合时才会存储经过训练的权重.在训练过程中,如果网络没有收敛,你还可以访问权重."