class_docstr: Class to represent a linear tree model trained in the linear-tree package
  
  Attributes:
      __model (linear-tree model) : Linear Tree Model trained in linear-tree
      __splits (dict) : Dict containing split node information
      __leaves (dict) : Dict containing leaf node information
      __thresholds (dict) : Dict containing splitting threshold information
      __scaling_object (scaling object) : Scaling object to ensure scaled
          data match units of broader optimization problem
      __scaled_input_bounds (dict): Dict containing scaled input bounds
      __unscaled_input_bounds (dict): Dict containing unscaled input bounds
  
  References:
      * linear-tree : https://github.com/cerlymarco/linear-tree
docstr: Create a LinearTreeDefinition object and define attributes based on the
  trained linear model decision tree.
  
  Arguments:
      lt_regressor -- A LinearTreeRegressor model that is trained by the
          linear-tree package
  
  Keyword Arguments:
      scaling_object -- A scaling object to specify the scaling parameters
          for the linear model tree inputs and outputs. If None, then no
          scaling is performed. (default: {None})
      scaled_input_bounds -- A dict that contains the bounds on the scaled
          variables (the direct inputs to the tree). If None, then the
          user must specify the bounds via the input_bounds argument.
          (default: {None})
      unscaled_input_bounds -- A dict that contains the bounds on the
          variables (the direct inputs to the tree). If None, then the
          user must specify the scaled bounds via the scaled_input_bounds
          argument. (default: {None})
  
  Raises:
      Exception: Input bounds required. If unscaled_input_bounds and
          scaled_input_bounds is None, raise Exception.
docstr_tok: ["Create","a","LinearTreeDefinition","object","and","define","attributes","based","on","the","trained","linear","model","decision","tree",".","Arguments",":","lt_regressor","--","A","LinearTreeRegressor","model","that","is","trained","by","the","linear-tree","package","Keyword","Arguments",":","scaling_object","--","A","scaling","object","to","specify","the","scaling","parameters","for","the","linear","model","tree","inputs","and","outputs",".","If","None",",","then","no","scaling","is","performed",".","(","default",":","{","None","}",")","scaled_input_bounds","--","A","dict","that","contains","the","bounds","on","the","scaled","variables","(","the","direct","inputs","to","the","tree",")",".","If","None",",","then","the","user","must","specify","the","bounds","via","the","input_bounds","argument",".","(","default",":","{","None","}",")","unscaled_input_bounds","--","A","dict","that","contains","the","bounds","on","the","variables","(","the","direct","inputs","to","the","tree",")",".","If","None",",","then","the","user","must","specify","the","scaled","bounds","via","the","scaled_input_bounds","argument",".","(","default",":","{","None","}",")","Raises",":","Exception",":","Input","bounds","required",".","If","unscaled_input_bounds","and","scaled_input_bounds","is","None",",","raise","Exception","."]
code: def __init__(
      self,
      lt_regressor,
      scaling_object=None,
      scaled_input_bounds=None,
      unscaled_input_bounds=None,
  ):
      """Create a LinearTreeDefinition object and define attributes based on the
      trained linear model decision tree.
  
      Arguments:
          lt_regressor -- A LinearTreeRegressor model that is trained by the
              linear-tree package
  
      Keyword Arguments:
          scaling_object -- A scaling object to specify the scaling parameters
              for the linear model tree inputs and outputs. If None, then no
              scaling is performed. (default: {None})
          scaled_input_bounds -- A dict that contains the bounds on the scaled
              variables (the direct inputs to the tree). If None, then the
              user must specify the bounds via the input_bounds argument.
              (default: {None})
          unscaled_input_bounds -- A dict that contains the bounds on the
              variables (the direct inputs to the tree). If None, then the
              user must specify the scaled bounds via the scaled_input_bounds
              argument. (default: {None})
  
      Raises:
          Exception: Input bounds required. If unscaled_input_bounds and
              scaled_input_bounds is None, raise Exception.
      """
      self.__model = lt_regressor
      self.__scaling_object = scaling_object
  
      # Process input bounds to insure scaled input bounds exist for formulations
      if scaled_input_bounds is None:
          if (
              unscaled_input_bounds is not None
              and scaling_object is not None
          ):
              lbs = scaling_object.get_scaled_input_expressions(
                  {k: t[0] for k, t in unscaled_input_bounds.items()}
              )
              ubs = scaling_object.get_scaled_input_expressions(
                  {k: t[1] for k, t in unscaled_input_bounds.items()}
              )
  
              scaled_input_bounds = {
                  k: (lbs[k], ubs[k])
                  for k in unscaled_input_bounds.keys()
              }
  
          # If unscaled input bounds provided and no scaler provided, scaled
          # input bounds = unscaled input bounds
          elif (
              unscaled_input_bounds is not None
              and scaling_object is None
          ):
              scaled_input_bounds = unscaled_input_bounds
          elif unscaled_input_bounds is None:
              raise ValueError(
                  "Input Bounds needed to represent linear trees as MIPs"
              )
  
      self.__unscaled_input_bounds = unscaled_input_bounds
      self.__scaled_input_bounds = scaled_input_bounds
  
      (
          self.__splits,
          self.__leaves,
          self.__thresholds,
      ) = _parse_tree_data(lt_regressor, scaled_input_bounds)
  
      self.__n_inputs = _find_n_inputs(self.__leaves)
      self.__n_outputs = 1
  
file_path: OMLT/src/omlt/linear_tree/lt_definition.py
imports: import numpy
  import lineartree
label_desc: Use image node_id 1 to create a new LinearTreeDefinition object  with example: obj = LinearTreeDefinition(lt_regressor, scaling_object, scaled_input_bounds, unscaled_input_bounds)