Jul 10, 2017 · 1 min read
Hello Tom. Nice Observations!
I’ll try to clear your doubts through the following points :-
- We pass
xand notyintotrain_NNbecause we need to train the model using the images available in the MNIST data set which are stored inxwhereasystores the labels (i.e 0,1,2 … and so on) or, in simpler terms, the output expected for a given image of some handwritten number. - Using main
()function is definitely a good practice when you need to import your code for some reason into some other program, which we don’t need to do at all over here. There is no compulsion as such, to write the code using main or without it unless you have another module that’s importing it. So, this is clearly not an error. You may refer to the output screenshots or try executing the code on your own. Check out these two links to know more — https://stackoverflow.com/questions/4041238/why-use-def-main and https://stackoverflow.com/questions/419163/what-does-if-name-main-do - I’m not referring to the random variables of Probability Distributions. One of the many uses of underscores in Python is to depict specific values not needed or used anywhere else in the code. Refer to this well structured link to learn more — https://hackernoon.com/understanding-the-underscore-of-python-309d1a029edc
Thank you for pointing out these things because there could be others who might be having the same doubts or they will at least get to learn something new from the questions you came up with :)
