调整XGBranker会为组产生错误
我有一个简单的排名问题,我使用:
from xgboost import XGBRanker
model = XGBRanker(
min_child_weight=10,
subsample=0.5,
tree_method='hist',
)
model.fit(X_train, y_train, group=groups)
工作正常。作为机器学习流的一步,现在我想照常调整模型的超参数。我尝试了:
from skopt import BayesSearchCV
from skopt.space import Real, Categorical, Integer
opt = BayesSearchCV(
model,
{
'min_child_weight': Real(.05, .5, prior='log-uniform'),
'subsample': Real(.05, .5, prior='log-uniform'),
#'n_estimators ': Integer(1,50),
},
n_iter=32,
random_state=0,
scoring='accuracy'
)
# executes bayesian optimization
_ = opt.fit(X_train, y_train, group=groups)
我收到以下错误:
Check failed: group_ptr_.back() == num_row_ (5740832 vs. 4592665) : Invalid group structure. Number of rows obtained from groups doesn't equal to actual number of rows given by data.
我用rancomexearchcv
of scikit
尝试了此错误,并发生了相同的错误。
I have a simple ranking problem, and i use:
from xgboost import XGBRanker
model = XGBRanker(
min_child_weight=10,
subsample=0.5,
tree_method='hist',
)
model.fit(X_train, y_train, group=groups)
Works fine. As an step of machine learning flow, now I want to tune the hyperparameters of the model as usual. I tried:
from skopt import BayesSearchCV
from skopt.space import Real, Categorical, Integer
opt = BayesSearchCV(
model,
{
'min_child_weight': Real(.05, .5, prior='log-uniform'),
'subsample': Real(.05, .5, prior='log-uniform'),
#'n_estimators ': Integer(1,50),
},
n_iter=32,
random_state=0,
scoring='accuracy'
)
# executes bayesian optimization
_ = opt.fit(X_train, y_train, group=groups)
and I receive the following error:
Check failed: group_ptr_.back() == num_row_ (5740832 vs. 4592665) : Invalid group structure. Number of rows obtained from groups doesn't equal to actual number of rows given by data.
I tried this with RandomizedSearchCV
of scikit
and the same error occurred.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论