Raksham Pandey
Jul 10, 2017 · 1 min read

Hello Tom. Nice Observations!

I’ll try to clear your doubts through the following points :-

  1. We pass x and not y into train_NN because we need to train the model using the images available in the MNIST data set which are stored in x whereas y stores 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.
  2. 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
  3. 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 :)

    Raksham Pandey

    Written by

    Finding ways to employ the force of Artificial Intelligence to solve problems that matter | More : https://www.linkedin.com/in/rakshampandey

    Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
    Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
    Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade