Hello, Everyone I am submitting my week 1 programming assignment, but it is giving an error, and I don’t know why. Anybody kindly share solution
Hello @Noor_jamali ,
Kindly go through following links :
But still if you don’t get 100%, feel free to let us know.
With regards,
Nilosree Sengupta
Hello, Mam I have tried both solutions, but I am still getting the same error.
Sincerely
Noor Hussain
Hello, Mam, I tried both but received no results. Now it’s throwing another error that I’m not sure why, so I’m requesting that you please resolve these issues.
Hello @Noor_jamali ,
Yeah sure,
To at first resolve the 404 error not found, do the following :
- Click on the
Help
button on the top right of the page. - Click the
Get latest version
button. - Click the
Update Lab
button. The page will refresh and you should now see the latest version of the notebook. It will have the original filename in your workspace.
With regards,
Nilosree Sengupta
Hello @Noor_jamali ,
After this 404 error is resolved, send me your notebook via dm such that I can check where it went wrong.By clicking on the profile picture, you will see an option to message.There you can attach your notebook.
Then we can discuss the issues here, under the topic you created.
With regards,
Nilosree Sengupta
Hello @Noor_jamali ,
I have seen your notebook. Your code is not correct.
- Under defining input tensors,
You have taken integer inputs.
It will be of floating type.
Given in hint :
Hint: Remember to explictly set the dtype as float
- For defining output tensors,
i. you have taken float, but first one you have taken 1 instead of 1.0
ii. You have not set dtype as float
Hint: Remember to explictly set the dtype as float
- You have modified the return code which is after ### END CODE HERE:
return model.predict(y_new)[0]
// This is wrong.
Keept it what is was:
return model
Note: Don’t modify anything apart from the range of
#start code
…
#end code
Hope this helps.
Feel free to let us know, if stuck.
WIth regards,
Nilosree Sengupta
Hello, Mam I have edited my code according to the guidelines you provided. Now there is another error appearing in my code. Could you check it and help me out? Thanks
Sincerely
Noor Jamali
[snippet deleted by mentor]
Hello @Noor_jamali ,
There are several issues that needs to be fixed. I will be explaining 1 by 1 below :
1. You have taken the same input and output tensors. Input is nth room. So it won’t be in 0.5 multiples. Input will be 1.0, 2.0,… Like this.
2. You have not set dtype as float.
3. It will not be keras.layers… , it will be be tf.keras.layers…within the bracket of Sequential.
4. There are a total of 3 cells.
- Graded function,
- model training
- and testing output.
You are only supposed to code for the Graded Function that also within the range that I mentioned :
You have modified the codes in the next cells of model training and testing output. You have presently lost the required pre-written codes for the 2nd and 3rd cells. So replace your 2nd and 3rd cells with these:
2nd cell will be :
model = house_model()
3rd cell will be:
new_y = 7.0
prediction = model.predict([new_y])[0]
print(prediction)
Hope this helps.
With regards,
Nilosree Sengupta
Hello, Mam Thanks for your response. Now that I have restructured my code, kindly check the attached IPYNB file.
[snippet deleted by mentor]
Sincerely
Noor Jamali
Hello @Noor_jamali ,
1. I meant just to change xs-nth room, not ys.
Let’s understand the question first.
It written above the cell :
A house has a base cost of 50k, and every additional bedroom adds a cost of 50k. This will make a 1 bedroom house cost 100k, a 2 bedroom house cost 150k etc.
So xs is number of rooms , it will take 1.0, 2.0…it’s correct now.
But ys is cost, where 50k gets added per room.
1 room=100k,
2 room=100+50=150k
3 room=150+50=300k
Hence ys will be what you had done in the begining, in multples of 0.5…that is : 1.0,1.5,2.0…like this.So just change your ys like above.
2.
Hope this clears all doubts!
With regards,
Nilosree Sengupta
I am sorry, ma’am, but I am unable to understand your answer because it is becoming tricky for me now “the assignment”.
Hello @Noor_jamali ,
I tried my best to explain.
Now I am tagging @balaji.ambresh Sir here.
With regards,
Nilosree Sengupta
Your notebook is missing the following cell:
# Get your trained model
model = house_model()
An undefined variable will lead to the error you are observing:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In [3], line 2
1 new_y = 2.5
----> 2 prediction = model.predict([new_y])[0]
3 print(prediction)
NameError: name 'model' is not defined
If this is unclear, I recommend you do a course on python and then come back to this specialization.
Please follow the steps in the link Nilosree has given you to get a fresh starter code by refreshing your workspace
.
Please look at the metadata for the cell containing
model = house_model()
There is no grader specific metadata here:
{
"trusted": true
}
Plese see the links shared by Nilosree to check notebook metadata
and refresh the workspace
to start over.
Do remove code from your posts since you could be blocked for posting solutions in public.
Please ask specific questions regarding issues you have. Helping you understand grader feedback / concept when unclear is a better learner and mentoring experience.
Feel free to share screenshots of grader feedback (expanded) and stacktraces via public posts. When a mentor asks you to send a notebook, please do so via a direct message. You might want to clean up your post by removing the notebook.
Here’s the community user guide to get started.
So, what was the grader feedback?