ageron / handson-ml

⛔️ DEPRECATED – See https://github.com/ageron/handson-ml3 instead.
Apache License 2.0
25.12k stars 12.91k forks source link

ImportError: cannot import name 'fetch_mldata' from 'sklearn.datasets' (F:\Anaconda3\lib\site-packages\sklearn\datasets\__init__.py) #657

Closed jltxwxj closed 2 years ago

ageron commented 2 years ago

Hi @jltxwxj ,

The fetch_mldata() function was removed 3 or 4 years ago, because the website it relied on was no longer maintained. It was replaced with fetch_openml(), which relies on the well-maintained openml.org website. See this issue #301 for more details.

Also note that fetch_openml() changed recently, so in the latest versions of Scikit-Learn, you will need to add the argument as_frame=False to ensure that the code examples still work.

Lastly, the 1st edition of my book is becoming a bit old now. The 2nd edition was released in 2019, and the 3rd edition is coming out soon. The early release is already available here. And the up-to-date code is in the https://github.com/ageron/handson-ml3 repository.

Hope this helps!