Week 1 Exercise 1 " value in the `hundreds of thousands`"

When I run the function my final value is around 400000.06, but when I submit the task I get the following message

“Your result seems to be on the right path, but please have your final return value in the hundreds of thousands as the hint suggests. Please try again!”

I have also submited results as 400.00006 but get the same message.

Given the the correct house value is 400k I must be misunderstanding the formatting of the answer, what is the correct value that should be submitted?

1 Like

By using the lower case k there, you’re providing the answer in thousands, right? 400 thousands of dollars. For the numeric answer you show above, the answer is in dollars. 400000 dollars. So how could you adjust, or hint normalize hint, the numeric housing price data values ys to make the units of the result be hundreds of thousands ?

1 Like

Thank you for your suggestion. Submitting 4 worked fine.

I think the question is unecessarily confusing as getting the right order of magnitude is not the learning objective. If the the goal is to submit 4 and the hundreds of thousands are implied that should be explicitly stated. When I read the hint I thought it meant create the regression in 1e1 then scale it to 1e5.

Normalizing inputs to be of similar scale is a good general practice in regression [why might that be???] as it can be beneficial to network performance. Unfortunately, that point isn’t particularly emphasized in the exercise and many people have made comments similar to yours since I took the class over 2 years ago. Only the course content developers can decide if and when it is important enough to merit a change and so far they haven’t done so.

I have the same problem and I have no idea what you all are talking about exactly. Can you help me with it?

Hello @Ann_Maria.

There are two ideas in my responses that might be helpful to you.

One is that the grader is asking for the output to be expressed in specific units of measure - hundreds of thousands of dollars. In the real world, $400,000 (four hundred thousand dollars) 400 * $1,000 (four hundred thousand dollars) and 4 * $100,000 (four hundred thousand dollars) all buy the same house. Only the units of measure differ - just as an object’s weight is the same regardless if you express it in grams or kilograms. The grader is expecting the answer in hundred thousand dollars form. If you express it any other way, it will complain.

Turns out there are two ways to get to that unit of measure. You can scale the value returned by the prediction - after the model runs, or you can scale the housing prices in the y data - before the model runs. This is the second important idea of this exercise. The model used here has so few inputs, and the model is so simple, that it isn’t immediately apparent, but it turns out it can be important for model training performance if all the input and the output values have similar scale. That means the number of rooms, which is initially provided as order of magnitude 1 (all values less than 10) and the price, which is initially provided as order of magnitude 10^6 (all values in the hundreds of thousands) should be scaled, or normalized, to be in the same range. This would also be true if there were more features of the house being considered, say number of bedrooms (order of magnitude 1) and living space area (maybe order of magnitude 1000) . Scaling , or normalizing, the inputs up front can make the loss function better behaved and the gradients less steep, which results in better training and better predictions.

So the takeaways for this exercise are

  1. you want the model to produce a prediction value in the form of p * 10^6 dollars
  2. the preferred way to get to that scale of output is to normalize the prices to the same units of measure. In other words divide all the prices by 10^6 before you provide them to the model.

Hope this helps.


I had a similar issue. This was helpful

1 Like

@Amos_Marvellous I appreciate the feedback and glad it helped you

Very nice explaination @ai_curious

So helpful, thank you :wink:

Thanks for the feedback. I wrote a little example of the impact of scaling inputs in the last reply of this related thread. Hope it helps: