Python/Pybrain: How can I fix weights of a neural network during training?

602 views Asked by At

I am quite new to neural networks and trying to use pybrain to build and train a network.

I am building my network manually with full connections between all layers (input, two hidden layers, output) and then set some weights to zero using _SetParameters as I don't want connections between some specific nodes.

My problem is that the weights that are zero at the beginning are adapted in the same way as all other weights and therefore no more zero after training the network via backprop. How can I force the "zero-weights" to stay zero through the whole process?

Thanks a lot for your answers. Fiona

2

There are 2 answers

0
cybergla On BEST ANSWER

Looks like you'll have to use the Connections module to create your network with the specific connections between nodes. Use the inSliceFrom and outSliceFrom parameters. See this StackOverflow answer for more details.

0
Niv Cohen On

I am struggling with a similar problem.

So far I am using net._setParameters command to fix the weights after each training step, but there should be a better answer..

It might help for the meantime, I am waiting for the better answer as well :-)