AttributeError:'module'对象没有属性'DMatrix

时间:2017-10-04 14:17:00

标签: python python-2.7 machine-learning xgboost

我尝试了所有可能的解决方案,但仍然遇到此错误,已经安装了所有依赖库。

import numpy as np
import pandas as pd

from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelEncoder

from tqdm import tqdm
import xgboost as xgb

d_train = xgb.DMatrix(X_train, label=y_train)
AttributeError: 'module' object has no attribute 'DMatrix'

1 个答案:

答案 0 :(得分:0)

您可以通过以下方式强制升级XGBoost:

python -m pip install xgboost --user --upgrade pip

这为我修复了它。