The Wayback Machine - https://web.archive.org/web/20220322203157/https://github.com/microsoft/SynapseML/issues/918
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

[LightGBM] Regression: how to penalize negative predictions #918

Open
brunocous opened this issue Sep 2, 2020 · 18 comments
Open

[LightGBM] Regression: how to penalize negative predictions #918

brunocous opened this issue Sep 2, 2020 · 18 comments

Comments

@brunocous
Copy link

@brunocous brunocous commented Sep 2, 2020

I have a simple regression task (using a LightGBMRegressor) where I want to penalize negative predictions more than positive ones. Is there a way to achieve this with the default regression LightGBM objectives (see https://lightgbm.readthedocs.io/en/latest/Parameters.html)? If not, is it somehow possible to define (many example for default LightGBM model) and pass a custom regression objective?

Thx in advance!

@welcome
Copy link

@welcome welcome bot commented Sep 2, 2020

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

@brunocous brunocous changed the title [LightGBM] Regression: penalize negative predictions [LightGBM] Regression: how to penalize negative predictions Sep 2, 2020
@tyler-romero
Copy link

@tyler-romero tyler-romero commented Sep 2, 2020

The simplest way might be to duplicate positive examples in your training set so that they naturally carry more influence during training.

@imatiach-msft
Copy link
Contributor

@imatiach-msft imatiach-msft commented Sep 4, 2020

"define (many example for default LightGBM model) and pass a custom regression objective"
@brunocous unfortunately, we don't have this currently in the mmlspark wrapper of lightgbm, but it would definitely be a great feature to add at some point.

@imatiach-msft
Copy link
Contributor

@imatiach-msft imatiach-msft commented Aug 18, 2021

I should update this thread that custom objectives have been added recently, so this should be possible now

@DefUs3r
Copy link

@DefUs3r DefUs3r commented Aug 22, 2021

Hi @imatiach-msft could you let me know if I can work on this?

@imatiach-msft
Copy link
Contributor

@imatiach-msft imatiach-msft commented Aug 23, 2021

@DefUs3r sure, what do you want to work on specifically? Are you thinking of adding an example on how to penalize negative predictions using a custom loss function?

@Mihir-Khandelwal
Copy link

@Mihir-Khandelwal Mihir-Khandelwal commented Aug 25, 2021

Hii @brunocous everything is almost fine on your provided link, but it could be more Attractive by using some more UI features, color schemes, and images. Also in your Python code learning, you can give the idea for them starting from the basics.

@imatiach-msft
Copy link
Contributor

@imatiach-msft imatiach-msft commented Aug 25, 2021

@Mihir-Khandelwal are you commenting on the right thread? I think you might have meant to comment elsewhere?

@pragyasrivastava0805
Copy link

@pragyasrivastava0805 pragyasrivastava0805 commented Aug 27, 2021

Can I be assigned this @imatiach-msft ?

@imatiach-msft
Copy link
Contributor

@imatiach-msft imatiach-msft commented Aug 27, 2021

@pragyasrivastava0805 sure, I just assigned the task to you

@pragyasrivastava0805
Copy link

@pragyasrivastava0805 pragyasrivastava0805 commented Aug 27, 2021

@imatiach-msft i am very new to open source,could you please walk me through and tell what exactly needs to be done

@Mihir-Khandelwal
Copy link

@Mihir-Khandelwal Mihir-Khandelwal commented Aug 28, 2021

@imatiach-msft Sorry i am new to this, as an microsoft recruting task, i was assigned a task to comment a code correction on any of the 100+ stars github account.

@navya002
Copy link

@navya002 navya002 commented Aug 29, 2021

I have a simple regression task (using a LightGBMRegressor) where I want to penalize negative predictions more than positive ones. Is there a way to achieve this with the default regression LightGBM objectives (see https://lightgbm.readthedocs.io/en/latest/Parameters.html)? If not, is it somehow possible to define (many example for default LightGBM model) and pass a custom regression objective?

Thx in advance!

I want to ask just for clarity purpose that here ,positive and negatives samples refer to overestimation and underestimation , correct?

@brunocous
Copy link
Author

@brunocous brunocous commented Aug 30, 2021

I want to ask just for clarity purpose that here ,positive and negatives samples refer to overestimation and underestimation , correct?

Correct. In the end, I went with just using the quantile regression objective to penalise overestimations more. That worked well enough for my use case. Second trick that helped a lot is assigning samples that are more prone to overestimation a higher sample weight for training. Not perfect solutions, but it does the trick.

@navya002
Copy link

@navya002 navya002 commented Aug 30, 2021

@karnvaibhav11
Copy link

@karnvaibhav11 karnvaibhav11 commented Aug 30, 2021

I want to ask just for clarity purpose that here ,positive and negatives samples refer to overestimation and underestimation , correct?

Correct. In the end, I went with just using the quantile regression objective to penalise overestimations more. That worked well enough for my use case. Second trick that helped a lot is assigning samples more prone to overestimate a higher sample weight for training. Not perfect solutions, but it does the trick.

Please assign me this @brunocous @imatiach-msft

@karnvaibhav11
Copy link

@karnvaibhav11 karnvaibhav11 commented Aug 31, 2021

Hi,
I have found a way to penalize the negative prediction in Regression by using the concepts of Adaboost penalization of wrong Classification Penalization. Basically what it does is, it updates the weight of the negative residual and increase its training example for the next model. This ensures that if the value is overestimated it penalizes it more. It's a completely new concept which I researched and the work is still in progress.
Please find the attached Docx. which has the steps that I followed
and pdf for the code. Note that I haven't created the intervals due to the lack of time and to meet my Microsoft Project deadline. But I'll work on it later on.
Also, I am unable to create a pull request so I am sharing these files over here. Will love to hear your feedback. Thanks.

Penalizing the Negative Prediction in a Regression Problem.docx
M2LinearRegression.pdf

@ParulSrivastava
Copy link

@ParulSrivastava ParulSrivastava commented Dec 5, 2021

Penalizing.the.Negative.Prediction.in.a.Regression.Problem.docx

I have Created a pipeline using Azure ML for Regression Model

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment