简体   繁体   English

如何计算或监控pybrain神经网络的训练?

[英]How can I calculate or monitor the training of a neural network in pybrain?

I have a neural network n pybrain,with two inputs,a hidden layer and a output layer.I use the following to train: 我有一个神经网络n pybrain,有两个输入,一个隐藏层和一个输出层。我使用以下内容进行训练:

trainer = BackpropTrainer(net,ds)
trainer.trainUntilConvergence()

net is the neural network and ds is the train data. net是神经网络,ds是列车数据。

My question is if and how I can calculate the time needed to complete the training or how can I monitor the progress of the training.Thanks. 我的问题是我是否以及如何计算完成培训所需的时间,或者如何监控培训的进度。谢谢。

You could always subclass BackpropTrainer (source code here ) and override trainUntilConvergence if using maxEpochs , track the percentage of completeness using the ratio between epochs and epochs. 你总是可以继承BackpropTrainer (源代码在这里 ),并覆盖trainUntilConvergence如果使用maxEpochs ,使用追踪时代和时代之间的比例完整性的百分比。

If not using maxEpochs you could always make an educated guess of the number of epochs remaining based on the average rate of change in the validationerrors and the size of continueEpochs . 如果不使用maxEpochs您总是可以根据验证错误的平均变化率和continueEpochs的大小,对剩余的时期数进行有根据的猜测。 Or merely just examine the rate of change in validationerrors. 或者只是检查验证错误的变化率。 If you wanted to map epochs to time you would have to profile the time of each epoch and store them. 如果您想要将时期映射到时间,则必须分析每个时期的时间并存储它们。

Nothing to add to the previous comment except for the code I use for it: 除了我用于它的代码之外,没有什么可以添加到上一个注释中:

maxepochs=20
results=[]
for i in range(len(maxepochs)):
    aux = trainer.train()
    results.extend(aux)
    plt.figure()
    plt.scatter(range(len(results[0])),results[0])
    plt.draw()

You would get a new plot at every cycle. 你会在每个周期得到一个新的情节。 Is not very nice, but it works for me. 不是很好,但它对我有用。

Hope I'd help you 希望我能帮到你

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM