deel-ai / deel-lip

Build and train Lipschitz constrained networks: TensorFlow implementation of k-Lipschitz layers
https://deel-ai.github.io/deel-lip/
MIT License
89 stars 10 forks source link

Losses handle multi-label classification #50

Closed cofri closed 2 years ago

cofri commented 2 years ago

The three binary losses (KR, HingeMargin and HKR) now handle multi-label classification, i.e. they accept y_true and y_pred of shape (batch_size, C) where C is the number of categories. Each category matches with a binary classification problem. The final element-wise loss corresponds to the average of the binary losses for all categories.

Moreover, the three KR formulations (binary, multi-label and multi-class) are similar and are unified in a single function _kr().