Beispiel #1
0
 def __init__(self,
              searcher,
              dispatcher=None,
              callbacks=[],
              reward_metric=None,
              max_model_size=0,
              cache_preprocessed_data=False,
              cache_home=None,
              **config_kwargs):
     self.config_kwargs = config_kwargs
     metrics = config_kwargs.get('metrics')
     if metrics is None and reward_metric is None:
         raise ValueError('Must specify `reward_metric` or `metrics`.')
     if reward_metric is None:
         reward_metric = metrics[0]
     if metrics is None:
         metrics = [reward_metric]
         config_kwargs['metrics'] = metrics
     if reward_metric not in metrics:
         metrics.append(reward_metric)
         config_kwargs['metrics'] = metrics
     self.cache_preprocessed_data = cache_preprocessed_data
     self.cache_home = cache_home
     HyperModel.__init__(self,
                         searcher,
                         dispatcher=dispatcher,
                         callbacks=callbacks,
                         reward_metric=reward_metric)
Beispiel #2
0
 def __init__(self,
              searcher,
              optimizer,
              loss,
              metrics,
              dispatcher=None,
              callbacks=[],
              reward_metric=None,
              max_model_size=0,
              one_shot_mode=False,
              one_shot_train_sampler=None,
              visualization=False):
     self.optimizer = optimizer
     self.loss = loss
     self.metrics = metrics
     self.max_model_size = max_model_size
     if reward_metric is None:
         reward_metric = metrics[0]
     if one_shot_mode:
         self.weights_cache = LayerWeightsCache()
     else:
         self.weights_cache = None
     self.one_shot_mode = one_shot_mode
     self.one_shot_train_sampler = one_shot_train_sampler if one_shot_train_sampler is not None else searcher
     self.visualization = visualization
     HyperModel.__init__(self,
                         searcher,
                         dispatcher=dispatcher,
                         callbacks=callbacks,
                         reward_metric=reward_metric)
Beispiel #3
0
 def __init__(self,
              searcher,
              task='classification',
              dispatcher=None,
              callbacks=None,
              reward_metric='accuracy',
              data_cleaner_params=None,
              cache_dir=None,
              clear_cache=True):
     if callbacks is None:
         callbacks = []
     self.task = task
     self.data_cleaner_params = data_cleaner_params
     self.cache_dir = cache_dir
     self.clear_cache = clear_cache
     HyperModel.__init__(self,
                         searcher,
                         dispatcher=dispatcher,
                         callbacks=callbacks,
                         reward_metric=reward_metric)