-
Notifications
You must be signed in to change notification settings - Fork 611
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
Add class weights for optimizing the loss of tfa.text.crf model #817
Comments
Hello, Once we have the basic version of CRF layer merged, we'll get to adding in class weights to the loss. |
Can anyone guide me as to how I could go about modifying the current implementation of CRF loss so as to include class weights? |
/cc @jaspersjsun |
@bhack Thanks for cc me. I'm not sure whether it is necessary to add it to the official losses. Do we have further papers, materials or discussions to make this more convincing? Since only changing the emission scores ( |
@jaspersjsun when you say that changing the emission scores could be problematic, you mean theoretically or in terms of the code base? I'm studying this issue with the intent of implementing some approach (first in AllenNLP, then I could do it in TF as well). I think Lannoy et al.'s approach is theoretically flawed. I mean, I believe it can work in practice, but their theoretical motivation is not correct. If this is the case, we could do it with a much simpler approach (like weighted emission scores). |
TensorFlow Addons is transitioning to a minimal maintenance and release mode. New features will not be added to this repository. For more information, please see our public messaging on this decision: Please consider sending feature requests / contributions to other repositories in the TF community with a similar charters to TFA: |
Describe the feature and the current behavior/state.
It is necessary to add class weights when optimizing the loss of classification model on imbalance data. For example, when use tf.nn.softmax_cross_entropy_with_logits to calculate the model's loss, we can obtain a cross entropy tensor of which the shape is the same as labels so we can multiply class weights with the cross entropy to get a weighted loss. Similarly, when use tfa.text.crf, we should also get the weighted loss.
Relevant information
Which API type would this fall under (layer, metric, optimizer, etc.)
metric
Who will benefit with this feature?
All tfa.text.crf users
Any other info.
The text was updated successfully, but these errors were encountered: