Closed ramab1988 closed 2 years ago
I can reproduce this error. Working on a fix. Thanks for the report!
Thanks!
On a side note, if we don't pass ray_dmatrix_params={}
in the clf.fit line, we get the following error. Any idea why?
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-6-7afbfa443f04> in <module>
5 )
6 # clf.fit(X_train, y_train, group=group, ray_dmatrix_params={})
----> 7 clf.fit(X_train, y_train, group=group)
8 pred_ray = clf.predict(X_test[:10])
9 print(pred_ray)
/opt/conda/lib/python3.6/site-packages/xgboost/core.py in inner_f(*args, **kwargs)
504 for k, arg in zip(sig.parameters, args):
505 kwargs[k] = arg
--> 506 return f(**kwargs)
507
508 return inner_f
/opt/conda/lib/python3.6/site-packages/xgboost_ray/sklearn.py in fit(self, X, y, group, qid, sample_weight, base_margin, eval_set, eval_group, eval_qid, eval_metric, early_stopping_rounds, verbose, xgb_model, sample_weight_eval_set, base_margin_eval_set, feature_weights, callbacks, ray_params, _remote, ray_dmatrix_params)
985 **ray_dmatrix_params
986 }),
--> 987 **self._ray_get_wrap_evaluation_matrices_compat_kwargs())
988
989 evals_result = {}
/opt/conda/lib/python3.6/site-packages/xgboost/sklearn.py in _wrap_evaluation_matrices(missing, X, y, group, qid, sample_weight, base_margin, feature_weights, eval_set, sample_weight_eval_set, base_margin_eval_set, eval_group, eval_qid, create_dmatrix, enable_categorical, label_transform)
293 feature_weights=feature_weights,
294 missing=missing,
--> 295 enable_categorical=enable_categorical,
296 )
297
/opt/conda/lib/python3.6/site-packages/xgboost_ray/sklearn.py in <lambda>(**kwargs)
983 create_dmatrix=lambda **kwargs: RayDMatrix(**{
984 **kwargs,
--> 985 **ray_dmatrix_params
986 }),
987 **self._ray_get_wrap_evaluation_matrices_compat_kwargs())
TypeError: 'NoneType' object is not a mapping
Ah, that's an oversight for the ranker. Will be fixed as well. Thank you!
@ramab1988 This will be fixed in the next release. However, you won't be able to use the group
parameter - you will have to use the qid
parameter instead, which is a vector mapping each row to the group they belong to. This is also the case for XGBoost-Dask.
Great! Thanks a lot for the quick fix. When can we expect the next release?
@krfricke I think we can make a release before the end of week, what do you think?
Hi!
I have been trying to use RayXGBRanker, but it seems like the
group
parameter is not being considered for building the model.Attaching the following code to reproduce the same:
Data preparation
1st inference
1st inference result: [-1.4302582 0.80665004 -1.656052 2.8729537 0.23208997 2.1761725 -1.1084297 -2.1263309 5.631699 -4.417554 ]
2nd inference
2nd inference result: [-1.4302582 0.80665004 -1.656052 2.8729537 0.23208997 2.1761725 -1.1084297 -2.1263309 5.631699 -4.417554 ]
As we can see, both 1st and 2nd inference pieces are giving the same predictions even though we have changed the
group
parameter. Could you guys please let me know any solution to this problem?Thanks! Rama