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: Check whether target distribution passed and handled properly
docstr_tok: ["Check","whether","target","distribution","passed","and","handled","properly"]
code: def test_target_distro_scaled_to_1(self):
      """
      Check whether target distribution passed and handled properly
      """  # noqa
      data = ["apple", "apple", "banana", "apple", "apple", "orange"]
  
      # Scaled weights (sum to 1)
      tweights = {"apple": 4 / 6, "banana": 1 / 6, "orange": 1 / 6}
  
      enc = OneHotEncoder(
          use_unknown=False, is_target=True, target_weights=tweights
      )
      enc.prepare(data)
  
      # Get the ground-truth weights
      iweights = torch.ones(size=(len(tweights),))
      for key, value in tweights.items():  # accounts for order
          iweights[enc.map[key]] = value
  
      # Check inverse weights correct
      self.assertTrue(
          np.all(((enc.index_weights - iweights) == 0).tolist())
      )
  
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 4 for calling the TestOnehot obj's underlying member method code with example usage: obj.test_target_distro_scaled_to_1() without return types