-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there a way to map pandas categorical variable to integer #69
Comments
AFAIK you need to pass the |
@zyxue Hi, I encountered the same issue. How did you manage to overcome it? |
I switched to catboost, https://catboost.ai/en/docs/concepts/java-package |
@shuttie Hi, I do set the params categorical_feature when I train the model, so you can see the model shows that :
When using Python to train or predict a LightGBM model, I can use the following code:
However, in Java, I can only pass a double list to the model for prediction. And that meke it different for the same model inferenced in py and java |
@zyxue Do you have some example code of this you could share? |
I have toy model that takes three variables,
x1, x2, x3
,x3
is a categorical variable with two categories,a
andb
. The model is trained using Python API,The serialized model file is like
As seen, at the end of the file it includes the
pandas_categorical
. Now, I'd like to serve the model in Java, I've made some demo code working,But I'm not sure what's the best way to map
x3
(e.g.a
orb
) to its corresponding integral value properly in Java? In Python, it's handled automatically if the input is apd.DataFrame
.The text was updated successfully, but these errors were encountered: