microsoft / SynapseML

Simple and Distributed Machine Learning
http://aka.ms/spark
MIT License
5.07k stars 831 forks source link

LightGBM doesnt have hyper-parameters as attributes in the java object #875

Open victorconan opened 4 years ago

victorconan commented 4 years ago

Is your feature request related to a problem? Please describe. Currently it seems the hyper-parameters of LightGBM models do not exist as attributes in the java object. When I fit a model

lightgbm_classif = LightGBMClassifier(
featuresCol='features', 
isUnbalance=True, 
labelCol='label',  
)
lgbm_model = lightgbm_classif.fit(train_data)

When I retrieve the java obj and try to get learningRate

lgbm_java = lgbm_model._java_obj
lgbm_java.getParam("learningRate")

Got error: java.util.NoSuchElementException: Param learningRate does not exist.

Describe the solution you'd like I think it would be helpful to attach the hyper-parameters as attribute to the model object. I think after hyper-parameter tuning we would like to get the best set of hyper-parameters. Currently for LightGBM models, either doing thru the CrossValidator or TuneHyperparameters, I can't extract best set of parameters for LightGBM models.

Additional context N/A

welcome[bot] commented 4 years ago

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it.

imatiach-msft commented 4 years ago

@victorconan sorry about the issue you are encountering, I think this issue might actually be fixed on latest master but will need to check, this PR may have (hopefully?) fixed this: https://github.com/Azure/mmlspark/pull/864