I am building a model for sequence tagging using BiLSTM and CRF. I am using the Keras-CRF provided in this project. I successfully run the code and below is the summary of my model.
While the Keras_model support sample weight as 1D but we have to assign different weights at each time step as I want to give higher weights to less frequent tag class. so my weight_sample shape is (1114,100). It gives error as to compute the loss the function is:
if sample_weight is not None:
crf_loss = crf_loss * sample_weight
and an error occued of 'required broadcast shape'.
Can you please suggest how to use 2D sample weight within this code.
I am building a model for sequence tagging using BiLSTM and CRF. I am using the Keras-CRF provided in this project. I successfully run the code and below is the summary of my model. While the Keras_model support sample weight as 1D but we have to assign different weights at each time step as I want to give higher weights to less frequent tag class. so my weight_sample shape is (1114,100). It gives error as to compute the loss the function is: if sample_weight is not None: crf_loss = crf_loss * sample_weight and an error occued of 'required broadcast shape'.
Can you please suggest how to use 2D sample weight within this code.