ImportError: cannot import name 'GMM' from 'sklearn.mixture'

实规《Python数据科学手册》的代码时,

from sklearn.mixture import GMM

总是报错,查阅对应 scikit-learn 版本的官方文档后发现,GMM 被替换为 GaussianMixture,故正确写法为:

from sklearn.mixture import GaussianMixture

启示:

遇到冷门报错信息,束手无策时,可以考虑查查官方文档

猜你喜欢

转载自www.cnblogs.com/xiangsui/p/10981529.html