Python在XGBoos的fitting中使用weight类时停止工作

2024-03-29 08:24:08 发布

您现在位置:Python中文网/ 问答频道 /正文

我在处理分类问题中的高度不平衡数据,所以我使用加权类来处理这个问题, 但是当我运行这个Jupyter笔记本单元(fitting单元)时,Python就停止工作了。你知道吗

我的代码:

xg = XGBClassifier(objective ='reg:logistic', colsample_bytree = 0.3, learning_rate = 0.01,
            max_depth = 5, alpha = 10, n_estimators = 100)

class_weight = {0: 1,
            1: 9}

xg.fit(X_train,y_train,sample_weight=class_weight)

Tags: 数据代码高度分类笔记本jupytertrainreg