class_docstr: Test the OHE vector encoder
  
  NOTE, this is sensitive to the mapping of enc.map. If your unit-tests are failing, check to see if the enc.map order matches what the encoded_data should be; this is based on the mapped-place. Using np.unique() inadvertently sorts the data neatly, hence allowing an intuitive place of which order each category is.
class_docstr_tok: ["Test","the","OHE","vector","encoder","NOTE",",","this","is","sensitive","to","the","mapping","of","enc.map",".","If","your","unit-tests","are","failing",",","check","to","see","if","the","enc.map","order","matches","what","the","encoded_data","should","be",";","this","is","based","on","the","mapped-place",".","Using","np.unique","(",")","inadvertently","sorts","the","data","neatly",",","hence","allowing","an","intuitive","place","of","which","order","each","category","is","."]
docstr: Tests the case where `use_unknown` is True; this means that the OHE vector is N categories + 1, where the first index represents UNK token.
  
  Checks:
  (1) UNKS are handled by "1" in the first index
  (2) Nones or unrecognized categories are both handled
  (3) The decode/encode map order is the same
docstr_tok: ["Tests","the","case","where","`","use_unknown","`","is","True",";","this","means","that","the","OHE","vector","is","N","categories","+","1",",","where","the","first","index","represents","UNK","token",".","Checks",":","(","1",")","UNKS","are","handled","by","``","1","''","in","the","first","index","(","2",")","Nones","or","unrecognized","categories","are","both","handled","(","3",")","The","decode\/encode","map","order","is","the","same"]
code: def test_encode_and_decode_with_unknown_token(self):
      """
      Tests the case where `use_unknown` is True; this means that the OHE vector is N categories + 1, where the first index represents UNK token.
  
      Checks:
      (1) UNKS are handled by "1" in the first index
      (2) Nones or unrecognized categories are both handled
      (3) The decode/encode map order is the same
      """  # noqa
      data = [
          "category 1",
          "category 3",
          "category 4",
          None,
          "category 3",
      ]
      test_data = [
          "CATEGORY 1",
          "category 2",
          "category 1",
          "category 3",
          None,
      ]
  
      ytest = [
          _UNCOMMON_WORD,
          _UNCOMMON_WORD,
          "category 1",
          "category 3",
          _UNCOMMON_WORD,
      ]
  
      enc = OneHotEncoder(use_unknown=True)
      enc.prepare(data)
  
      # Check the encoded patterns correct
      encoded_data = enc.encode(data)
      self.assertTrue(
          (
              encoded_data
              == Tensor(
                  [
                      [0.0, 1.0, 0.0, 0.0],  # category 1
                      [0.0, 0.0, 1.0, 0.0],  # category 3
                      [0.0, 0.0, 0.0, 1.0],  # category 4
                      [1.0, 0.0, 0.0, 0.0],  # None
                      [0.0, 0.0, 1.0, 0.0],  # category 3
                  ]
              )
          ).all()
      )
  
      # Check the decoded patterns correct
      decoded_data = enc.decode(enc.encode(test_data))
      for i in range(len(ytest)):
          self.assertTrue(decoded_data[i] == ytest[i])
  
file_path: lightwood/tests/unit_tests/encoder/categorical/test_onehot.py
imports: import unittest
  import torch
  from torch import Tensor
  import numpy
  from lightwood.encoder.categorical.onehot import OneHotEncoder
  from lightwood.helpers.constants import _UNCOMMON_WORD
label_desc: Use image node_id 1 for calling the TestOnehot obj's underlying member method code with example usage: obj.test_encode_and_decode_with_unknown_token() without return types