code: def test_ng_dissim(self):
      X = np.array([[0, 1, 2, 0, 1, 2], [0, 1, 2, 0, 1, 1]])
      centroids = X
      membship = np.array([[1, 0], [0, 1]])
  
      assert_array_equal(
          np.array([0.0, 1.0]),
          ng_dissim(centroids, X[0], X=X, membship=membship),
      )
      assert_array_equal(
          np.array([1.0, 0.0]),
          ng_dissim(centroids, X[1], X=X, membship=membship),
      )
  
      # Unit test for initialization (i.e., same as matching_dissim)
      membship = np.array([[0, 0], [0, 0]])
      mdiss_00 = matching_dissim(np.array([X[0]]), np.array([X[0]]))[0]
      mdiss_01 = matching_dissim(np.array([X[0]]), np.array([X[1]]))[0]
      mdiss_11 = matching_dissim(np.array([X[1]]), np.array([X[1]]))[0]
  
      assert_array_equal(
          np.array([mdiss_00, mdiss_01]),
          ng_dissim(centroids, X[0], X=X, membship=membship),
      )
      assert_array_equal(
          np.array([mdiss_01, mdiss_11]),
          ng_dissim(centroids, X[1], X=X, membship=membship),
      )
  
      # Unit test for NaN
      X = np.array([[np.NaN, 1, 2, 0, 1, 2], [0, 1, 2, 0, 1, 1]])
      centroids = X
      membship = np.array([[1, 0], [0, 1]])
  
      assert_array_equal(
          np.array([1.0, 2.0]),
          ng_dissim(centroids, X[0], X=X, membship=membship),
      )
      assert_array_equal(
          np.array([2.0, 0.0]),
          ng_dissim(centroids, X[1], X=X, membship=membship),
      )
  
      # Unit test for initialization with NaN(i.e., same as matching_dissim)
      membship = np.array([[0, 0], [0, 0]])
      mdiss_00 = matching_dissim(np.array([X[0]]), np.array([X[0]]))[0]
      mdiss_01 = matching_dissim(np.array([X[0]]), np.array([X[1]]))[0]
      mdiss_11 = matching_dissim(np.array([X[1]]), np.array([X[1]]))[0]
  
      assert_array_equal(
          np.array([mdiss_00, mdiss_01]),
          ng_dissim(centroids, X[0], X=X, membship=membship),
      )
      assert_array_equal(
          np.array([mdiss_01, mdiss_11]),
          ng_dissim(centroids, X[1], X=X, membship=membship),
      )
  
      X = np.array(
          [
              ["a", "b", "c", "d"],
              ["a", "b", "e", "d"],
              ["d", "c", "b", "a"],
          ]
      )
      centroids = np.array([["a", "b", "c", "d"], ["d", "c", "b", "a"]])
      membship = np.array([[1, 1, 0], [0, 0, 1]])
  
      assert_array_equal(
          np.array([0.5, 4.0]),
          ng_dissim(centroids, X[0], X=X, membship=membship),
      )
      assert_array_equal(
          np.array([1.0, 4.0]),
          ng_dissim(centroids, X[1], X=X, membship=membship),
      )
      assert_array_equal(
          np.array([4.0, 0.0]),
          ng_dissim(centroids, X[2], X=X, membship=membship),
      )
  
      # Unit test for initialization (i.e., same as matching_dissim)
      membship = np.array([[0, 0, 0], [0, 0, 0]])
      mdiss_00 = matching_dissim(np.array([X[0]]), np.array([X[0]]))[0]
      mdiss_01 = matching_dissim(np.array([X[0]]), np.array([X[1]]))[0]
      mdiss_11 = matching_dissim(np.array([X[1]]), np.array([X[1]]))[0]
      mdiss_02 = matching_dissim(np.array([X[0]]), np.array([X[2]]))[0]
      mdiss_12 = matching_dissim(np.array([X[0]]), np.array([X[2]]))[0]
      mdiss_22 = matching_dissim(np.array([X[2]]), np.array([X[2]]))[0]
  
      assert_array_equal(
          np.array([mdiss_00, mdiss_02]),
          ng_dissim(centroids, X[0], X=X, membship=membship),
      )
      assert_array_equal(
          np.array([mdiss_01, mdiss_12]),
          ng_dissim(centroids, X[1], X=X, membship=membship),
      )
      assert_array_equal(
          np.array([mdiss_12, mdiss_22]),
          ng_dissim(centroids, X[2], X=X, membship=membship),
      )
  
file_path: kmodes/kmodes/util/tests/test_dissim.py
imports: import unittest
  import numpy
  from sklearn.utils._testing import assert_array_equal
  from kmodes.util.dissim import matching_dissim, euclidean_dissim, ng_dissim
  from kmodes.util.dissim import jaccard_dissim_binary, jaccard_dissim_label
label_desc: Use image node_id 5 for calling the TestDissimilarityMeasures obj's underlying member method code with example usage: obj.test_ng_dissim() without return types