code: def test_weighted(self):
      cat_hinge_obj = hinge_metrics.CategoricalHinge()
      y_true = np.array(
          (
              (0, 1, 0, 1, 0),
              (0, 0, 1, 1, 1),
              (1, 1, 1, 1, 0),
              (0, 0, 0, 0, 1),
          ),
          dtype="float32",
      )
      y_pred = np.array(
          (
              (0, 0, 1, 1, 0),
              (1, 1, 1, 1, 1),
              (0, 1, 0, 1, 0),
              (1, 1, 1, 1, 1),
          ),
          dtype="float32",
      )
      sample_weight = np.array((1.0, 1.5, 2.0, 2.5))
      result = cat_hinge_obj(
          y_true, y_pred, sample_weight=sample_weight
      )
      self.assertAllClose(0.5, result, atol=1e-5)
  
file_path: keras/keras/metrics/hinge_metrics_test.py
imports: import numpy
  from keras import testing
  from keras.metrics import hinge_metrics
label_desc: Use image node_id 3 for calling the CategoricalHingeTest obj's underlying member method code with example usage: obj.test_weighted() without return types