0
$\begingroup$

I have always been using the sequential model for deep learning and Convolution Neural Networks, image classification and prediction. But I am not getting good accuracy everytime. Should I use the functional API? Will it do any good?

$\endgroup$
1
  • $\begingroup$ You can still reach SOTA results with the Sequential API. There are so many hyperparameters to tweak in a classical CNN to work on that for months (if not more). Could you please exaplain your problem, your data, what you tried so far, and what outcomes you got? $\endgroup$
    – Leevo
    Commented May 11, 2020 at 7:53

1 Answer 1

1
$\begingroup$

Sequential API is simpler to write and to read. Functional API on the other hand gives you more freedom in the implementation of the ANN architecture. More specifically, Functional API is what you need when the layers of your Networks do not form a simple concatenation or sequence (i.e. the first sends a signal to the second, that sends a signal to the third, and so on...). Sometimes more complex things are needed.

I'll make you a personal example: in my current DS project I am building a seq2seq Neural Network that has two Encoders: one is LSTM, the other is Convolutional. These two blocks process the same input signal, then their outputs are concatenated and fed to a Decoder that is LSTM + Dense. In this case, the whole model cannot be defined as a simple, linear concatenation of layers. You need to link different layers in a less "linear" way. This could be done exclusively with a functional API.

In computer vision, Residual Networks (ResNet) are the main example of the need for a non-sequential API, because the way the signal traverses the network is not simple and sequential (no pun intended) as in classical CNNs.

That said, coming to your question:

I am not getting good accuracy everytime. Should I use the functional API? Will it do any good?

You can still reach SOTA results with the Sequential API. There are so many hyperparameters to tweak in a classical CNN to work on that for months (if not more). Could you please exaplain your problem, your data, what you tried so far, and what outcomes you got?

$\endgroup$

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.