In order for the model to pay more attention to examples where a loan was defaulted, class weights can be used so that the prediction error is greater when an instance of an underrepresented class is misclassified.

Creating class weights

A method that avoids the limitations of the scikit-learn compute_class_weight method and allows class weights to be generated when providing a set of multi-class or multi-label labels using Python, which also supports a single encoding format.

Using class weights in a single-output model with TensorFlow Keras

Example of using class weights in conjunction with the TensorFlow Keras application.

Using class weights in a multi-output model with TensorFlow Keras

Example of using class weights in a multi-output model with TensorFlow Keras.

The central idea of ​​using class weights and addressing class imbalance in a multi-output model is to integrate the weights into a customized loss function.

Conclusions

LEAVE A REPLY

Please enter your comment!
Please enter your name here