title: PyBrain:How can I put specific weights in a neural network?
body: <p>I am trying to recreate a neural network based on given facts.It has 3 inputs,a hidden layer and an output.My problem is that the weights are also given,so I don't need to train.</p>
  
  <p>I was thinking maybe I could save the trainning of a similar in structure neural network and change the values accordingly.Do you think that will work?Any other ideas.Thanks.</p>
  
  <p>Neural Network Code:</p>
  
  <pre><code>    net = FeedForwardNetwork()
      inp = LinearLayer(3)
      h1 = SigmoidLayer(1)
      outp = LinearLayer(1)
  
      # add modules
      net.addOutputModule(outp)
      net.addInputModule(inp)
      net.addModule(h1)
  
      # create connections
      net.addConnection(FullConnection(inp, h1))
      net.addConnection(FullConnection(h1, outp))
  
      # finish up
      net.sortModules()
  
  
      trainer = BackpropTrainer(net, ds)
      trainer.trainUntilConvergence()
  </code></pre>
  
  <p>Save training and load code from <a href="https://stackoverflow.com/questions/6006187/how-to-save-and-recover-pybrain-traning">How to save and recover PyBrain training?</a></p>
  
  <pre><code># Using NetworkWriter
  
  from pybrain.tools.shortcuts import buildNetwork
  from pybrain.tools.xml.networkwriter import NetworkWriter
  from pybrain.tools.xml.networkreader import NetworkReader
  
  net = buildNetwork(2,4,1)
  
  NetworkWriter.writeToFile(net, 'filename.xml')
  net = NetworkReader.readFrom('filename.xml') 
  </code></pre>