예제 #1
0
    def __init__(self,
                 experiment_name,
                 experiment,
                 parameter_config,
                 X_train,
                 y_train,
                 logger=None):
        self.logger = logger if (logger is not None) else get_logger()
        self._experiment_name = experiment_name
        self._experiment = experiment
        self._goal = self._experiment.spec.objective.type
        self._dim = parameter_config.dim
        self._lowerbound = parameter_config.lower_bounds
        self._upperbound = parameter_config.upper_bounds
        self._types = parameter_config.parameter_types
        self._names = parameter_config.names
        # record all the feasible values of discrete type variables
        self._discrete_info = parameter_config.discrete_info
        self._categorical_info = parameter_config.categorical_info
        self._name_id = parameter_config.name_ids

        self._X_train = self._mapping_params(X_train)
        self.parse_X()

        self._y_train = y_train
        self._parse_metric()
예제 #2
0
 def __init__(self,
              N,
              l,
              u,
              scaler,
              X_train,
              y_train,
              current_optimal,
              experiment_name,
              mode,
              trade_off,
              length_scale,
              noise,
              nu,
              kernel_type,
              n_estimators,
              max_features,
              model_type,
              logger=None):
     self.logger = logger if (logger is not None) else get_logger()
     self.N = N
     self.l = l
     self.u = u
     self.scaler = scaler
     self.buckets = []
     self.dim = None
     self._experiment_name = experiment_name
     if model_type == "gp":
         model = GaussianProcessModel(
             length_scale=length_scale,
             noise=noise,
             nu=nu,
             kernel_type=kernel_type,
         )
     else:
         model = RandomForestModel(
             n_estimators=n_estimators,
             max_features=max_features,
         )
     self.logger.debug("before model fit",
                       extra={"Experiment": self._experiment_name})
     model.fit(X_train, y_train)
     self.logger.debug("after model fit",
                       extra={"Experiment": self._experiment_name})
     self.aq_func = AcquisitionFunc(
         model=model,
         current_optimal=current_optimal,
         mode=mode,
         trade_off=trade_off,
     )