Keras: Weighted Binary Crossentropy Implementation
问题 I'm new to Keras (and ML in general) and I'm trying to train a binary classifier. I'm using weighted binary cross entropy as a loss function but I am unsure how I can test if my implementation is correct. Is this an accurate implementation of weighted binary cross entropy? How could I test if it is? def weighted_binary_crossentropy(self, y_true, y_pred): logloss = -(y_true * K.log(y_pred) * self.weights[0] + \ (1 - y_true) * K.log(1 - y_pred) * self.weights[1]) return K.mean(logloss, axis=-1)