xgboost 属性在正确安装后不起作用
xgboost properties are not working after being installed properly
我试过通过pip安装xgboost,但是由于egg文件的问题,出现了错误。然后我尝试了以下操作:
git 克隆 --recursive https://github.com/dmlc/xgboost
cd xgboost;制作-j4
它运作良好。现在 pip 表示 xgboost 和 sklearn 已正确安装。但是,当我尝试从不同的 xgboost 示例中重复一些基本代码时遇到了一些问题(例如:https://machinelearningmastery.com/develop-first-xgboost-model-python-scikit-learn/ 或其他几个网页)
- 将 xgboost 导入为 xgb
- 从 xgboost 导入 *
- 将 sklearn 导入为 skl
- 从 sklearn 导入 *
- 从 sklearn.preprocessing 导入 LabelEncoder
工作正常(只是返回 DepreciationWarning),但有几个属性不起作用,例如:
助推器=xgb.Booster()
回馈:
AttributeError: 模块 'xgboost' 没有属性 'Booster'
和model = XGBClassifier()附带:
NameError: 名称 'XGBClassifier' 未定义
有谁知道我的错误是什么?
您可能使用了错误的版本。版本 0.6.x 包含助推器功能,但后者 (0.7.x) 不再包含它们。可以做之前的所有事情,但访问不同的功能...
我试过通过pip安装xgboost,但是由于egg文件的问题,出现了错误。然后我尝试了以下操作:
git 克隆 --recursive https://github.com/dmlc/xgboost cd xgboost;制作-j4
它运作良好。现在 pip 表示 xgboost 和 sklearn 已正确安装。但是,当我尝试从不同的 xgboost 示例中重复一些基本代码时遇到了一些问题(例如:https://machinelearningmastery.com/develop-first-xgboost-model-python-scikit-learn/ 或其他几个网页)
- 将 xgboost 导入为 xgb
- 从 xgboost 导入 *
- 将 sklearn 导入为 skl
- 从 sklearn 导入 *
- 从 sklearn.preprocessing 导入 LabelEncoder
工作正常(只是返回 DepreciationWarning),但有几个属性不起作用,例如:
助推器=xgb.Booster()
回馈:
AttributeError: 模块 'xgboost' 没有属性 'Booster'
和model = XGBClassifier()附带:
NameError: 名称 'XGBClassifier' 未定义
有谁知道我的错误是什么?
您可能使用了错误的版本。版本 0.6.x 包含助推器功能,但后者 (0.7.x) 不再包含它们。可以做之前的所有事情,但访问不同的功能...