我已经使用 XGB 分类器训练了数据集,但在本地出现此错误。它在 Colab 上有效,而且我的朋友对相同的代码也没有任何问题。我不知道这个错误意味着什么...
Invalid classes inferred from unique values of y. Expected: [0 1 2 3 4 5], got [1 2 3 4 5 6]
这是我的代码,但我想这不是原因。
start_time = time.time()
xgb = XGBClassifier(n_estimators = 400, learning_rate = 0.1, max_depth = 3)
xgb.fit(X_train.values, y_train)
print('Fit time : ', time.time() - start_time)
Run Code Online (Sandbox Code Playgroud) python classification machine-learning xgboost xgbclassifier