import numpy import mlprec # load data datafile = "time_reber.dat" data = numpy.loadtxt(datafile,delimiter=' ') if numpy.rank(data) == 1: data = numpy.reshape(data, (numpy.shape(data)[0], 1)) num_data = numpy.shape(data)[0] dim_in = numpy.shape(data)[1] print "num_data=%d dim_in=%d" % (num_data, dim_in) # data -= numpy.mean(data) inputs = numpy.array(data) targets = numpy.array(data) p = mlprec.mlp(inputs,targets, 5, 1.0, 0.8, "softmax") for rep in range(100): p.mlptrain(inputs,targets,0.0025,100) if dim_in == 1: p.mlpplot(inputs,targets,100) else: p.mlpplotreber(inputs,targets)