Skip to content
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

Custom loss function for the multiple responses/outputs #1985

Closed
junjiwoo opened this issue Feb 1, 2019 · 5 comments
Closed

Custom loss function for the multiple responses/outputs #1985

junjiwoo opened this issue Feb 1, 2019 · 5 comments

Comments

@junjiwoo
Copy link

junjiwoo commented Feb 1, 2019

To be more simple, bivariate case, y_1 is 0 or 1, y_2 is continuous. Is it possible to customize the loss function to L = Gini + SSE? Or L = classification lossVregression loss where V can be a matrix for higher dimension.

@guolinke
Copy link
Collaborator

guolinke commented Feb 2, 2019

you can base on multi-class template, and write the customed objective functions.

@junjiwoo junjiwoo closed this as completed Feb 2, 2019
@junjiwoo junjiwoo reopened this Feb 3, 2019
@junjiwoo
Copy link
Author

junjiwoo commented Feb 3, 2019

@guolinke Thank you for your reply. I am writing to seek further assistant from you about this issue. I found that the lgb.Dataset store label (y) as univariate. Multiclass is still univariate ( unique(y) = 0, 1, 2 ) case. In my case, it is multivariate/multi-output ( for bivariate case y = (0, 100), (1, 200), (0, -10), ...etc ). Thank you for your help.

@guolinke
Copy link
Collaborator

guolinke commented Feb 5, 2019

Hi @junjiwoo
I think you can use python package to achieve this, by the following processing.

  1. construct two lgb.Dataset, the X is the same, but with different label.
  2. construct two lgb.Booster, each accepts one lgb.Dataset
  3. write two objective functions, each for a lgb.Booster
  4. use lgb.Booster.update https://lightgbm.readthedocs.io/en/latest/Python-API.html#lightgbm.Booster.update , to train the booster. You can call this in the loop for mulitply iterations.

BTW, for the step 4, you may need to some shares between two datasets, as your objective function needs the information from both two data.

@junjiwoo
Copy link
Author

junjiwoo commented Feb 5, 2019

Thank you for your prompt response. I will follow your advice. I saw many related questions and requests. To the best of my knowledge, nobody implemented this yet. (gbm, mvtboost, xgboost, h2o)

@StrikerRUS
Copy link
Collaborator

We already have an issue related to multi-output: #524. I think it's better to keep the discussion in one place.

@lock lock bot locked as resolved and limited conversation to collaborators Mar 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants