Need to specify to native lightgbm learner if given columns are categorical
Need to specify to native lightgbm learner if given columns are categorical Creating issue to track this based on conversation with @gopinutakki here
When we assemble columns in spark we should propagate any columns that were indexed (via stringindexer or our valueindexer) to lightgbm native code
updating based on conversation here -- it looks like it should be an easy fix, see here: https://github.com/Microsoft/LightGBM/blob/93764fda72ed3f7144455abd1e616f98be71c554/docs/Parameters.rst#categorical_feature and here: https://github.com/Microsoft/LightGBM/blob/93764fda72ed3f7144455abd1e616f98be71c554/docs/Advanced-Topics.rst#categorical-feature-support We just need to supply this parameter with the known categorical columns to lightgbm. We can expose this parameter to the user in case the user knows they are categorical and also we can automatically infer the columns that are categorical if they have been string indexed/value indexed based on the DataFrame metadata
So the https://github.com/Azure/mmlspark/blob/master/src/lightgbm/src/main/scala/LightGBMUtils.scala do not encode the categorical features and I should transform the dataset before by myself?
@friyal if you use the helper method featurizeData it will actually one-hot-encode the categoricals, but that is just a helper method. LightGBMClassifier/Regressor uses the Spark ML api so it can be compatible with all spark transforms (eg CrossValidator), which only takes in a vector of doubles for the features column.
This issue is more about enhancing how we handle categoricals that have been passed to LightGBM (eg index but don't one-hot-encode, and pass the list of categorical columns to the learner directly)
Could you please expose this parameter so we can use the native LightGBM categorical features support? This is really important if we have categorical features with MANY levels and one-hot encoding is not feasible
fix has been merged to master
reopening as it looks like fix wasn't correct, the name/index passed to lightgbm should be for the slot and not for a column name, good thing this isn't released yet
fixed again with new PR #463