Failed test case: incorrect values for price_in_hundreds_of_thousands tensor

Course: Introduction to TensorFlow for Artificial Intelligence, Machine Learning, and

Week 1

Weekly Assignment: Your First Neural Network

Exercise 1: create_training_data

Your first task is to create the data that your model will be trained on. Use the scenario presented at the top of this notebook where a 1-bedroom house costs 100k, and increases by 50k for each additional bedroom.

To generate the training data (aka the features and the targets), you will use numpy to create a one-dimensional tensor with the number of bedrooms and another one-dimensional tensor with the corresponding price in hundreds of thousands of dollars (e.g. 1.0 means 100k). In this case, the number of bedrooms will be the features, which the network will try to map to the target of the prices. These tensors (or numpy arrays) should have six elements which will be the values (number of bedrooms and price in hundreds of thousands) for houses with 1 up to 6 bedrooms.

As part of solution, I have defined the numpy array as following:

n_bedrooms = code solutions removed as it is direct violation of code of conduct
price_in_hundreds_of_thousands = code solutions removed

But I am getting the following error:
Failed test case: incorrect values for price_in_hundreds_of_thousands tensor.
Expected: a numpy array with values of the prices for houses with 1 up to 6 bedrooms
Got: [150000. 200000. 250000. 300000. 350000. 400000.]

Can someone please guide.

n_bedrooms = code solution removed as it is violation of code of conduct
price_in_hundreds_of_thousands = Code solution removed as it is violation of code of conduct

refer this

Solution

Solution thread 2

Thanks Deepti for your comments.

I had to read the exercise once again, and I was able to figure it out.

I have cleared the Exercise 1, but now stuck in Exercise 3.

I am not sure how do I access n_bedrooms and price_in_hundreds_of_thousand inside def train_model():

Any suggestions on that?

Seems the Numpy array and model has to be defined again in Exercise 3.

Finally completed the assignment. Thanks a lot for your support.

1 Like

Happy to help. but please from next time remember always

  1. create a new topic for your issue even if similar threads exist.
  2. Do not post grade function codes or send direct DMs to mentor. Approach is create topic==>Mentor reviews your query and guide you==>if that doesn’t help==>they ask you to send codes by DM

Keep learning!!!