C1_W2_Lab03_Feature_Scaling_and_Learning_Rate_Soln/ Not importing some of the functions also works!

I was curious about
“from lab_utils_multi import load_house_data, run_gradient_descent”
and I checked the lab files and found the function “load_house_data” in the “lab_utils_multi.py” file.

However I noticed something very unexpected.

I reopened the same lab notebook and commented all three lines down below:

from lab_utils_multi import load_house_data, run_gradient_descent

#from lab_utils_multi import norm_plot, plt_equal_scale, plot_cost_i_w
#from lab_utils_common import dlc

So it must give me an error when running the next code cell, which is:

load the dataset

X_train, y_train = load_house_data()
print(f"Shape X_train, y_train : {X_train.shape}, {y_train.shape}")

X_features = [‘size(sqft)’, ‘bedrooms’, ‘floors’, ‘age’]

But shockingly it doesnt give an error!

I opened a new notebook and ran the same thing over there, and it gave me an error which is expected.

What is the difference?
Why it seems that in the original class labs, the code knows where to find those functions even if I dont tell them where they are located?!!!

If you had already run those cells, then the kernel already imported all of the assets.

If you want to trigger the error, then restart the kernel, and run the cells again.

1 Like