-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
When fitting a model with RayXGBRregressor, .fit
appears to pass the wrong number of arguments _configure.fit
When running
reg = RayXGBRegressor(n_jobs=1)
reg.fit(X_train, y_train)
throws this error
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
File ~/anaconda3/envs/p3.12/lib/python3.12/site-packages/xgboost_ray/sklearn.py:518, in RayXGBRegressor.fit(self, X, y, sample_weight, base_margin, eval_set, 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)
[517](https://vscode-remote+ssh-002dremote-002bsimba.vscode-resource.vscode-cdn.net/disk04/kevin/ML/~/anaconda3/envs/p3.12/lib/python3.12/site-packages/xgboost_ray/sklearn.py:517) try:
--> [518](https://vscode-remote+ssh-002dremote-002bsimba.vscode-resource.vscode-cdn.net/disk04/kevin/ML/~/anaconda3/envs/p3.12/lib/python3.12/site-packages/xgboost_ray/sklearn.py:518) model, feval, params = self._configure_fit(xgb_model, eval_metric, params)
[519](https://vscode-remote+ssh-002dremote-002bsimba.vscode-resource.vscode-cdn.net/disk04/kevin/ML/~/anaconda3/envs/p3.12/lib/python3.12/site-packages/xgboost_ray/sklearn.py:519) except TypeError:
[520](https://vscode-remote+ssh-002dremote-002bsimba.vscode-resource.vscode-cdn.net/disk04/kevin/ML/~/anaconda3/envs/p3.12/lib/python3.12/site-packages/xgboost_ray/sklearn.py:520) # XGBoost >= 1.6.0
TypeError: XGBModel._configure_fit() takes 3 positional arguments but 4 were given
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
Cell In[44], [line 1](vscode-notebook-cell:?execution_count=44&line=1)
----> [1](vscode-notebook-cell:?execution_count=44&line=1) reg.fit(X_train, y_train)
File ~/anaconda3/envs/p3.12/lib/python3.12/site-packages/xgboost/core.py:726, in require_keyword_args.<locals>.throw_if.<locals>.inner_f(*args, **kwargs)
[724](https://vscode-remote+ssh-002dremote-002bsimba.vscode-resource.vscode-cdn.net/disk04/kevin/ML/~/anaconda3/envs/p3.12/lib/python3.12/site-packages/xgboost/core.py:724) for k, arg in zip(sig.parameters, args):
[725](https://vscode-remote+ssh-002dremote-002bsimba.vscode-resource.vscode-cdn.net/disk04/kevin/ML/~/anaconda3/envs/p3.12/lib/python3.12/site-packages/xgboost/core.py:725) kwargs[k] = arg
--> [726](https://vscode-remote+ssh-002dremote-002bsimba.vscode-resource.vscode-cdn.net/disk04/kevin/ML/~/anaconda3/envs/p3.12/lib/python3.12/site-packages/xgboost/core.py:726) return func(**kwargs)
File ~/anaconda3/envs/p3.12/lib/python3.12/site-packages/xgboost_ray/sklearn.py:527, in RayXGBRegressor.fit(self, X, y, sample_weight, base_margin, eval_set, 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)
[518](https://vscode-remote+ssh-002dremote-002bsimba.vscode-resource.vscode-cdn.net/disk04/kevin/ML/~/anaconda3/envs/p3.12/lib/python3.12/site-packages/xgboost_ray/sklearn.py:518) model, feval, params = self._configure_fit(xgb_model, eval_metric, params)
[519](https://vscode-remote+ssh-002dremote-002bsimba.vscode-resource.vscode-cdn.net/disk04/kevin/ML/~/anaconda3/envs/p3.12/lib/python3.12/site-packages/xgboost_ray/sklearn.py:519) except TypeError:
[520](https://vscode-remote+ssh-002dremote-002bsimba.vscode-resource.vscode-cdn.net/disk04/kevin/ML/~/anaconda3/envs/p3.12/lib/python3.12/site-packages/xgboost_ray/sklearn.py:520) # XGBoost >= 1.6.0
[521](https://vscode-remote+ssh-002dremote-002bsimba.vscode-resource.vscode-cdn.net/disk04/kevin/ML/~/anaconda3/envs/p3.12/lib/python3.12/site-packages/xgboost_ray/sklearn.py:521) (
[522](https://vscode-remote+ssh-002dremote-002bsimba.vscode-resource.vscode-cdn.net/disk04/kevin/ML/~/anaconda3/envs/p3.12/lib/python3.12/site-packages/xgboost_ray/sklearn.py:522) model,
[523](https://vscode-remote+ssh-002dremote-002bsimba.vscode-resource.vscode-cdn.net/disk04/kevin/ML/~/anaconda3/envs/p3.12/lib/python3.12/site-packages/xgboost_ray/sklearn.py:523) feval,
[524](https://vscode-remote+ssh-002dremote-002bsimba.vscode-resource.vscode-cdn.net/disk04/kevin/ML/~/anaconda3/envs/p3.12/lib/python3.12/site-packages/xgboost_ray/sklearn.py:524) params,
[525](https://vscode-remote+ssh-002dremote-002bsimba.vscode-resource.vscode-cdn.net/disk04/kevin/ML/~/anaconda3/envs/p3.12/lib/python3.12/site-packages/xgboost_ray/sklearn.py:525) early_stopping_rounds,
[526](https://vscode-remote+ssh-002dremote-002bsimba.vscode-resource.vscode-cdn.net/disk04/kevin/ML/~/anaconda3/envs/p3.12/lib/python3.12/site-packages/xgboost_ray/sklearn.py:526) callbacks,
--> [527](https://vscode-remote+ssh-002dremote-002bsimba.vscode-resource.vscode-cdn.net/disk04/kevin/ML/~/anaconda3/envs/p3.12/lib/python3.12/site-packages/xgboost_ray/sklearn.py:527) ) = self._configure_fit(
[528](https://vscode-remote+ssh-002dremote-002bsimba.vscode-resource.vscode-cdn.net/disk04/kevin/ML/~/anaconda3/envs/p3.12/lib/python3.12/site-packages/xgboost_ray/sklearn.py:528) xgb_model, eval_metric, params, early_stopping_rounds, callbacks
[529](https://vscode-remote+ssh-002dremote-002bsimba.vscode-resource.vscode-cdn.net/disk04/kevin/ML/~/anaconda3/envs/p3.12/lib/python3.12/site-packages/xgboost_ray/sklearn.py:529) )
[531](https://vscode-remote+ssh-002dremote-002bsimba.vscode-resource.vscode-cdn.net/disk04/kevin/ML/~/anaconda3/envs/p3.12/lib/python3.12/site-packages/xgboost_ray/sklearn.py:531) # remove those as they will be set in RayXGBoostActor
[532](https://vscode-remote+ssh-002dremote-002bsimba.vscode-resource.vscode-cdn.net/disk04/kevin/ML/~/anaconda3/envs/p3.12/lib/python3.12/site-packages/xgboost_ray/sklearn.py:532) params.pop("n_jobs", None)
TypeError: XGBModel._configure_fit() takes 3 positional arguments but 6 were given
Meanwhile, the comparable code in the non-Ray version of XGBoost works just fine.
reg = XGBRegressor(n_jobs = 1)
reg.fit(X_train, y_train)
Metadata
Metadata
Assignees
Labels
No labels