Exemplo n.º 1
0
 def _init(self):
     if os.path.exists(self.trace_path):
         os.remove(self.trace_path)
          
     trace = Trace(self.trace_path, trace_level=2)
     trace.write( 1, 'main', {
         'hp_space': self.optimizer.hp_space,
         '__dict__': self.__dict__,
         'ds_name':self.evaluator.ds_name,
          } )
      
     self.trace = trace
     self.pool = make_pool(self.Pool)
      
     self._last_print = 0.
     self.last_eval_size = 0
     self.result_dict = {}
     self.hp_id_seq = []
     self.hp_id_pending = {}
     self.lock = RLock()
      
     self.y_dict = self.evaluator.get_y_dict()
     self.y_val_m = self.y_dict['val']
     self.trace.write(1,'y',self.y_dict) # trace this info for further analysis
      
     self.m = len(self.y_val_m)
      
     if self.salad_size == 1:
         self.bootstrap_matrix_km = np.ones( (1,self.m) )/ self.m
          
     else:
         rng = np.random.RandomState(self.seed) # provides the opportunity to have the same bootstrap matrix across different experiments.
         self.bootstrap_matrix_km = base.build_bootstrap_matrix(self.salad_size,self.m,self.essr, rng)
Exemplo n.º 2
0
    def _analyze_greedy(self,hp_id_N, ensemble_size=10):
        if not hasattr(self, 'greedy_w_km'):
            self.greedy_w_km = base.build_bootstrap_matrix(100, len(self.y_val_m), self.essr)
 
        loss_mN = self._get_loss_matrix(hp_id_N)
        ensemble_d, prob_d = greedy_ensemble(loss_mN, self.greedy_w_km, ensemble_size)
        hp_id_d = hp_id_N[ensemble_d]
        return self._eval_salad( hp_id_d, prob_d )
Exemplo n.º 3
0
    def _analyze_greedy(self, hp_id_N, ensemble_size=10):
        if not hasattr(self, 'greedy_w_km'):
            self.greedy_w_km = base.build_bootstrap_matrix(
                100, len(self.y_val_m), self.essr)

        loss_mN = self._get_loss_matrix(hp_id_N)
        ensemble_d, prob_d = greedy_ensemble(loss_mN, self.greedy_w_km,
                                             ensemble_size)
        hp_id_d = hp_id_N[ensemble_d]
        return self._eval_salad(hp_id_d, prob_d)
Exemplo n.º 4
0
    def _init(self):
        if os.path.exists(self.trace_path):
            os.remove(self.trace_path)

        trace = Trace(self.trace_path, trace_level=2)
        trace.write(
            1, 'main', {
                'hp_space': self.optimizer.hp_space,
                '__dict__': self.__dict__,
                'ds_name': self.evaluator.ds_name,
            })

        self.trace = trace
        self.pool = make_pool(self.Pool)

        self._last_print = 0.
        self.last_eval_size = 0
        self.result_dict = {}
        self.hp_id_seq = []
        self.hp_id_pending = {}
        self.lock = RLock()

        self.y_dict = self.evaluator.get_y_dict()
        self.y_val_m = self.y_dict['val']
        self.trace.write(1, 'y',
                         self.y_dict)  # trace this info for further analysis

        self.m = len(self.y_val_m)

        if self.salad_size == 1:
            self.bootstrap_matrix_km = np.ones((1, self.m)) / self.m

        else:
            rng = np.random.RandomState(
                self.seed
            )  # provides the opportunity to have the same bootstrap matrix across different experiments.
            self.bootstrap_matrix_km = base.build_bootstrap_matrix(
                self.salad_size, self.m, self.essr, rng)