Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix master CI #40

Merged
merged 3 commits into from
Oct 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 13 additions & 15 deletions lightgbm_ray/sklearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from lightgbm import LGBMModel, LGBMClassifier, LGBMRegressor # LGBMRanker
from lightgbm.basic import _choose_param_value, _ConfigAliases
from xgboost_ray.sklearn import (_wrap_evaluation_matrices,
_check_if_params_are_ray_dmatrix)
_check_if_params_are_ray_dmatrix, RayXGBMixin)
from lightgbm_ray.main import train, predict, RayDMatrix, RayParams

import warnings
Expand Down Expand Up @@ -83,7 +83,14 @@ def _treat_method_doc(doc: str, insert_before: str) -> str:
return doc


class _RayLGBMModel:
class _RayLGBMModel(RayXGBMixin):
def _ray_get_wrap_evaluation_matrices_compat_kwargs(
self, label_transform=None) -> dict:
self.enable_categorical = False
self.feature_types = None
return super()._ray_get_wrap_evaluation_matrices_compat_kwargs(
label_transform=label_transform)

def _ray_set_ray_params_n_jobs(
self, ray_params: Optional[Union[RayParams, dict]],
n_jobs: Optional[int]) -> RayParams:
Expand Down Expand Up @@ -133,7 +140,7 @@ def _ray_fit(self,
eval_init_score)

if train_dmatrix is None:
wrap_evaluation_matrices_kwargs = dict(
train_dmatrix, evals = _wrap_evaluation_matrices(
missing=None,
X=X,
y=y,
Expand All @@ -150,18 +157,9 @@ def _ray_fit(self,
# changed in xgboost-ray:
create_dmatrix=lambda **kwargs: RayDMatrix(**{
**kwargs,
**ray_dmatrix_params
}))
try:
train_dmatrix, evals = _wrap_evaluation_matrices(
**wrap_evaluation_matrices_kwargs)
except TypeError as e:
if "enable_categorical" in str(e):
train_dmatrix, evals = _wrap_evaluation_matrices(
**wrap_evaluation_matrices_kwargs,
enable_categorical=False)
else:
raise e
**ray_dmatrix_params,
}),
**self._ray_get_wrap_evaluation_matrices_compat_kwargs())

eval_names = eval_names or []

Expand Down
3 changes: 2 additions & 1 deletion requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ yapf==0.23.0
petastorm
pytest
pyarrow
ray[tune]
ray[tune, data]
scikit-learn
modin
git+https://github.com/ray-project/xgboost_ray.git
parameterized
packaging

# workaround for now
protobuf<4.0.0
tensorboardX==2.2