2
$\begingroup$

I have been training a multilayer perceptron using Keras to make a prediction on a function similar to that of a normal distribution. I have  input variables , and I have one output value . When I set my input layer to have  neurons as such

model.add(Dense(4, input_dim=4, activation= 'relu'))

the model learns with a  accuracy. When I tried to use  neurons in my input layer as such

model.add(Dense(35, input_dim=4, activation= 'relu'))

my model learns it with an  accuracy. I'm not understanding the logic behind this. Surely you have to have only  neurons for the input layer; what is happening with the other  neurons

$\endgroup$

1 Answer 1

2
$\begingroup$

If I understand your question properly. In first example you have 4 input neurons and they are connected to 4 neurons. In second, 4 inputs are connected to 35 neurons. That's it, you simply add more neurons in hidden layer. Btw, what do you mean saying "learns it with an accuracy"?

$\endgroup$
2
  • $\begingroup$ Yes, that's correct. It learns with an accuracy. So basically, what you're saying, is that the "35" means that there are 35 neurons in the first hidden layer? $\endgroup$ Commented Oct 3, 2018 at 20:58
  • $\begingroup$ yes, in first case 4->4->(some other layers), in second: 4->35->(some other layers) $\endgroup$
    – GrozaiL
    Commented Oct 4, 2018 at 9:01

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.