Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
452 views
in Technique[技术] by (71.8m points)

python - XGBoostError: value 0 for Parameter num_class should be greater equal to 1 num_class: Number of output class in the multi-class classification

I am using the XGBoost classifier for multilabel classification. I have 7 labels, each of binary nature. While running the script, at the .fit() method, I am getting the following error,

    MultiLabelML_Estimator.fit(X_train, Y_train_Temp)

  File "c:usersankushanaconda3libsite-packagesskmultilearnproblem_transformr.py", line 161, in fit
    classifier.fit(self._ensure_input_format(

  File "c:usersankushanaconda3libsite-packagesxgboostsklearn.py", line 828, in fit
    self._Booster = train(xgb_options, train_dmatrix,

  File "c:usersankushanaconda3libsite-packagesxgboostraining.py", line 208, in train
    return _train_internal(params, dtrain,

  File "c:usersankushanaconda3libsite-packagesxgboostraining.py", line 75, in _train_internal
    bst.update(dtrain, i, obj)

  File "c:usersankushanaconda3libsite-packagesxgboostcore.py", line 1159, in update
    _check_call(_LIB.XGBoosterUpdateOneIter(self.handle,

  File "c:usersankushanaconda3libsite-packagesxgboostcore.py", line 188, in _check_call
    raise XGBoostError(py_str(_LIB.XGBGetLastError()))

XGBoostError: value 0 for Parameter num_class should be greater equal to 1
num_class: Number of output class in the multi-class classification.

    [... skipped 1 hidden frame]

I search a lot of material on the internet like https://stackoverflow.com/questions/62225734/xgboosterror-value-0-for-parameter-num-class-should-be-greater-equal-to-1 but did not find any suitable solution.

Does anyone have any idea about this?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...