SynapseML icon indicating copy to clipboard operation
SynapseML copied to clipboard

LightGBM feature Importances

Open bigdataexplorer opened this issue 8 years ago • 12 comments

In Spark, we can get the feature importances from GBT and Random Forest. Can we do the same with LightGBM ?

bigdataexplorer avatar Jun 01 '18 09:06 bigdataexplorer

Also looking for same information. Not sure whether LightGBMClassificationModel provides an API for accessing such information.

ywskycn avatar Jun 06 '18 00:06 ywskycn

@bigdataexplorer @ywskycn yes, this is definitely possible to do, we just need to add the functionality

imatiach-msft avatar Jun 16 '18 03:06 imatiach-msft

Anything I can help ?

bigdataexplorer avatar Jun 17 '18 13:06 bigdataexplorer

@imatiach-msft does light GBM provide this API? If not this might be a bigger add

mhamilton723 avatar Jun 18 '18 22:06 mhamilton723

@mhamilton723 yes it does, it should be simple to add

imatiach-msft avatar Jun 18 '18 22:06 imatiach-msft

I think we can just add a new API in LightGBMBooster, calling LGBM_BoosterFeatureImportance() in c_api.cpp.

ywskycn avatar Jun 19 '18 09:06 ywskycn

@bigdataexplorer @rohanmonga @ywskycn @mhamilton723 I added a PR here for feature importances in LightGBM: https://github.com/Azure/mmlspark/pull/333

imatiach-msft avatar Jun 29 '18 22:06 imatiach-msft

@bigdataexplorer @rohanmonga @ywskycn @mhamilton723 the PR has been checked in so closing this issue - it will be in the next release (0.14) or you can use the latest custom build:

--packages com.microsoft.ml.spark:mmlspark_2.11:0.13.dev0+1.ga8e702f --repositories https://mmlspark.azureedge.net/maven

imatiach-msft avatar Jul 03 '18 16:07 imatiach-msft

thank you!

rohanmonga avatar Jul 03 '18 17:07 rohanmonga

Thanks alot @imatiach-msft ! I will give it a try.

bigdataexplorer avatar Jul 03 '18 18:07 bigdataexplorer

Hey guys, for pyspark LightGBM (mmlspark.lightgbm), getFeatureImportances only returns a list of values, but they don't map to the feature names, is there a workaround of that?

lind1022 avatar Nov 11 '19 22:11 lind1022

@imatiach-msft for PySpark getFeatureImportances, is there a workaround for returning a dict of feature names and values vs. just returning a list of values?

mmchougule avatar Feb 18 '20 16:02 mmchougule