2
$\begingroup$

I'm new to using the keras framework. I have read some examples about how to construct deep learning models with the Sequential and Graph classes in keras. However, I see that, independently if I use Sequential or Graph, it is assumed that each hidden unit of a layer is fully connected with all the hidden units of the other layer, isn't it?

If I want to construct a deep feed forward network that it is not fully connected, for instance the first hidden unit of the second layer is not connected to the second unit of the third layer...etc, even I want add connections (skip connections) between hidden units that belong to non-consecutive layers, how can I implement this in keras?

$\endgroup$

2 Answers 2

1
$\begingroup$

A possible solution can be found at https://stackoverflow.com/questions/48111217/how-implement-a-feed-forward-network-with-arbitrary-node-connections-in-keras?noredirect=1#comment83198128_48111217

"The suggestion is simply work with many little layers and make as many skip connections as you want. Many parallel layers with 1 node represent well a single layer with many nodes. So you can, for instance, create lots of Dense(1) layers and treat them as nodes. Then you connect them in any way you like."

$\endgroup$
0
$\begingroup$

You probably want to use the functional API.

Functional API has a lot of examples you can follow and used whenever you need to build more complicated models.

$\endgroup$
1
  • $\begingroup$ The examples of the Funtional API of keras are very interesting, but they did not response my question. I want construct a partially connected feed forward network. I have replaced the term "node" by hidden unit in my original post. $\endgroup$ Commented Jan 5, 2018 at 18:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.