code: def test_ml_4_classes():
      actuals = tf.constant(
          [[1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 0, 1]], dtype=tf.float32
      )
      predictions = tf.constant(
          [
              [0.97, 0.56, 0.83, 0.77],
              [0.34, 0.95, 0.7, 0.89],
              [0.95, 0.45, 0.23, 0.56],
          ],
          dtype=tf.float32,
      )
      # Initialize
      hl_obj = HammingLoss("multilabel", threshold=0.8)
      hl_obj.update_state(actuals, predictions)
      # Check results
      check_results(hl_obj, 0.16666667)
  
file_path: addons/tensorflow_addons/metrics/tests/hamming_test.py
imports: import numpy
  import tensorflow
  from tensorflow.keras import layers
  from tensorflow_addons.metrics import HammingLoss, hamming_distance
label_desc: Use image node_id 5 for calling a global function with example usage: test_ml_4_classes() without return types