You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The interaction constraints do not seem to be working correctly when running lightgbm in a distributed context.
An issue was originally raised on the lightgbm-ray github where it was suggested this was likely an issue with LightGBM itself as the problem could also be reproduced in LightGBM Dask.
The constraints work as expected when running LightGBMw with no distributed data.
Reproducible example
Dask:
from distributed import Client, LocalCluster
import dask.dataframe as dd
import pandas as pd
from sklearn.datasets import load_boston
import lightgbm as lgb
if __name__ == "__main__":
print("loading data")
boston = load_boston()
X, y = boston.data, boston.target
params = {
'boosting_type': 'goss',
'objective': 'regression',
'metric': 'rmse',
'num_leaves': 10,
'max_depth': 4,
'learning_rate': 0.05,
'verbose': 10
}
print("initializing a Dask cluster")
cluster = LocalCluster()
client = Client(cluster)
print("created a Dask LocalCluster")
print("distributing training data on the Dask cluster")
df = pd.DataFrame(X, columns=boston.feature_names)
dX = dd.from_pandas(df, npartitions=4)
dy = dd.from_pandas(pd.Series(y, name="target"), npartitions=4)
constrained_feature = 'AGE'
other_features = [
x for x, y in enumerate(df.columns) if y != constrained_feature
]
constrained_feature_idx = [
x for x, y in enumerate(df.columns) if y == constrained_feature
]
constraint = [constrained_feature_idx, other_features]
print("beginning training")
dask_model = lgb.DaskLGBMRegressor(
interaction_constraints=constraint, **params)
dask_model.fit(dX, dy)
assert dask_model.fitted_
print("done training")
Description
The interaction constraints do not seem to be working correctly when running lightgbm in a distributed context.
An issue was originally raised on the lightgbm-ray github where it was suggested this was likely an issue with LightGBM itself as the problem could also be reproduced in LightGBM Dask.
The constraints work as expected when running LightGBMw with no distributed data.
Reproducible example
Dask:
Also present in Ray
ray-project/lightgbm_ray#41
Environment info
LightGBM version or commit hash:
Command(s) you used to install LightGBM
Additional info
On Ray, I receive the error:
The text was updated successfully, but these errors were encountered: