I have a huge CSV structured dataset. I'm feeding that dataset to a Keras Sequential Model. My question is, can my Model have number of units greater than the number of input features? At the moment, my features or csv columns are 118 and Model summary is as:

  1. First layer of model has 256 units with elu activation.
  2. Second layer 128 with elu activation
  3. Third layer 64 with elu activation
  4. Last layer 1 unit with segmoid activation

Now, I'm getting 100% accuracy on both training and testing data, which is surprising to me. For 50 features, the model was giving 94.25% accuracy on training and 95.68% accuracy on testing data. Accuracy can be even 99 or 99.XX% but 100% is something wrong I guess? If it's 100% on test data, it's probably not the overfitting..? Please guide me!

  • $\begingroup$ Units count = Activation count. Each unit is connected to the "number of Neurons of the Last Layer" weights. For the first layer, it's equal to the number of Input Features. So, Yes. Your input layer will have (256*118 weights + 256 biases). You might have a very simple dataset. Check with simpler Model i.e. LogisticsRegression/DecisionTree etc. $\endgroup$ – 10xAI Dec 10 '20 at 14:37
  • $\begingroup$ So, is it Ok to have 256 neurons in first layer for 118 input features? $\endgroup$ – DevLoverUmar Dec 10 '20 at 14:42
  • $\begingroup$ And what might be the problem with 100% accuracy? Is it normal? $\endgroup$ – DevLoverUmar Dec 10 '20 at 14:43

You can try "Border Pairs Method", "Bipropagation" or "One step method" to finding out how many neurons you need in each layer.


  • $\begingroup$ One line and link only answers often get flagged for deletion. It is helpful to add more detail if possible. $\endgroup$ – Ethan Dec 12 '20 at 19:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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