问题描述:
python3.5环境下跑机器学习ensemble learning的代码
数据集是UCI网站的Australia credit dataset,690个样本15个特征
调用sklearn中的XGBoost模型时,没有出现报错警告,但最后输出出错,不能正常输出准确率
// XGBoost
model = xgb.XGBClassifier()
model.fit(x_train, y_train)
print('XGBoost model', model.score(x_test, y_test))
输出结果(其他模型正常输出):
Random Forest model 0.8786407766990292
AdaBoost model 0.8495145631067961
GBM model 0.8640776699029126
Process finished with exit code -1073740791 (0xC0000409)
解决方法(参考网上教程):
猜想可能也是内存问题,隔离GPU,添加代码如下:
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
最后可以正常输出
Random Forest model 0.8405797101449275
AdaBoost model 0.8454106280193237
GBM model 0.8502415458937198
XGBoost model 0.8695652173913043
Process finished with exit code 0