class_docstr: The numeric encoder takes numbers (float or integer) and converts it into tensors of the form:
  ``[0 if the number is none, otherwise 1, 1 if the number is positive, otherwise 0, natural_log(abs(number)), number/absolute_mean]``
  
  This representation is: ``[1 if the number is positive, otherwise 0, natural_log(abs(number)), number/absolute_mean]]`` if encoding target values, since target values can't be none.
  
  The ``absolute_mean`` is computed in the ``prepare`` method and is just the mean of the absolute values of all numbers feed to prepare (which are not none)
  
  ``none`` stands for any number that is an actual python ``None`` value or any sort of non-numeric value (a string, nan, inf)
class_docstr_tok: ["The","numeric","encoder","takes","numbers","(","float","or","integer",")","and","converts","it","into","tensors","of","the","form",":","``","[","0","if","the","number","is","none",",","otherwise","1",",","1","if","the","number","is","positive",",","otherwise","0",",","natural_log","(","abs","(","number",")",")",",","number\/absolute_mean","]","``","This","representation","is",":","``","[","1","if","the","number","is","positive",",","otherwise","0",",","natural_log","(","abs","(","number",")",")",",","number\/absolute_mean","]","]","``","if","encoding","target","values",",","since","target","values","ca","n't","be","none",".","The","``","absolute_mean","``","is","computed","in","the","``","prepare","``","method","and","is","just","the","mean","of","the","absolute","values","of","all","numbers","feed","to","prepare","(","which","are","not","none",")","``","none","``","stands","for","any","number","that","is","an","actual","python","``","None","``","value","or","any","sort","of","non-numeric","value","(","a","string",",","nan",",","inf",")"]
docstr: :param encoded_values: The encoded values to decode into single numbers
  :param decode_log: Whether to decode the ``log`` or ``linear`` part of the representation, since the encoded vector contains both a log and a linear part
  
  :returns: The decoded array
docstr_tok: [":","param","encoded_values",":","The","encoded","values","to","decode","into","single","numbers",":","param","decode_log",":","Whether","to","decode","the","``","log","``","or","``","linear","``","part","of","the","representation",",","since","the","encoded","vector","contains","both","a","log","and","a","linear","part",":","returns",":","The","decoded","array"]
code: def decode(
      self, encoded_values: torch.Tensor, decode_log: bool = None
  ) -> list:
      """
      :param encoded_values: The encoded values to decode into single numbers
      :param decode_log: Whether to decode the ``log`` or ``linear`` part of the representation, since the encoded vector contains both a log and a linear part
  
      :returns: The decoded array
      """  # noqa
  
      if not self.is_prepared:
          raise Exception(
              'You need to call "prepare" before calling "encode" or "decode".'
          )
  
      if decode_log is None:
          decode_log = self.decode_log
  
      # force = True prevents side effects on the original encoded_values
      ev = encoded_values.numpy(force=True)
  
      # set "divergent" value as default (note: finfo.max() instead of pow(10, 63))
      ret = np.full(
          (ev.shape[0],),
          dtype=float,
          fill_value=np.finfo(np.float64).max,
      )
  
      # `none` filter (if not a target column)
      if not self.is_target:
          mask_none = ev[:, -1] == 1
          ret[mask_none] = np.nan
      else:
          mask_none = np.zeros_like(ret)
  
      # sign component
      sign = np.ones(ev.shape[0], dtype=float)
      mask_sign = ev[:, 0] < 0.5
      sign[mask_sign] = -1
  
      # real component
      if decode_log:
          real_value = np.exp(ev[:, 1]) * sign
          overflow_mask = ev[:, 1] >= 63
          real_value[overflow_mask] = 10**63
          valid_mask = ~overflow_mask
      else:
          real_value = ev[:, 2] * self._abs_mean
          valid_mask = np.ones_like(real_value, dtype=bool)
  
      # final filters
      if self.positive_domain:
          real_value = abs(real_value)
  
      ret[valid_mask] = real_value[valid_mask]
  
      # set nan back to None
      if mask_none.sum() > 0:
          ret = ret.astype(object)
          ret[mask_none] = None
  
      return ret.tolist()
  
file_path: lightwood/lightwood/encoder/numeric/numeric.py
imports: import math
  from typing import Union
  import torch
  import numpy
  import pandas
  from type_infer.dtype import dtype
  from lightwood.encoder.base import BaseEncoder
  from lightwood.helpers.general import is_none
label_desc: Use image node_id 8 for calling the NumericEncoder obj's underlying member method code with example usage: obj.decode(encoded_values, decode_log) and returns: ret