Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The sklearn.* module is deprecated in version 0.22 and will be removed in version 0.24

I am migrating a piece of software from Python 2.7 to Python 3.

One problem that arises is:

The sklearn.neighbors.kde module is deprecated in version 0.22 and will be removed in version 0.24. The corresponding classes / functions should instead be imported from sklearn.neighbors. Anything that cannot be imported from sklearn.neighbors is now part of the private API.

I am not sure which line causes this, and not sure if it is an error or a warning, and what are the implications.

On python 2.7 everything works fine.

How do I get rid of this?

like image 241
Gulzar Avatar asked Jan 08 '20 10:01

Gulzar


2 Answers

It will work until you update your scikit/sklearn version. Then the Kernel Density package will not run any more. You still have time to search for similar modules if you want to update your version.

But you can also set up different environments with different versions. Thus, if you need this module just start an environment and don't upgrade your sklearn version in this environment.

like image 85
PV8 Avatar answered Nov 15 '22 22:11

PV8


It's just a warning, for now -- until you upgrade sklearn to version 0.24. Then your code will need to be modified before it works. It's giving you a heads-up about this, so you can fix your code ahead of time. The modifications described below should work with your current version; you don't need to wait to upgrade before changing your code (at least, that's how these deprecation warnings usually work).

The corresponding classes / functions should instead be imported from sklearn.neighbors.

If I read this message correctly, it's saying that if you're using a function like sklearn.neighbours.kde.some_function() in your code now, you need to change it to sklearn.neighbours.some_function().

Anything that cannot be imported from sklearn.neighbors is now part of the private API.

This seems to be saying that there may be some functions that will no longer be available to you, even using the modification above.

like image 1
butterflyknife Avatar answered Nov 16 '22 00:11

butterflyknife