Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple outputs in keras Sequential models

As I am reading the Keras Code for Sequential models I see that it only allows for a single output for any defined layer within the Sequential model. I am aware how to do this using the functional API (Model class).

However, I don't see why the Sequential model is limited to layers with a single output. Is there a design limitation for enforcing such constraint?

like image 683
Gerges Avatar asked Dec 08 '18 04:12

Gerges


People also ask

Can neural networks have multiple outputs?

Neural Networks for Multi-OutputsNeural network models also support multi-output regression and have the benefit of learning a continuous function that can model a more graceful relationship between changes in input and output.

What is multi-output model?

Multi-output classification is a type of machine learning that predicts multiple outputs simultaneously. In multi-output classification, the model will give two or more outputs after making any prediction. In other types of classifications, the model usually predicts only a single output.

What is the difference between sequential and model in Keras?

Sequential class : Sequential groups a linear stack of layers into a tf. keras. Model . Model class : Model group's layers into an object with training and inference features.

What is verbose in Keras?

verbose is the choice that how you want to see the output of your Nural Network while it's training. If you set verbose = 0, It will show nothing.


1 Answers

Not actually. Sequential model is here to make things simpler, when designing smaller and straight-forward Neural Networks. As noted here, they can be useful for most problems.

The Sequential API allows you to create models layer-by-layer for most problems. It is limited in that it does not allow you to create models that share layers or have multiple inputs or outputs.

But if you need more complex design, with multiple input/output as well as models that share layers, you can use the Functional API to achieve your goal.

like image 83
Reza Behzadpour Avatar answered Oct 28 '22 14:10

Reza Behzadpour