示例#1
0
 def __init__(self,
              estimator,
              param_grid,
              sc=None,
              partitions='auto',
              preds=False,
              scoring=None,
              n_jobs=None,
              iid='warn',
              refit=True,
              cv=5,
              verbose=0,
              pre_dispatch='2*n_jobs',
              error_score='raise-deprecating',
              return_train_score=False):
     GridSearchCV.__init__(self,
                           estimator,
                           param_grid,
                           scoring=scoring,
                           n_jobs=n_jobs,
                           iid=iid,
                           refit=refit,
                           cv=cv,
                           verbose=verbose,
                           pre_dispatch=pre_dispatch,
                           error_score=error_score,
                           return_train_score=return_train_score)
     self.sc = sc
     self.partitions = partitions
     self.preds = preds
示例#2
0
    def __init__(self, gs_params):
        """
        Args:
            gs_params (dict) search parameters for hyperparameter optimization.
        """

        # constructs pipline steps
        scale = StandardScaler()
        regressor = RandomForestRegressor()
        pipe = Pipeline(steps=[('scale', scale), ('regressor', regressor)])

        # constructs the gridsearch estimator
        GridSearchCV.__init__(pipe, gs_params, refit=True, cv=5, scoring='r2')