Can someone help on my Week1 Assignment?

GRADED FUNCTION: house_model

def house_model(y_new):

# Define input and output tensors with the values for houses with 1 up to 6 bedrooms
# Hint: Remember to explictly set the dtype as float
xs = np.array([1.0,2.0,3.0,4.0,5.0], dtype=float)
ys = np.array([1.0, 1.5, 2.0, 2.5, 3.0], dtype=float)

# Define your model (should be a model with 1 dense layer and 1 unit)
model = model = tf.keras.Sequential([keras.layers.Dense(units=1, input_shape=[1])])

# Compile your model
# Set the optimizer to Stochastic Gradient Descent
# and use Mean Squared Error as the loss function
model.compile(optimizer='sgd', loss='mean_squared_error')

# Train your model for 1000 epochs by feeding the i/o tensors, ys, epochs=1000)

return model

There was a problem compiling the code from your notebook. Details:
house_model() missing 1 required positional argument: ‘y_new’

Hello @Supreet_Khare ,

Welcome to the community!!

Why have you taken parameter y_new in function house_model()?
Here house_model() is a non-parameterized function.
Just remove y_new.It’s not needed.

With regards,
Nilosree Sengupta

Hello @Supreet_Khare ,

Another thing, instruction is given :

You have taken only 5 values in the arrays.
It will again give another error.
You need to take 6 values.

With regards,
Nilosree Sengupta

Hi @nilosreesengupta I also tried to take 6 values, still getting same result 0/100

Hello @Supreet_Khare ,

Thanks for sending your notebook.I have gone through it.Several things are there.I guess there may be some doubts in understanding the tasks.So, here I will be explaining every issue individually.

  1. It is given in notebook :
//You are just supposed to write anything or change anything as asked in this range 

You have written several things beyond this.You don’t need to write anything or change anything beyond that range or where not asked to.Everything is given in the instructions within the code cells.

  1. Next, you have returned model.predict[0] .This is not needed.Don’t make any changes to the return statement : return model
    which is written after ###END CODE HERE.

  2. After the return statement, you have added 3 lines which are not needed.

print("hundreds of thousands")

Remove these.You don’t need to think of y_new and 7 bedrooms.In the last cell , code snippet is already written to test your code in accordance to these.

  1. 'hundreds of thousands’ is not any statement to be printed.
    In the hint it is given that :

Hint: Your network might work better if you scale the house price down. You don't have to give the answer might be better to create something that predicts the number 4, and then your answer is in the 'hundreds of thousands' etc..

Here it means that build a model in such a way that answer should come around 4 and not big numbers between one hundred thousand and a million which is represented by a phrase ‘hundreds of thousands’.

  1. Under # Get your trained model, you have written whole algo again. Just call the function you wrote above i.e house_model()

So, in short, what you are asked to do is, build a model neural network that predicts the price of a house according to a simple formula.So for that you just supposed to :

  1. Write code for the function : def house_model() following the instructions within , that cell
  2. Call the function to to predict the price of houses.

Hope this helps.

With regards,
Nilosree Sengupta

Hi @nilosreesengupta I have followed all your instructions. I got also 4.0 output, but still 0/100 points
I can’t still figure out what’s wrong with my codes.