Greetings it is a request to tell me the meaning of the phrase plt_intuition in python. It is used at the very end of this code:
import numpy as np
%matplotlib widget
import matplotlib.pyplot as plt
from lab_utils_uni import plt_intuition, plt_stationary, plt_update_onclick, soup_bowl
plt.style.use(’./deeplearning.mplstyle’)
x_train = np.array([1.0, 2.0]) #(size in 1000 square feet)
y_train = np.array([300.0, 500.0]) #(price in 1000s of dollars)
def compute_cost(x, y, w, b):
“”"
Computes the cost function for linear regression.
Args:
x (ndarray (m,)): Data, m examples
y (ndarray (m,)): target values
w,b (scalar) : model parameters
Returns
total_cost (float): The cost of using w,b as the parameters for linear regression
to fit the data points in x and y
"""
# number of training examples
m = x.shape[0]
cost_sum = 0
for i in range(m):
f_wb = w * x[i] + b
cost = (f_wb - y[i]) ** 2
cost_sum = cost_sum + cost
total_cost = (1 / (2 * m)) * cost_sum
return total_cost
plt_intution() is a function that you call with 2 arguments. To have a look at the function and what it does, open the lab_utils_uni file as normally done from file–>open…
A little more general background in case you (or other readers) are new to python and/or using Jupyter notebooks:
When you see an import line like this: from lab_utils_uni import, it means import some functions from the file lab_utils_uni.py
Files with “utils” in the name are utility files typically created by the deeplearning staff
You can often get a pretty good idea of what a function does by looking at its name and the context in which it’s used. This gets easier as you get more used to some standard naming conventions. For example: “plt_” is commonly used to mean “plot”, and in the lab, right before the cell where plt_intuition is called, there’s a section titled “Cost Function Intuition”. That gives you a general idea that this function is for plotting something to give intuition about the cost function. The explanation in the “Cost Function Intuition” section should provide even more context.
If you want to learn more, you can always look at the utils file to see exactly how the function is implemented. As @gent.spah mentions, to look at the file, you can go to the File menu and choose “Open” to see the files in the folder, including this one, and you can open the file to have a look.