Doubts on Programming Assignment of Week 3

I completed the assignment with now, a better intuition of implementing a Neural Net but I had some questions about some of the syntax/packages used and how they tie into the implementation. Could someone please help me out? I’ll list them out below:

Q1) What is “load_planar_dataset”? What comprises it? Is there any documentation on “planar_utils”? All i understood is that it’s a 2D geometry lib. Can i get some resources to read up on it and what other practical implementations it is relevant to?
Q2) Why write the following code while importing packages : %load_ext autoreload
%autoreload 2 What do these lines of code mean? What are they aiming to accomplish? What do they do for me in the implementation?
Q3) Why was there a semicolon after “df.fit();”? I did not see any additional code written on the same line so why would there be a need to delimit it?
Q4) I went through the documentation for “plot_decision_boundary(…)” but i couldn’t understand it well enough. The line used in the practice lab was : plot_decision_boundary ( lambda x : clf.predict(x),X,Y ) why use a lambda function here? Can’t i simply write clf.predict(x) instead?

It’s very good to go further than “intuition” always. Sometimes, there are some gaps between “intuition” and “implementations”.

Here is the answer to your question.

  • Q1. Please look at “planar_utils.py” which is located in the same directory of a notebook. load_planar_dataset() is prepared in it. If you are on the Coursera platform, you just need to click “File” from the menu, and select “Open” to see files prepared for this course.
  • Q2. Those are kind of magic words for IPython to reload modules automatically, when those are changed. Usually, once a module is imported, then, it is not re-loaded even if that module is changed.
  • Q3. Different from some other languages, Python does not require semi-colon at the end of line. But, if you want to put multiple statements on the same line, then, you can use it.
  • Q4. If you look at plot_decision_boundary() in “planar_utility.py”, then, you will see the reason. It accepts “model” as one of arguments, and process everything.

Hope this helps.

Hi, Anurag Ravi Nimonkar.

Planar dataset consists of all the datasets that you will require during the process while training the model (during this assignment). So, you need to start this by loading it on the notebook. You can find it by going to the File section, where you will get a separate file on 'planar_utils’ that carries all the necessary utility functions for the program.

The other two consequent queries were well defined by Nobu Asai.

To your last question on lambda function, I just want to mention that the plot_decision_boundary takes an object reference to its first argument within a python function. The lambda syntax is a medium to present the same argument ‘in place’ instead of defining it as a separate function. That’s why, we use lambda x: clf.predict(x), X, Y) chiefly.