code: def test_fit_and_transform_categorical(self):
      # >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >>
      # Test categorical with no binary or ordinal features.
      # >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >>
  
      # Two features (one feature with == and !=).
      fbt = FeatureBinarizerFromTrees(
          treeNum=1,
          treeDepth=1,
          colCateg=self.col_categorical,
          randomState=self.random_state,
      )
      fbt.fit(self.X_train[self.col_categorical], self.y_train)
      self.assertListEqual(
          list(fbt.enc.keys()), [self.col_categorical[1]]
      )
      self.assertTrue(type(list(fbt.enc.values())[0]) is OneHotEncoder)
      temp = [("cat num", "!=", 0), ("cat num", "==", 0)]
      self.assertListEqual(fbt.features.to_list(), temp)
  
      # Test transform. Categorical values are converted to strings to be like FeatureBinarizer
      T = fbt.transform(self.X_test)
      self.assertListEqual(T.columns.to_list(), temp)
  
      # Test taking all available features.
      fbt = FeatureBinarizerFromTrees(
          treeNum=1,
          treeDepth=None,
          colCateg=self.col_categorical,
          randomState=self.random_state,
      )
      fbt.fit(self.X_train[self.col_categorical], self.y_train)
      self.assertListEqual(self.col_categorical, fbt.colCateg)
      self.assertListEqual(self.col_categorical, list(fbt.enc.keys()))
      temp = [
          ("cat alpha", "!=", "a"),
          ("cat alpha", "!=", "c"),
          ("cat alpha", "==", "a"),
          ("cat alpha", "==", "c"),
          ("cat num", "!=", 0),
          ("cat num", "!=", 2),
          ("cat num", "==", 0),
          ("cat num", "==", 2),
      ]
      self.assertListEqual(fbt.features.to_list(), temp)
  
      # Transform
      T = fbt.transform(self.X_test)
      self.assertListEqual(T.columns.to_list(), temp)
      a = T[("cat alpha", "==", "a")].to_numpy()
      b = (self.X_test["cat alpha"] == "a").astype(int).to_numpy()
      self.assertTrue(np.all(a == b))
      a = T[("cat alpha", "!=", "a")].to_numpy()
      b = 1 - b
      self.assertTrue(np.all(a == b))
      a = T[("cat num", "==", 2)].to_numpy()
      b = (self.X_test["cat num"] == 2).astype(int).to_numpy()
      self.assertTrue(np.all(a == b))
      a = T[("cat num", "!=", 2)].to_numpy()
      b = 1 - b
      self.assertTrue(np.all(a == b))
  
file_path: AIX360/tests/rbm/test_Feature_Binarizer_From_Trees.py
imports: from unittest import TestCase
  import numpy
  from numpy import ndarray
  from pandas import DataFrame
  from sklearn.datasets import load_breast_cancer
  from sklearn.model_selection import train_test_split
  from sklearn.preprocessing import OneHotEncoder, StandardScaler
  from aix360.algorithms.rbm import FeatureBinarizerFromTrees
label_desc: Use image node_id 5 for calling the TestFeatureBinarizerFromTrees obj's underlying member method code with example usage: obj.test_fit_and_transform_categorical() without return types