First, normalize out example.
x_house = np.array([1200, 3, 1, 40])
x_house_norm = (x_house - X_mu) / X_sigma
print(x_house_norm)
x_house_predict = np.dot(x_house_norm, w_norm) + b_norm
print(f" predicted price of a house with 1200 sqft, 3 bedrooms, 1 floor, 40 years old = ${x_house_predict*1000:0.0f}")
Why does the final prediction multiply 1000? The X, w and b are all used normalized values. Suppose the predicted house value is a normalized value too. Thanks very much.
@tonylei ,
Welcome to the community. We haven’t normalized the target variable y_train
. The predicted value is multiplied by 1000 because y_train
is the price in 1000s of dollars.
Thanks a lot Vignesh, very helpful.