I am creating a neural network using TensorFlow (v2.9.2) for an imbalanced image dataset. While doing so, I noticed that model.compile()
method has an argument loss_weights
, and model.fit()
has an argument class_weight
. I know that the loss_weights
argument would transform the loss function to a weighted one and propagate the loss proportionately. But I am confused about the class_weight
argument.
My questions:
1. In what way do they differ from each other, specifically in terms of affecting the training process?
2. Should the value of class_weight
argument be the same as loss_weights
argument, considering that the distribution ratios among the categories remain the same throughout the process?