ModuleNotFoundError.没有名为'xgboost.sklearn'的模块。没有名为 "xgboost.sklearn "的模块。

问题描述 投票:0回答:1

我试图将xgboost导入jupyter-notebook中,但得到以下错误。

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-9-a585b270d0df> in <module>
      1 import pandas as pd
      2 import numpy as np
----> 3 import xgboost

~/.local/lib/python3.6/site-packages/xgboost/__init__.py in <module>
     14 from . import tracker  # noqa
     15 from .tracker import RabitTracker  # noqa
---> 16 from . import dask
     17 try:
     18     from .sklearn import XGBModel, XGBClassifier, XGBRegressor, XGBRanker

~/.local/lib/python3.6/site-packages/xgboost/dask.py in <module>
     31 from .training import train as worker_train
     32 from .tracker import RabitTracker
---> 33 from .sklearn import XGBModel, XGBClassifierBase, xgboost_model_doc
     34 
     35 # Current status is considered as initial support, many features are

ModuleNotFoundError: No module named 'xgboost.sklearn'

我已经下载了sklearn以及sci-kit学习,他们工作得很好......任何想法是什么问题?

python scikit-learn xgboost
1个回答
0
投票

你可能需要正确地安装你的包.对于最佳实践,你需要使用conda环境。在这里查看它是如何工作的。https:/docs.conda.ioprojectscondaenlatestuser-guidetasksmanage-environments.html。

一旦你创建了你的环境,激活它,然后安装所有你需要的包。大概,你必须运行这个命令。

  • conda install -c conda-forge xgboost
  • pip install -U scikit-learn

要安装你的机器学习包。

© www.soinside.com 2019 - 2024. All rights reserved.