I need help with this Problem: Import "lab_utils_uni" could not be resolved. I installed numpy and matplotlib but lab_utils_uni didnt work. I am working with Visual Studio Code btw.
import numpy as np
import matplotlib.pyplot as plt
from lab_utils_uni import plt_intuition, plt_stationary, plt_update_onclick, soup_bowl
x_train = np.array([1.0, 2.0])
y_train = np.array([300.0, 500.0])
def compute_cost(x, y, w, b):
# 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_intuition(x_train,y_train)
3
Answers
It’s a "reportMissingImports" warning.
lab_utils_uni
is local drawing routines.You need a lab_utils_uni.py file in your workspace.
Thatʻs simple, copy lab_utils_uni.py file to the same directory your code is saved to. You can download that python files from the "files" tab on Coursera online tab.
This code is from Coursera – DeepLearning AI course.
lab_utils_uni is a common util library which is used to run the code in the Online Lab in Coursera but doesn’t show up in the Lab files section.
To look at the contents of the file try this: