Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MatthewsCorrelationCoefficient is always zero in binary classification #2781

Open
digital-thinking opened this issue Nov 17, 2022 · 0 comments

Comments

@digital-thinking
Copy link

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 11
  • TensorFlow version and how it was installed (source or binary): 2.10.1 (binary)
  • TensorFlow-Addons version and how it was installed (source or binary): 2.10.1 (binary)
  • Python version: 3.10
  • Is GPU used? (yes/no): yes

MCC does not work on binary labels with a single neuron as output, it always returns 0:
Last layer:

x = tf.keras.layers.Dense(1, activation='sigmoid')(x)
model.compile('sgd', 'binary_crossentropy', metrics=['accuracy', tfa.metrics.MatthewsCorrelationCoefficient(num_classes=2)])

Output always 0:
38s 19s/step - loss: 0.6899 - accuracy: 0.4843 - MatthewsCorrelationCoefficient: 0.0000e+00 - val_loss: 0.6934 - val_accuracy: 0.4096 - val_MatthewsCorrelationCoefficient: 0.0000e+00

The last comment from the user here also describes the problem, however the solution does not work anymore
#2339

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant