【问题标题】:Scikit-Learn Imputer not InputtingScikit-Learn Imputer 不输入
【发布时间】:2020-07-01 21:03:15
【问题描述】:

我正在尝试将 Imputer 与 scikit-learn 一起用于我的项目(开始学习机器学习),并且我已经安装了 scikit-learn(以及其他典型的机器学习工具),但是当我尝试输入 Imputer 时它告诉我认为它不存在。我正在使用 Jupyter Notebook,并且已经尝试重新启动 Jupyter Notebook。

from sklearn.preprocessing import Imputer

我收到此输入错误:

ImportError Traceback(最近一次调用最后一次)

----> 1 from sklearn.preprocessing import Imputer

ImportError: 无法导入名称“Imputer”

有人可以帮忙吗?谢谢你:)

【问题讨论】:

  • 我想你在找from sklearn.impute import SimpleImputer
  • 这是来自旧版本的 Scikit-learn。 Imputer 已重命名为 SimpleImputer。
  • @MikaO13 用于旧版本的 scikit-learn。检查您使用的是哪个版本。
  • 如何查看您使用的版本?我正在关注 Aurelien Geron 的 Hands On Machine Learning with Scikit-Learn 和 TensorFlow

标签: python machine-learning scikit-learn


【解决方案1】:

Imputer 我认为已经过时了,它在 scikit-learn 版本 0.16.1 中使用过,你使用哪个 scikit-learn 版本?

您必须拥有最新版本,因此您应该使用此功能:

import sklearn.impute.SimpleImputer

您也可以使用其他输入器,请查看documentation

【讨论】:

    猜你喜欢
    • 2016-12-18
    • 2018-05-03
    • 2019-12-02
    • 1970-01-01
    • 2018-11-21
    • 2021-07-14
    • 1970-01-01
    • 2017-10-11
    • 2014-07-07
    相关资源
    最近更新 更多