class_docstr: Creates a one-hot-encoding for binary class data. Assume two arbitrary categories :math:`A` and :math:`B`; representation for them will be as such:
  
   .. math::
  
      A &= [1, 0] \
      B &= [0, 1]
  
   This encoder is a specialized case of one-hot encoding (OHE); unknown categories are explicitly handled as [0, 0]. Unknowns may only be reported if the input row value is NULL (or python `None` type) or if new data, after the encoder is prepared, has examples outside the feature map.
  
   When data is typed with Lightwood, this class is only deployed if an input data type is explicitly recognized as binary (i.e. the column has only 2 unique values like True/False). If future data shows a new category (thus the data is no longer truly binary), this encoder will no longer be appropriate unless you are comfortable mapping ALL new classes as [0, 0].
  
   An encoder can represent a feature column or target column; in this case it represents a target, `is_target` is `True`, and `target_weights`. The `target_weights` parameter enables users to specify how heavily each class should be weighted within a mixer - useful in imbalanced classes. 
  
   By default, `dataprep_ml.StatisticalAnalysis` phase will provide `target_weights` as the relative fraction of each class in the data which is important for imbalanced populations; for example, suppose there is a 80/20 imbalanced representation across 3 different classes - `target_weights` will be a vector as such::
  
   target_weights = {"class1": 0.8, "class2": 0.2}
  
   Users should note that models will be presented with the inverse of the target weights, `inv_target_weights`, which will perform the 1/target_value_per_class operation. **This means large values will result in small weights for the model**.
   
docstr: Given a vector, normalizes so that the sum of elements is 1, using softmax.
  
  :param vec: Assigned weights for each category
docstr_tok: ["Given","a","vector",",","normalizes","so","that","the","sum","of","elements","is","1",",","using","softmax",".",":","param","vec",":","Assigned","weights","for","each","category"]
code: def _norm_vec(vec: List[float]):
      """
      Given a vector, normalizes so that the sum of elements is 1, using softmax.
  
      :param vec: Assigned weights for each category
      """  # noqa
      return softmax(vec)
  
file_path: lightwood/lightwood/encoder/categorical/binary.py
imports: from copy import deepcopy
  from typing import Dict, List, Iterable, Tuple
  import torch
  import numpy
  from scipy.special import softmax
  from lightwood.encoder.base import BaseEncoder
  from lightwood.helpers.constants import _UNCOMMON_WORD
  from lightwood.helpers.log import log
label_desc: Use image node_id 6 for calling the BinaryEncoder obj's underlying member method code with example usage: obj._norm_vec(vec) and returns: softmax