code: def test_value_difference_metric_categories(data):
      # Check that "auto" is equivalent to provide the number categories
      # beforehand
      X, y = data
  
      encoder = OrdinalEncoder(dtype=np.int32)
      X_encoded = encoder.fit_transform(X)
      n_categories = np.array([len(cat) for cat in encoder.categories_])
  
      vdm_auto = ValueDifferenceMetric().fit(X_encoded, y)
      vdm_categories = ValueDifferenceMetric(n_categories=n_categories)
      vdm_categories.fit(X_encoded, y)
  
      np.testing.assert_array_equal(
          vdm_auto.n_categories_, n_categories
      )
      np.testing.assert_array_equal(
          vdm_auto.n_categories_, vdm_categories.n_categories_
      )
  
file_path: imbalanced-learn/imblearn/metrics/tests/test_pairwise.py
imports: import numpy
  import pytest
  from sklearn.exceptions import NotFittedError
  from sklearn.preprocessing import LabelEncoder, OrdinalEncoder
  from sklearn.utils._testing import _convert_container
  from imblearn.metrics.pairwise import ValueDifferenceMetric
label_desc: Use image node_id 4 for calling a global function with example usage: test_value_difference_metric_categories(data) without return types