Windows错误与python一起使用XGBoost [英] Windows Error using XGBoost with python
问题描述
因此,我正在解决这个机器学习问题(来自之前的Kaggle竞赛练习:
So I'm tackling this machine-learning problem (from a previous Kaggle competition for practice: https://www.kaggle.com/c/nyc-taxi-trip-duration) and I'm trying to use XGBoost but getting an error which I have no clue how to tackle. I searched on google and stack overflow but couldn't find anyone with a similar problem.
我正在通过Anaconda在Spyder IDE中使用python 2.7,并且在Windows 10上安装xgboost软件包时遇到了一些麻烦,因此我不会完全消除它可能是安装错误的想法.但是,我也正在学习有关ML的Udemy课程,我可以在一个小的数据集上很好地使用xgboost,而且我使用的是相同的函数.
I'm using python 2.7 with the Spyder IDE through Anaconda and I'm on Windows 10. I did have some trouble installing the xgboost package so I won't completely erase the idea that it could be an installation error. However I'm also doing a Udemy course on ML and I was able to use xgboost just fine with a small dataset and I'm using the same functions.
代码非常简单:
... import libraries
# import dataset
dataset = pd.read_csv('data/merged.csv')
y = dataset['trip_duration'].values
del dataset['trip_duration'], dataset["id"], dataset['distance']
X = dataset.values
# Split dataset into training and test sets
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.25)
# fit XGBoost to training set
classifier = XGBClassifier()
classifier.fit(X_train, y_train)
输出
但是它会出现以下错误:
Output
However it spits out the following error:
In [1]: classifier.fit(X_train, y_train)
Traceback (most recent call last):
File "<ipython-input-44-f44724590846>", line 1, in <module>
classifier.fit(X_train, y_train)
File "C:\Users\MortZ\Anaconda3\lib\site-packages\xgboost\sklearn.py", line 464, in fit
verbose_eval=verbose)
File "C:\Users\MortZ\Anaconda3\lib\site-packages\xgboost\training.py", line 204, in train
xgb_model=xgb_model, callbacks=callbacks)
File "C:\Users\MortZ\Anaconda3\lib\site-packages\xgboost\training.py", line 74, in _train_internal
bst.update(dtrain, i, obj)
File "C:\Users\MortZ\Anaconda3\lib\site-packages\xgboost\core.py", line 819, in update
_check_call(_LIB.XGBoosterUpdateOneIter(self.handle, iteration, dtrain.handle))
WindowsError: [Error -529697949] Windows Error 0xE06D7363
我真的不知道该如何解释,因此对您的帮助将不胜感激.预先感谢
I don't really know how to interpret this so any help would be very appreciated. Thanks in advance
MortZ
推荐答案
我猜这是因为您使用XGBClassfier而不是XGBRegressor来解决回归问题.
I guess the error is because you are using XGBClassfier instead of XGBRegressor for a regression problem.
这篇关于Windows错误与python一起使用XGBoost的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!