i=0
noofclasses = 2
alldata = ClassificationDataSet(400, 1, noofclasses)
while i<len(data):
alldata.addSample(data[i],labels[i])
i=i+1
tstdata_temp, trndata_temp = alldata.splitWithProportion( 10 )
tstdata = ClassificationDataSet(400, 1, noofclasses)
for n in xrange(0, tstdata_temp.getLength()):
tstdata.addSample( tstdata_temp.getSample(n)[0], tstdata_temp.getSample(n)[1] )
trndata = ClassificationDataSet(400, 1, noofclasses)
for n in xrange(0, trndata_temp.getLength()):
trndata.addSample( trndata_temp.getSample(n)[0], trndata_temp.getSample(n)[1] )
trndata._convertToOneOfMany( )
tstdata._convertToOneOfMany( )
fnn = buildNetwork( trndata.indim, 10, trndata.outdim, outclass=SoftmaxLayer )
trainer = BackpropTrainer( fnn, dataset=trndata, momentum=0.1, verbose=True, weightdecay=0.01)
trainer.trainEpochs( 20 )
我试着增加时代的数量和隐藏的数量神经元。还是准确度没有提高。”“数据”是400维(像素值为20x20图像),标签如下所示: [0,0,0,….1,1,1]
抱歉,加上偏差项后,准确度还不错。在
fnn=构建网络(trnda.indim公司,10岁,trnda.outdim公司,bias=True,outclass=SoftmaxLayer)
相关问题 更多 >
编程相关推荐