views:

117

answers:

1

Hello,

I am porting some C code involving an artificial neural network to Java. I have decided to use the Encog framework.

I would like my network to have a bias neuron (which uses weighted synapses and always outputs 1.0) connected to hidden layers and the output layer; they are marked with green in this graph.

How can I create such a network programmatically? Should every bias neuron have its own layer? I have tried to instantiate a BasicLayer for every bias neuron, but this does not seem to have any effect even though the layer is connected via a WeightedSynapse.

Thank you,

Martin Wiboe

+1  A: 

OKay, I know this one! I am one of the primary Encog developers. :)

We enhanced support for that in Encog 2.4(which is in beta), however even the current version supports this. In Encog 2.3 bias is called threshold. So create your layers specifying that you WANT threshold values. Basically this creates the bias inputs for each of the layers that you specify having threshold values on. I build it all into the same layer because it improves performance, it all works out the same.

We actually had a discussion about this, and we are making it clearer in Encog 2.4. You can read the discussion here.

http://www.heatonresearch.com/node/1477

JeffHeaton