1
$\begingroup$

I took the course Machine Learning A-Z from Udemy and am trying to apply what I learned in the tutorials. Theye taught us in the "Adding the input layer" portion of an ANN that the units is based off of the input_dim. Normally the "units = (input_dim + 1) / 2". In the dataset that I am working with my input_dim=754. (754 + 1) / 2 = 377.5. Should I use 377.5 or should I round up or down to a whole number?

#Adding the input layer and the first hidden layer
classifier.add(Dense(units=377.5, kernel_initializer='uniform', activation='relu', input_dim=754))
$\endgroup$
  • $\begingroup$ It does not make a difference it is just an approximation..no offence but i suggest you take a better course which will strengthen your basics $\endgroup$ – DuttaA Aug 15 '18 at 17:22
2
$\begingroup$

Round up or down to a whole number. Keras documentation specifies that units should be a positive integer, and I'm not sure what a fractional unit would even mean. Does this work when you try to run it?

| improve this answer | |
$\endgroup$
  • $\begingroup$ I have tried it with a whole number and it works, but I was unsure if you could use a decimal. You answered my question. $\endgroup$ – sectechguy Aug 15 '18 at 20:14

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.