简体   繁体   English

Mac 上的 XGBoost 安装错误

[英]XGBoost Installation Error on Mac

When the below code is run on Mac gives the error No module named 'xgboost.sklearn'.当以下代码在 Mac 上运行时,会出现错误 No module named 'xgboost.sklearn'。 Also, tried changing xgboost.sklearn to xgboost.另外,尝试将 xgboost.sklearn 更改为 xgboost。 This gave the error: cannot import name 'XGBClassifier'这给出了错误:无法导入名称“XGBClassifier”

from xgboost.sklearn import XGBClassifier从 xgboost.sklearn 导入 XGBClassifier

请改用以下内容:

from xgboost import XGBClassifier

The XGBClassifier is not included in the scikit-learn. XGBClassifier 不包含在 scikit-learn 中。 The XGBoost provides the normal XGBoost instance and the scikit-learn version. XGBoost 提供普通的 XGBoost 实例和 scikit-learn 版本。 So, you need to install the XGBoost, and import the XGBClassifier from the xgboost by using:因此,您需要安装 XGBoost,并使用以下命令从 xgboost 导入 XGBClassifier:

from xgboost import XGBClassifier

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM