Last active
July 26, 2022 14:17
-
-
Save amqdn/f3ba1ea30e4e21c24617f6d7aec75212 to your computer and use it in GitHub Desktop.
Implementing Class Rectification Loss in fast.ai
Glad it's helping!
From the paper: "Given different individual class data sample sizes, we define Ωimb as the minimum percentage count of data samples required over all classes in order to form an overall uniform (i.e. balanced) class distribution in the training data."
The authors did not provide an explicit formulation for Ωimb, so I had to infer it.
There are two ways to think about this:
1) What percentage of the overall number of samples does the class with the least amount of samples represent? E.g., if you have 5 classes with [100, 100, 50, 50, 25] sample counts, 25 / (100 + 100 + 50 + 50 + 25) ≈ 0.077. The problem with this is: Taking 7.7% of each class will not result in a balanced class distribution.
2) Between the majority number of samples 100 in the above example and the minority number of samples 25, 25 constitutes 25% of the maximum amount for any given class in this example set. If you take 25% of 100, you will get 25 for the majority classes. It's better, but then you see that if you take 25% of 50, you have a similar problem of not having balanced class distribution. Still, I preferred this alternative, and you see that in the code.
These were my best guesses. Maybe it'll inspire you to find something better!
…On Tue, Sep 22, 2020 at 1:19 AM 2foil ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
@amqdn <https://github.com/amqdn> Thanks for your tutorial ❤️, it helps
me a lot when implementing CRLloss.
Here I have one question.
Now I'm dealing with one training dataset, which have multiple majority
and minority classes.
So how to compute the omega in CRLloss?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<https://gist.github.com/f3ba1ea30e4e21c24617f6d7aec75212#gistcomment-3462729>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJTKJWWYD4DLTTP2CCIZQKDSHBMZPANCNFSM4OQPT3KA>
.
@amqdn Got it 😊, thanks for your explanation. ❤️
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@amqdn Thanks for your tutorial ❤️, it helps me a lot when implementing CRLloss.
Here I have one question.
Now I'm dealing with one training dataset, which has multiple majority and minority classes.
So how to compute the
omega
in CRLloss?