Closed lizhuoq closed 1 year ago
my flaml version is 1.2.4 my lightgbm version is 3.3.5
It's because the categorical and numeric features are reordered and grouped together by data preprocessing.
It's because the categorical and numeric features are reordered and grouped together by data preprocessing.
Thank you, this is very helpful. The 'landCover' variable is indeed a categorical variable.
The order of feature importance seems to have changed according to the order of features after grouping them. It means they are in one-to-one correspondence.
However, calling flaml.default.LGBMRegressor in sklearn may cause some ambiguity, as the order of 'feature_name' may not match the order of 'columns'.
I suggest doing this when using flaml.default.LGBMRegressor to avoid later encountering errors when calling other Python packages for analysis.
import flaml.default
import lightgbm
model = flaml.default.LGBMRegressor()
model.fit(X, y)
if all(model.feature_name_ == X.columns.tolist()):
pass
else:
model = lightgbm.LGBMRegressor(**model.get_params())
model.fit(X, y)
assert all(model.feature_name_ == X.columns.tolist())
Thanks for the suggestion. One solution is to disable data preprocessing in default.LGBMRegressor. Or make that configurable.
when i use flaml.default.LGBMRegressor, i found The order of features changes.
I use it in my own data set.
output:
but when i use lightgbm.LGBMRegressor, everything in order!
output
I don't know what's going on. Can you help me sort it out?
Thanks!