# Problem Statement

As in the lecture, you will use the motivating example of housing price prediction.
This lab will use a simple data set with only two data points - a house with 1000 square feet(sqft) sold for \$300,000 and a house with 2000 square feet sold for \$500,000. These two points will constitute our data or training set. In this lab, the units of size are 1000 sqft and the units of price are 1000s of dollars.

Size (1000 sqft) Price (1000s of dollars)
1.0 300
2.0 500

You would like to fit a linear regression model (shown above as the blue straight line) through these two points, so you can then predict price for other houses - say, a house with 1200 sqft.

Please run the following code cell to create your `x_train` and `y_train` variables. The data is stored in one-dimensional NumPy arrays.

In [5]:

# y_train is the target (price in 1000s of dollars)

x_train = np.array([1.0, 2.0])

y_train = np.array([300.0, 500.0])

print(f"x_train = {x_train}")

print(f"y_train = {y_train}")

--------------------------------------------------------------------------- NameError Traceback (most recent call last) in 1 # x_train is the input variable (size in 1000 square feet) 2 # y_train is the target (price in 1000s of dollars) ----> 3 x_train = np.array([1.0, 2.0]) 4 y_train = np.array([300.0, 500.0]) 5 print(f"x_train = {x_train}") NameError: name ‘np’ is not defined. Why am I getting an error code?

In the future, please post a screen capture image, instead of a text copy-and-paste. The screen capture images are easier to read because they include the correct formatting.

Every time you open a notebook, you have to run all of the cells starting from the top. That’s where the assets are imported and referenced (like numpy being referenced as “np”).

TMosh,
I am new to navigating the Jupyter Notebook tool. I am uncertain of your instructions.
please give me more detailed instructions

Please practice using the Week 1 lab “Python and Jupyter Notebooks”.
It’s all explained there.

When you open the notebook, you need to run each cell.

Example:

• At ‘1’, you left-click inside a code cell (it has square-brackets next to it).
• Then at ‘2’, you click on the “Run” button at the top of the menu.
• You can tell when a cell has completed running because a number will appear inside the square brackets.

Ok, I will do that.

Thanks…

1 Like