【sklearn|Bug】ModuleNotFoundError: No module named ‘sklearn.neighbors.kde‘

问题背景

发生如下报错:

ModuleNotFoundError: No module named 'sklearn.neighbors.kde'

原因

在网上看到一个人收到如下警告。

FutureWarning: 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.

解决方法

将下面的代码修改:

from sklearn.neighbors.kde import KernelDensity

为:

from sklearn.neighbors import KernelDensity

你可能感兴趣的:(Bug,sklearn,bug,python)