How to make a not fully connected graph in Keras? I am trying to make a network with some nodes in input layer that are not connected to the hidden layer but to the output layer. Is there any way to do this easily in Keras? Thanks!
“ - The output layer is the final layer in the neural network where desired predictions are obtained. There is one output layer in a neural network that produces the desired final prediction. It has its own set of weights and biases that are applied before the final output is derived.
Input layer should contain 387 nodes for each of the features. Output layer should contain 3 nodes for each class. Hidden layers I find gradually decreasing the number with neurons within each layer works quite well (this list of tips and tricks agrees with this when creating autoencoders for compression tasks).
Yes, this is possible. The easiest way to do this is to specify two inputs:
in_1 = Input(...)
in_2 = Input(...)
hidden = Dense(...)(in_1)
# combine secondary inputs and hidden outputs
in_2_and_hidden = merge([in_2, hidden], mode='concat')
# feed combined vector to output
output = Dense(...)(in_2_and_hidden)
The documentation is better at explaining what merge
does in detail. The general idea of multiple inputs and the functional model can be read here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With