I have the following code and I don’t know why the result is “nan”…
test_df['squared_error'] = (test_df['predicted_price'] - test_df['price'])**(2)
mse = test_df['squared_error'].mean()rmse = mse ** (1/2)
rmse
Result: nan
I have the same problem here:
for feature in ['guests','beds','rooms','reviews']:
test_df['predicted_price'] = test_df.guests.apply(predict_price,feature_column=feature)
test_df['squared_error'] = (test_df['predicted_price'] - test_df['price'])**(2)
mse = test_df['squared_error'].mean()
rmse = mse ** (1/2)
print("RMSE for the {} column: {}".format(feature,rmse))
Result:
RMSE for the guests column: nan
RMSE for the beds column: nan
RMSE for the rooms column: nan
RMSE for the reviews column: nan
My dataset is in following image