handson-ml icon indicating copy to clipboard operation
handson-ml copied to clipboard

Chapter 2: SettingWithCopyWarning

Open Mahdi-Hosseinali opened this issue 6 years ago • 7 comments

Thanks for the good book, currently I'm reading the second chapter and at some points my results are not the same as the notebook (pretty much all of the predictions). I think the reason could be cell 30:

for set_ in (strat_train_set, strat_test_set):
    set_.drop("income_cat", axis=1, inplace=True)

which throws the warning in the title.

Mahdi-Hosseinali avatar Oct 11 '18 00:10 Mahdi-Hosseinali

I was able to replicate the results perfectly and even implement other solutions to the problmes using other methods. If there's any error with reproducibility, that is probably not the source of it.

Have you set the numpy random seed to 42 en every instance needed?

r-ichi avatar Oct 17 '18 18:10 r-ichi

Hi @r-ichi , Thanks for your feedback. Could you please indicate which versions you are using for your OS, Python, Pandas, NumPy and Scikit-Learn?

ageron avatar Nov 01 '18 08:11 ageron

Absolutely. By the way, thanks for your amazing work. Python version: Anaconda 3.6.5 :: Anaconda custom (64-bit) OS version: Windows 10 64bit (I hope I got this right, if you meant something else, please let me know) Pandas version: 0.23.0 Numpy version: 1.14.3 SKLearn version: 0.19.1

Greetings from Chile.

r-ichi avatar Nov 01 '18 16:11 r-ichi

Sorry I didn't get back to you. Did you solve this issue?

ageron avatar Aug 13 '19 02:08 ageron

i too getting the same type of error would you plese give me the answer

RaghuRamaBL avatar Jun 02 '20 11:06 RaghuRamaBL

could you describe your error more specifically and/or provide a screenshot?

r-ichi avatar Jun 02 '20 14:06 r-ichi

i restarted the kernal and run the code again it solved for set_ in (strat_train_set, strat_test_set): set_.drop("income_cat", axis=1, inplace=True)

in this it was throwing an error of set_ not defined at that time

Thanks for reply

RaghuRamaBL avatar Jun 03 '20 03:06 RaghuRamaBL