networking - Making a graphic of a trained dataset python -


y1 = [] y2 = [] x = [] in range(40):     #fer dos llistes (error y epoch) y despres fer un plot     trainer.trainepochs( 1 )     trnresult = percenterror( trainer.testonclassdata(),trndata['class'] )     tstresult = percenterror( trainer.testonclassdata(dataset=tstdata ),tstdata['class'] )      print "epoch: %4d" % trainer.totalepochs, \           "  train error: %5.2f%%" % trnresult, \           "  test error: %5.2f%%" % tstresult      if i==1:         g=gnuplot.gnuplot()     else:         y1 = y1.append(float(trnresult))         y2 = y2.append(float(tstresult))         x = x.append(i) d1=gnuplot.data(x,y1,with_="line") d2=gnuplot.data(x,y2,with_="line") g.plot(d1,d2) 

hi everyone, first time post here, work.

ok, i´m working neural networks (multi-layer preceptron) , i´m testing uci ml repository, have make graphical display of error versus number of epochs, have no idea i´m doing wrong, error got:

y1 = y1.append(float(trnresult)) attributeerror: 'nonetype' object has no attribute 'append' 

i´ve tryed int , float @ y1.append() got same errors. on console:

number of training patterns:  233  input , output dimensions:  6 2  first sample (input, target, class):  [ 63.03  22.55  39.61  40.48  98.67  -0.25] [1 0] [ 0.]  total error: 0.110573541007  epoch:    1   train error: 33.05%   test error: 29.87%  total error: 0.0953749484982  epoch:    2   train error: 32.19%   test error: 35.06%  total error: 0.0977600868845  epoch:    3   train error: 27.90%   test error: 29.87%  traceback (most recent call last):   file "c:\python\practice\dataset.py", line 79, in <module>     y1 = y1.append(float(trnresult)) attributeerror: 'nonetype' object has no attribute 'append' 

thanks.

the append() function on list not return value. therefore y1 replaced none. should y1.append() , y2.append() without assigning y1 , y2.

more specifically

>>> = [] >>> b = a.append(1) >>> b none true >>> [1] >>> a.append(2) >>> [1, 2] 

if want, can use + operator on lists (note [] around 3):

>>> = + [3] >>> [1, 2, 3] 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -