python,neurolab,逐步训练

python,neurolab,逐步训练,python,neural-network,Python,Neural Network,给一个来自neurolab的安 net = nl.net.newff([[0.0, 1.0]] * 5, [2]) 我想迭代地训练它,每K个时期执行一次验证检查 尽管net.train()接受纪元作为参数,但它的用法对我来说非常奇怪。 不知何故,它存储了最后一个历元(在网络实例上?),因此以下内容将在“已达到最大nr列车历元”时失败,并且不会继续进行培训 for k in xrange(10): net.train(training, target, epochs=1) ...

给一个来自neurolab的安

net = nl.net.newff([[0.0, 1.0]] * 5, [2])
我想迭代地训练它,每K个时期执行一次验证检查

尽管net.train()接受纪元作为参数,但它的用法对我来说非常奇怪。 不知何故,它存储了最后一个历元(在网络实例上?),因此以下内容将在“已达到最大nr列车历元”时失败,并且不会继续进行培训

for k in xrange(10):
    net.train(training, target, epochs=1)
    ...do some checks
下面的方法可以工作,但它暴露了计算开销,因为每次都是从头开始

for k in xrange(10):
    net.train(training, target, epochs=k)
    ...do some checks
我错过了什么?:)

#首先
以nl形式导入neurolab
#然后
代表=10
i=0
#输入数
numIN=5
#每层神经元的数量
cap1=12
cap2=5
#产出数量
out=5
#创建网络
net=nl.net.newff([-1,1]]*numIN[cap1,cap2,out])

当我找到答案的时候?我也对循序渐进/现场学习感兴趣。。。
#first
import neurolab as nl
#then
rep=10
i=0
#Number of inputs
numIN=5
#Number of neurons per layer
cap1=12
cap2=5
#Number of outputs
out=5
#create network
net = nl.net.newff([[-1, 1]]*numIN,[cap1,cap2,out])
while i<rep:
# I use train_bfgs is faster
#entradasu are the inputs and targetsu are the targets of your data
#then the network is adjusted in each iteration
    error = nl.train.train_bfgs(net,entradasu, targetsu, epochs=1, show=0, goal=0.001)
#then do some checks
    if checks==True:
        i=rep
    else
        i+=1