numpy - Pybrain regression is not converging to reasonable values -


i beginner pybrain (and new ann's), familiarize using pybrain have tried train on sin function. outputs have been making little sense --- each data point output of 0, -0, or fixed real number ( in example below real number). indicates me not training correctly.

i have been trying train creating dataset 1 input , 1 output via superviseddataset(1,1) , training using backproptrainer(). have read pybrain documentation extensively , rather sparse , examples not great. input integer in range (0,1000) , output/targets sin of integer multiplied constant (so evaluates between 0 , 2pi). code below:

def add_samples():      ds = superviseddataset(1,1)      j in  range(0,1000):             ds.addsample(j,math.sin((j*math.pi)/500))      print ds     return ds  def feedforward():     n= feedforwardnetwork()      #construct input, hiddent, , output layers     inlayer=linearlayer(1)     hiddenlayer = sigmoidlayer(3)     outlayer=linearlayer(1)       # add layers network     n.addinputmodule(inlayer)     n.addmodule(hiddenlayer)     n.addoutputmodule(outlayer)      # make connections between layers     in_to_hidden = fullconnection(inlayer, hiddenlayer)     hidden_to_out = fullconnection(hiddenlayer, outlayer)      # explicitly adding connections network     n.addconnection(in_to_hidden)     n.addconnection(hidden_to_out)      # internal organization     n.sortmodules()     print n     return n def backprop():     n=feedforward()     ds=add_samples()      trainer = backproptrainer(n, ds)     trainer.trainondataset(ds,100)     trainer.testondata(verbose=true)    def main():     backprop()  if __name__ == '__main__':     main() 

my outputs this:

  error:  0.00084029   out:     [0.016 ]   correct: [-0.019]   error:  0.00060250   out:     [0.016 ]   correct: [-0.013]   error:  0.00040415   out:     [0.016 ]   correct: [-0.006]   error:  0.00024526 

all 1000 outputs evaluated 0.016. have suggestions or can point me example ? have been spinning in circle awhile. i'd imagine missing trivial or there fundamental concept ann's or machine learning in general missing. please let me know if if provide more information. thanks!


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -