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 if target wts do not sum to 1 properly handled.
  
  This handles cases where people may choose something like 1/class_size for weights.
  
  Index-weight order is sensitive to the mapping
docstr_tok: ["Tests","if","target","wts","do","not","sum","to","1","properly","handled",".","This","handles","cases","where","people","may","choose","something","like","1\/class_size","for","weights",".","Index-weight","order","is","sensitive","to","the","mapping"]
code: def test_distro_nonzeroweights(self):
      """
      Tests if target wts do not sum to 1 properly handled.
  
      This handles cases where people may choose something like 1/class_size for weights.
  
      Index-weight order is sensitive to the mapping
      """  # noqa
  
      data = ["apple", "apple", "banana", "apple", "apple", "orange"]
      tweights = {"apple": 100, "orange": 5000, "banana": 4}
  
      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
  
      for key, value in tweights.items():  # accounts for order
          iweights[enc.map[key]] = value
  
      # Reorder the weights with regards to the map
      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 6 for calling the TestOnehot obj's underlying member method code with example usage: obj.test_distro_nonzeroweights() without return types