我在用python和pybrain构建神经网络。不幸的是,我的样本非常大,当程序打印出训练中的错误时,我的记忆在程序完成之前就已经满了。在
有没有办法不打印函数中的错误?在
!!!!这不是python错误。这是大脑功能。它打印了预测值与实际样本的差异。例如“错误:0.00424”。在
每次进行预测时,它都会打印这个字符串。在
这是我的密码
ds = SupervisedDataSet(1, 1)
ds.addSample(x,y) <--- in a "for" to add all my sample
net = FeedForwardNetwork()
inp = LinearLayer(1)
h1 = SigmoidLayer(1)
outp = LinearLayer(1)
net.addOutputModule(outp)
net.addInputModule(inp)
net.addModule(h1)
net.addConnection(FullConnection(inp, h1))
net.addConnection(FullConnection(h1, outp))
net.sortModules()
trainer = BackpropTrainer(net, ds)
trainer.trainOnDataset(ds) ###
trainer.testOnData(verbose=True)### Here is where the function print the errors
net.activate((ind,))
可以使用try/except,如下所示:
或者你可以找到错误的来源。你能给你的问题加上错误吗?在
相关问题 更多 >
编程相关推荐