shuaigezhu / star_galaxy_classification

0 stars 1 forks source link

Using MSELoss with different weights to replace KLDivloss #29

Closed shuaigezhu closed 4 years ago

shuaigezhu commented 4 years ago
        weights_label = float(temp_y[other_pixel].shape[0] / (temp_y[label_pixel].shape[0]+temp_y[other_pixel].shape[0]))
        weights_other = float(temp_y[label_pixel].shape[0] / (temp_y[label_pixel].shape[0]+temp_y[other_pixel].shape[0]))
        quasar_num = 2893
        star_num = 1669
        galaxy_num = 6771
        quasar_weight = (1/(1+quasar_num/star_num + quasar_num/galaxy_num))*weights_label 
        star_weight = (1/(1+star_num/quasar_num + star_num/galaxy_num))*weights_label
        galaxy_weight = (1/(1+galaxy_num/star_num + galaxy_num/quasar_num))*weights_label

        output_loss = weights_other*loss(logits[[other_pixel]], y[[other_pixel]])+quasar_weight*loss(logits[[label_pixel]][0], y[[label_pixel]][0])+star_weight*loss(logits[[label_pixel]][1], y[[label_pixel]][1])+galaxy_weight*loss(logits[[label_pixel]][2], y[[label_pixel]][2])
kmyi commented 4 years ago

I am not sure about the equation that you put there. Does this balance the three losses? Maybe you could plot all three losses after the weights are applied?

Kwang

Kwang Moo YI Assistant Professor Dept. of Computer Science University of Victoria +1 (250) 472 5837

On Apr 2, 2020, at 14:14, Yufeng notifications@github.com wrote:

Closed #29.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

shuaigezhu commented 4 years ago

Screen Shot 2020-04-03 at 10 32 31 AM Screen Shot 2020-04-03 at 10 32 38 AM Screen Shot 2020-04-03 at 10 32 50 AM