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

How to finetune alpha and gamma? #23

Open
mobassir94 opened this issue Apr 11, 2020 · 0 comments
Open

How to finetune alpha and gamma? #23

mobassir94 opened this issue Apr 11, 2020 · 0 comments

Comments

@mobassir94
Copy link

for my given data problem(nlp task) if i use focal_loss(gamma=1.5,alpha = .2) then the result i get like this :
Train for 2000 steps, validate for 32 steps Epoch 1/4 1999/2000 [============================>.] - ETA: 0s - loss: 0.0436 - auc: 0.9015 ROC-AUC - epoch: 1 - score: 0.875631 2000/2000 [==============================] - 1737s 869ms/step - loss: 0.0436 - auc: 0.9015 - val_loss: 0.0453 - val_auc: 0.8754 Epoch 2/4 1999/2000 [============================>.] - ETA: 0s - loss: 0.0241 - auc: 0.9758 ROC-AUC - epoch: 2 - score: 0.903044 2000/2000 [==============================] - 1610s 805ms/step - loss: 0.0241 - auc: 0.9758 - val_loss: 0.0360 - val_auc: 0.9030 Epoch 3/4 1999/2000 [============================>.] - ETA: 0s - loss: 0.0215 - auc: 0.9812 ROC-AUC - epoch: 3 - score: 0.911900 2000/2000 [==============================] - 1612s 806ms/step - loss: 0.0215 - auc: 0.9812 - val_loss: 0.0352 - val_auc: 0.9118 Epoch 4/4 1999/2000 [============================>.] - ETA: 0s - loss: 0.0191 - auc: 0.9852 ROC-AUC - epoch: 4 - score: 0.909566 2000/2000 [==============================] - 1610s 805ms/step - loss: 0.0191 - auc: 0.9852 - val_loss: 0.0445 - val_auc: 0.9074 CPU times: user 4min 15s, sys: 23.7 s, total: 4min 39s Wall time: 1h 49min 31s

now when i tried focal_loss(gamma=2.0,alpha = .2) i get :

Train for 1896 steps, validate for 32 steps Epoch 1/3 1895/1896 [============================>.] - ETA: 0s - loss: 0.0107 - auc: 0.9842 ROC-AUC - epoch: 1 - score: 0.544101 1896/1896 [==============================] - 1644s 867ms/step - loss: 0.0107 - auc: 0.9842 - val_loss: 0.0860 - val_auc: 0.5423 Epoch 2/3 1895/1896 [============================>.] - ETA: 0s - loss: 0.0083 - auc: 0.9904 ROC-AUC - epoch: 2 - score: 0.573175 1896/1896 [==============================] - 1522s 803ms/step - loss: 0.0083 - auc: 0.9904 - val_loss: 0.0659 - val_auc: 0.5210 Epoch 3/3 1895/1896 [============================>.] - ETA: 0s - loss: 0.0070 - auc: 0.9946 ROC-AUC - epoch: 3 - score: 0.375477 1896/1896 [==============================] - 1522s 803ms/step - loss: 0.0070 - auc: 0.9945 - val_loss: 0.0396 - val_auc: 0.4966 CPU times: user 2min 54s, sys: 17.4 s, total: 3min 12s Wall time: 1h 18min 9s

terrible val_auc right?
please help me choose alpha and gamma for focal loss

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

1 participant