Example #1
0
def model(x, y, params):
    best_params = grid_search_reg(x, y, SVR(), params)
    # It must be one of 'linear', 'poly', 'rbf', 'sigmoid', 'precomputed' or a callable.
    kernel = best_params['kernel']
    C = best_params['C']
    cls = SVR(kernel=kernel, C=C)
    return cls
Example #2
0
def model(x, y, params):
    best_params = grid_search_reg(x, y, RandomForestRegressor(), params)
    # criterion = best_params['criterion']
    max_depth = best_params['max_depth']
    n_estimators = best_params['n_estimators']
    cls = RandomForestRegressor(max_depth=max_depth,
                                n_estimators=n_estimators,
                                random_state=random_state)
    return cls
Example #3
0
def model(x, y, params):
    best_params = grid_search_reg(x, y, GradientBoostingRegressor(), params)
    learning_rate = best_params['learning_rate']
    subsample = best_params['subsample']
    max_depth = best_params['max_depth']
    n_estimators = best_params['n_estimators']
    cls = GradientBoostingRegressor(learning_rate=learning_rate,
                                    subsample=subsample,
                                    max_depth=max_depth,
                                    n_estimators=n_estimators,
                                    random_state=random_state)
    return cls
Example #4
0
def model(x, y, params):
    best_params = grid_search_reg(x, y, LGBMRegressor(), params)
    learning_rate = best_params['learning_rate']
    num_leaves = best_params['num_leaves']
    subsample = best_params['subsample']
    colsample_bytree = best_params['colsample_bytree']
    max_depth = best_params['max_depth']
    n_estimators = best_params['n_estimators']
    cls = LGBMRegressor(learning_rate=learning_rate,
                        num_leaves=num_leaves,
                        subsample=subsample,
                        colsample_bytree=colsample_bytree,
                        max_depth=max_depth,
                        n_estimators=n_estimators,
                        random_state=random_state)
    return cls
Example #5
0
def model(x, y, params):
    best_params = grid_search_reg(x, y,
                                  XGBRegressor(objective='reg:squarederror'),
                                  params)
    learning_rate = best_params['learning_rate']
    num_leaves = best_params['num_leaves']
    subsample = best_params['subsample']
    colsample_bytree = best_params['colsample_bytree']
    max_depth = best_params['max_depth']
    n_estimators = best_params['n_estimators']
    cls = XGBRegressor(learning_rate=learning_rate,
                       num_leaves=num_leaves,
                       subsample=subsample,
                       colsample_bytree=colsample_bytree,
                       max_depth=max_depth,
                       n_estimators=n_estimators,
                       random_state=random_state,
                       objective='reg:squarederror')
    return cls