class_docstr: Class providing functionality for computing operations related to getting lower and upper bounds on zonotopes.
class_docstr_tok: ["Class","providing","functionality","for","computing","operations","related","to","getting","lower","and","upper","bounds","on","zonotopes","."]
docstr: Simple helper function to pre-process and adjust zonotope values to be within 0 - 1 range.
  This is written with image data from MNIST and CIFAR10 in mind using L-infty bounds.
  Each feature here starts with a single eps term.
  Users can implement custom pre-processors tailored to their data if it does not conform to these requirements.
  
  :param cent: original feature values between 0 - 1
  :param eps: the zonotope error terms.
  :return: adjusted center and eps values if center + eps exceed 1 or if center - eps falls below 0.
docstr_tok: ["Simple","helper","function","to","pre-process","and","adjust","zonotope","values","to","be","within","0","-","1","range",".","This","is","written","with","image","data","from","MNIST","and","CIFAR10","in","mind","using","L-infty","bounds",".","Each","feature","here","starts","with","a","single","eps","term",".","Users","can","implement","custom","pre-processors","tailored","to","their","data","if","it","does","not","conform","to","these","requirements",".",":","param","cent",":","original","feature","values","between","0","-","1",":","param","eps",":","the","zonotope","error","terms",".",":","return",":","adjusted","center","and","eps","values","if","center","+","eps","exceed","1","or","if","center","-","eps","falls","below","0","."]
code: def adjust_to_within_bounds(
      cent: np.ndarray, eps: np.ndarray
  ) -> Tuple[np.ndarray, np.ndarray]:
      """
      Simple helper function to pre-process and adjust zonotope values to be within 0 - 1 range.
      This is written with image data from MNIST and CIFAR10 in mind using L-infty bounds.
      Each feature here starts with a single eps term.
      Users can implement custom pre-processors tailored to their data if it does not conform to these requirements.
  
      :param cent: original feature values between 0 - 1
      :param eps: the zonotope error terms.
      :return: adjusted center and eps values if center + eps exceed 1 or if center - eps falls below 0.
      """
      for j in range(cent.shape[1]):
          # we assume that each feature will start with just a single eps term
          row_of_eps = np.argmax(eps[:, j])
          if cent[:, j] < eps[row_of_eps, j]:
              eps[row_of_eps, j] = (eps[row_of_eps, j] + cent[:, j]) / 2
              cent[:, j] = eps[row_of_eps, j]
          elif cent[:, j] > (1 - eps[row_of_eps, j]):
              eps[row_of_eps, j] = (
                  eps[row_of_eps, j] + (1 - cent[:, j])
              ) / 2
              cent[:, j] = 1 - eps[row_of_eps, j]
  
      return cent, eps
  
imports: from typing import Tuple, Union
  import numpy
  import torch
label_desc: Use image node_id 6 for calling the ZonoBounds obj's underlying member method code with example usage: obj.adjust_to_within_bounds(cent, eps) and returns: cent,  eps