class_docstr: This class is initialized with the name of a json configuration file.
  The config contains information about a classification method and the
  hyperparameter arguments it needs to run. Its main purpose is to generate
  hyperpartitions (possible combinations of categorical hyperparameters).
docstr: method: method code or path to JSON file containing all the information
      needed to specify this enumerator.
docstr_tok: ["method",":","method","code","or","path","to","JSON","file","containing","all","the","information","needed","to","specify","this","enumerator","."]
code: def __init__(self, method):
      """
      method: method code or path to JSON file containing all the information
          needed to specify this enumerator.
      """
      if method in METHODS:
          # if the configured method is a code, look up the path to its json
          config_path = os.path.join(
              os.path.dirname(__file__), "methods", METHODS[method]
          )
      else:
          # otherwise, it must be a path to a file
          config_path = method
  
      with open(config_path) as f:
          config = json.load(f)
  
      self.name = config["name"]
      self.root_params = config["root_hyperparameters"]
      self.conditions = config["conditional_hyperparameters"]
      self.class_path = config["class"]
  
      # create hyperparameters from the parameter config
      self.parameters = {}
      for k, v in list(config["hyperparameters"].items()):
          param_type = HYPERPARAMETER_TYPES[v["type"]]
          self.parameters[k] = param_type(name=k, **v)
  
      # List hyperparameters are special. These are replaced in the
      # CPT with a size hyperparameter and sets of element hyperparameters
      # conditioned on the size.
      for name, param in list(self.parameters.items()):
          if isinstance(param, List):
              elements, conditions = param.get_elements()
              for e in elements:
                  self.parameters[e] = param.element
  
              # add the size parameter, remove the list parameter
              self.parameters[param.length.name] = param.length
              del self.parameters[param.name]
  
              # if this is a root param, replace its name with the new size
              # name in the root params list
              if param.name in self.root_params:
                  self.root_params.append(param.length.name)
                  self.root_params.remove(param.name)
  
              # if this is a conditional param, replace it there instead
              for var, cond in list(self.conditions.items()):
                  for val, deps in list(cond.items()):
                      if param.name in deps:
                          deps.append(param.length.name)
                          deps.remove(param.name)
                          self.conditions[var][val] = deps
  
              # finally, add all the potential sets of list elements as
              # conditions of the list's size
              self.conditions[param.length.name] = conditions
  
imports: from __future__ import absolute_import, unicode_literals
  import json
  import os
  from builtins import object, range
  from builtins import str
  import btb
  from atm.constants import METHODS
label_desc: Use image node_id 1 to create a new Method object from inherited base classes: object with example: obj = Method(method)