python机器学习基础

《python机器学习基础》错误笔记

在用pycharm运行书本鸢尾花示例代码时报错

TypeError: __init__() got an unexpected keyword argument 'cachedir'
Traceback (most recent call last):
  File "D:/桌面/pythonProject1/机器学习/481.py", line 23, in <module>
    import mglearn
  File "D:\桌面\python\lib\site-packages\mglearn\__init__.py", line 1, in <module>
    from . import plots
  File "D:\桌面\python\lib\site-packages\mglearn\plots.py", line 16, in <module>
    from .plot_nmf import plot_nmf_illustration, plot_nmf_faces
  File "D:\桌面\python\lib\site-packages\mglearn\plot_nmf.py", line 7, in <module>
    memory = Memory(cachedir="cache")
TypeError: __init__() got an unexpected keyword argument 'cachedir'

参考悬铃木下的青春的博客,将plot_nmf.py文件进行修改:
修改前:

memory = Memory(cachedir="cache")

修改后:

memory = Memory(location="cache")

修改之后,又出现了以下错误:

AttributeError: module 'pandas' has no attribute 'scatter_matrix'

参考多欢喜 的博客。知道现在的pandas的scatter_matrix用法已经发生变化了,在使用时需要加上plotting,即:pandas.plotting.scatter_matrix
修改后:

grr = pd.plotting.scatter_matrix

正确运行

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值