title: How to fit cubic equation on pybrain
body: <p>I am trying to fit a Neural Network on a cubic Equation, but after many tries changing the number of the neurons on the hidden layer and increasing the number of epochs I could only get this: 
  <a href="https://i.stack.imgur.com/xkwpA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xkwpA.png" alt="enter image description here"></a> </p>
  
  <p>Could you guys help me on this?</p>
  
  <pre><code>from pybrain.datasets import SupervisedDataSet
  from pybrain.tools.shortcuts import buildNetwork
  from pybrain.structure import TanhLayer
  from pybrain.supervised.trainers import BackpropTrainer
  import pandas as pd
  import numpy as np
  import matplotlib.pyplot as plt
  #Preparing Data
  dataset = pd.read_csv("C:\Users\gugub\Documents\projects\Cyrus\graph.data", header = None)
  darray = np.array(dataset)
  x = []
  y = []
  ds = SupervisedDataSet(1,1)
  #Preparing True inputs and True Outputs
  for i in range(43):
      e1 = darray[i,0]
      s1 = darray[i,1]
      x.append(e1)
      y.append(s1)
  print(x)
  print(y)
  ds = SupervisedDataSet(1,1)
  
  i = 0
  for i in range(43):
      ds.addSample(x[i],y[i])
  print(ds)
  net = buildNetwork(ds.indim,30,ds.outdim,recurrent=True)
  trainer = BackpropTrainer(net,learningrate=0.01,verbose=True)
  
  trainer.trainOnDataset(ds,20000)
  trainer.testOnData(verbose=True)
  
  y1 = []
  
  i = 0
  for i in x:
      y1.append(net.activate(i))
  
  plt.plot(x,y,'r')
  plt.plot(x,y1,'b')
  plt.show()
  
  while True:
      e2 = int(raw_input("&gt;"))
      s2 = [e2]
      print(net.activate(s2))
  </code></pre>
  
  <p>P.S The red line on the graph is what it should be and the blue one is the function generated by my network</p>