Guided Project Predicting Car Prices, (help!)

Hi guys!

I just finished this project after 6-7 hours, i think there’s something weird in my results, they are completely different from the solution notebook. I don’t know if i did anything wrong, i’ve checked my code over and over and can’t find anything different

Thanks in advance for any help!

Predicting car prices.ipynb (122.6 KB)

Click here to view the jupyter notebook file in a new tab

Because you are randomly permuting a sequence, hence the result will be different but the values will be somehow close.

But if you check the solution, my values are not even close. For example the last graphic, in the solution the range is between 2500 and 5000. In my case it’s between 5000 and 8000. Same happens in the first graph and the errors are way bigger in my case

In some of the “knn_train_test” functions, when calling the predict method, you used “knn.predict(test_df[[target_col]])”, while the solution notebook has “knn.predict(test_df[[train_col]])”. I think that’s the main difference.
When making this change, you get the same results that I do (I’ve checked), still different from the solution notebook.

Intrigued by this, I downloaded the solution’s notebook and ran it on my PC, and it turns out that I got the same results that I did running my own code. A possible explanation is that the dataset downloaded by us is slightly different than the one used in the solution notebook, but I don’t know for sure, since I didn’t quite looked into it.

Hope it helps!


Yeah that was it, just changed target_col to train_col and looks better now.

1 Like