I have a regression task, where positive error should be much worse than negative one. It means the importance of positive error bigger. For example, If real value is less than predicted one weights will change normally. But if real value bigger than predicted weights should change 10x times.

I'm not ready to make the whole algorithm from scratch, so there are must be ways or regression algorithms with that type of functionality in scikit-learn for instance.


1 Answer 1


In this case, it is possible to amplify positive values and the regression should work fine.

For instance, if value > 0, just multiply value by 10 (or more).

In some cases, applying a power could be better, which means if value > 0, then value^x, with x>1.0.

Note: Fine-tuning x could be interesting because it doesn't have to be an integer. It could be something like 1.5 or 2.3. This solution is very useful to amplify values in a non-linear way (the higher the value = the much worse the error is).

Conversely, you can also lower negative values error with x<1 in a non-linear way.

  • $\begingroup$ Here i have problem with Loss function, which i can't edit or simply create (for scikit-learn package, as i know). I need to fit a model by punishing severely for positive error, or if (y-y~) >0. The thing i'm interested in is if there any ways to implement this (some weights i can tune(in packages i don't know) or special Loss functions that allow me work in that way, or even different regression models, which allows it) $\endgroup$
    – Timofey
    Commented Dec 7, 2022 at 21:08
  • $\begingroup$ You don't have to modify the model, you just have to create data that fits your needs. Sometimes, adapted data is better than adapted models. $\endgroup$ Commented Dec 7, 2022 at 21:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.