示例#1
0
  def __init__(self, manipulator, **kwargs):
    super(SearchDriver, self).__init__(**kwargs)

    self.manipulator = manipulator
    self.wait_for_results = self.tuning_run_main.results_wait
    self.commit = self.tuning_run_main.commit

    self.generation = 0
    self.test_count = 0
    self.plugins = plugin.get_enabled(self.args)
    self.pending_result_callbacks = list()  # (DesiredResult, function) tuples
    self.root_technique = technique.get_root(self.args)
    self.objective.set_driver(self)
    self.pending_config_ids = set()
    self.best_result = None

    for t in self.plugins:
      t.set_driver(self)
    self.root_technique.set_driver(self)
    self.seed_cfgs = []
    for cfg_filename in reversed(self.args.seed_configuration):
      if os.path.exists(cfg_filename):
        self.seed_cfgs.append(manipulator.load_from_file(cfg_filename))
      else:
        log.error('no such file for --seed-configuration %s', cfg_filename)

    self.plugins.sort(key=_.priority)
示例#2
0
    def __init__(self, manipulator, extra_seeds=None, **kwargs):
        super(SearchDriver, self).__init__(**kwargs)
        if extra_seeds is None:
            extra_seeds = []
        self.manipulator = manipulator
        self.wait_for_results = self.tuning_run_main.results_wait
        self.commit = self.tuning_run_main.commit

        self.generation = 0
        self.test_count = 0
        self.plugins = plugin.get_enabled(self.args)
        self.pending_result_callbacks = list(
        )  # (DesiredResult, function) tuples
        # deepcopy is required to have multiple tuning runs in a single process
        self.root_technique = copy.deepcopy(technique.get_root(self.args))
        self.objective.set_driver(self)
        self.pending_config_ids = set()
        self.best_result = None

        for t in self.plugins:
            t.set_driver(self)
        self.root_technique.set_driver(self)
        self.seed_cfgs = list(extra_seeds)
        for cfg_filename in reversed(self.args.seed_configuration):
            if os.path.exists(cfg_filename):
                self.seed_cfgs.append(manipulator.load_from_file(cfg_filename))
            else:
                log.error('no such file for --seed-configuration %s',
                          cfg_filename)

        self.plugins.sort(key=_.priority)
    def __init__(self, manipulator, extra_seeds=None, **kwargs):
        super(SearchDriver, self).__init__(**kwargs)
        if extra_seeds is None:
            extra_seeds = []
        self.manipulator = manipulator
        self.wait_for_results = self.tuning_run_main.results_wait
        self.commit = self.tuning_run_main.commit

        self.generation = 0
        self.test_count = 0
        self.plugins = plugin.get_enabled(self.args)
        self.pending_result_callbacks = list(
        )  # (DesiredResult, function) tuples
        # deepcopy is required to have multiple tuning runs in a single process
        if self.args.list_techniques:
            techniques, generators = technique.all_techniques()
            for t in techniques:
                print t.name
            sys.exit(0)

        if self.args.generate_bandit_technique:
            # generate a bandit
            self.root_technique = AUCBanditMetaTechnique.generate_technique(
                manipulator)
        else:
            self.root_technique = copy.deepcopy(technique.get_root(self.args))

        if isinstance(self.root_technique, AUCBanditMetaTechnique):
            self.session.flush()
            info = BanditInfo(
                tuning_run=self.tuning_run,
                c=self.root_technique.bandit.C,
                window=self.root_technique.bandit.window,
            )
            self.session.add(info)
            for t in self.root_technique.techniques:
                subtechnique = BanditSubTechnique(bandit_info=info,
                                                  name=t.name)
                self.session.add(subtechnique)

        self.objective.set_driver(self)
        self.pending_config_ids = set()
        self.best_result = None

        for t in self.plugins:
            t.set_driver(self)
        self.root_technique.set_driver(self)
        self.seed_cfgs = list(extra_seeds)
        for cfg_filename in reversed(self.args.seed_configuration):
            if os.path.exists(cfg_filename):
                self.seed_cfgs.append(manipulator.load_from_file(cfg_filename))
            else:
                log.error('no such file for --seed-configuration %s',
                          cfg_filename)

        self.plugins.sort(key=_.priority)
示例#4
0
  def __init__(self, manipulator, extra_seeds=None, extra_criteria=None, **kwargs):
    super(SearchDriver, self).__init__(**kwargs)
    if extra_seeds is None:
      extra_seeds = []
    self.manipulator = manipulator
    self.wait_for_results = self.tuning_run_main.results_wait
    self.commit = self.tuning_run_main.commit
    self.extra_criteria = extra_criteria

    self.generation = 0
    self.test_count = 0
    self.plugins = plugin.get_enabled(self.args)
    self.pending_result_callbacks = list()  # (DesiredResult, function) tuples
    # deepcopy is required to have multiple tuning runs in a single process
    if self.args.list_techniques:
      techniques, generators = technique.all_techniques()
      for t in techniques:
        print(t.name)
      sys.exit(0)

    if self.args.generate_bandit_technique:
      # generate a bandit
      self.root_technique = AUCBanditMetaTechnique.generate_technique(manipulator)
    else:
      self.root_technique = copy.deepcopy(technique.get_root(self.args))

    if isinstance(self.root_technique, AUCBanditMetaTechnique):
      self.session.flush()
      info = BanditInfo(tuning_run=self.tuning_run,
                        c=self.root_technique.bandit.C,
                        window=self.root_technique.bandit.window,)
      self.session.add(info)
      for t in self.root_technique.techniques:
        subtechnique = BanditSubTechnique(bandit_info=info,
                                          name=t.name)
        self.session.add(subtechnique)


    self.objective.set_driver(self)
    self.pending_config_ids = set()
    self.best_result = None
    self.new_results = []

    for t in self.plugins:
      t.set_driver(self)
    self.root_technique.set_driver(self)
    self.seed_cfgs = list(extra_seeds)
    for cfg_filename in reversed(self.args.seed_configuration):
      if os.path.exists(cfg_filename):
        self.seed_cfgs.append(manipulator.load_from_file(cfg_filename))
      else:
        log.error('no such file for --seed-configuration %s', cfg_filename)

    self.plugins.sort(key=_.priority)