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

Feature request: Weighted Square Loss #139

Open
marcobonici opened this issue May 10, 2023 · 2 comments
Open

Feature request: Weighted Square Loss #139

marcobonici opened this issue May 10, 2023 · 2 comments

Comments

@marcobonici
Copy link

I would like to use a Weighted Mean Square Loss

$$ \mathrm{WMSL}=\frac{1}{N}\sum_{i=1}^N w_i(y_i-\hat{y}_i)^2 $$

This is very close to the standard Mean Square Loss, with the additional Weight array that can be used to give a higher weight to one of the output features.

Something similar can also be done for the absolute square loss, in principle.

After a chat with @chriselrod and @ChrisRackauckas I decided to open an issue and a related PR.
I have forkerd the repo and I am willing to implement this by myself and if you are satisfied merge it.
I should have done most of what is needed, but a bit of guidance would be useful, since I never did something like that before. Basically, right now I adapted the code for the Mean Square error already present in the repo.

Here is the link to my forker version. There are just a few lines of code I added in the loss.jl part. Today I'll check more deeply what I did, but mainly I have a doubt on the target function definition.

@chriselrod
Copy link
Contributor

If you'd like feedback, please open the PR. That makes it easier to see the diff.

I think starting with the MSE code is good; WMSE should be very similar.

@marcobonici
Copy link
Author

#140
I created the PR as requested.
I want to stress that there are possibly things that I didn't do in the correct way 😅

Thanks again for your help, I am waiting for your suggestions and feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants