I want to clear about keras neural network options for classification of simple data where there are a number of features and one target column, as in iris flower dataset (Species is target):

SL,  SW,  PL,  PW,  Species
5.1, 3.5, 1.4, 0.2, setosa
4.9, 3.0, 1.4, 0.2, setosa
4.7, 3.2, 1.3, 0.2, setosa

I am finding that in almost all examples various combinations of Dense layers Dropout are the only options:

model = Sequential()
model.add(Dense(12, input_dim=4, activation='relu'))
model.add(Dense(8, activation='relu'))
model.add(Dense(1, activation='softmax'))

What other keras layers can be used in such situations, especially if the data is large, say with 50K rows and 100 features?

Edit: My specific question is whether Dense and Dropout are the only kind of layers for this purpose and such data?


1 Answer 1


You may not be very familiar with deep learning. Each kind of network is used for a special kind of task, you cannot just stack LSTMs, GRUs, dense layers and other stuff without supervision. If you have a task that your patterns are local and they may be in multiple locations in an input pattern, you can employ convolutional layers for feature extraction and you can employ dense layers for classifying those extracted features. If you want to classify data which there is a kind of sequence in it, temporal data, you can employ LSTMs and GRUs and you can stack them for better accuracy and you can use their output and feed them to other networks based on your need. MLPs are good for learning non-linear mappings.

Dropout is used for avoiding overfitting.

  • $\begingroup$ Very good brief description for many layers. By "you can just stack LSTMs, GRUs, dense layers and other stuff without supervision", do you mean that these can be put in most situations and data? $\endgroup$
    – rnso
    Commented Sep 30, 2018 at 16:15
  • $\begingroup$ I missed the not. You CANNOT! $\endgroup$ Commented Sep 30, 2018 at 16:17
  • $\begingroup$ Which particular layers can I add to my network for this data in my question above? $\endgroup$
    – rnso
    Commented Sep 30, 2018 at 16:20
  • $\begingroup$ Increase the number of dense layers and employ dropout. Also increase the number of neurons in each layer. $\endgroup$ Commented Sep 30, 2018 at 16:23
  • $\begingroup$ By the way media, Can't these info be found very very easily by looking at the docs/examples associated at the repository? At least that's expected? $\endgroup$
    – Aditya
    Commented Sep 30, 2018 at 16:25

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.