我应该把reuse_actors=True放在哪里?

问题描述 投票:0回答:1

运行下面的代码后,它说

INFO trainable.py:172 – Trainable.setup 花费了 2940.989 秒。如果您的可训练初始化速度很慢,请考虑设置reuse_actors = True以减少actor创建开销

import ray
ray.init(address="auto", _temp_dir='/home/ray_dir')

rnd = random.seed(8)
grid_cv = StratifiedKFold(n_splits=3,random_state=rnd, shuffle=True)

from xgboost.callback import EarlyStopping
early_stopping = EarlyStopping(rounds = 50, maximize=True, save_best=True)
clf = xgb.XGBClassifier(
                tree_method='gpu_hist',
                max_bin=512, 
                learning_rate = 0.0001,
                n_estimators=1000,
                objective='binary:logistic', reg_alpha=0.01,
                scale_pos_weight = pos_weight, eval_metric= 'aucpr',
                callbacks=[early_stopping],
                verbosity = 0,
                nthread = 96
                )


param = {
    'eta': [0.01, 0.1, 0.3],
    'min_child_weight': [1,3,8,16],
    'max_depth':[25,50,100,500],
    'colsample_bytree': [0.4,0.6,0.8],
    'subsample': [0.4,0.6,0.8],
    'gamma':[0,0.5,2,10],
}

gs = TuneGridSearchCV (estimator=clf, param_grid=param,  cv=grid_cv, n_jobs = -1, refit=True, return_train_score = True, verbose=3, scoring = 'average_precision', use_gpu = True )

gs.fit(X_train, y_train, eval_set= eval_set_xgboost, verbose=True)

我应该在代码中的哪里添加

reuse_actors=True

machine-learning xgboost hyperparameters ray gridsearchcv
1个回答
0
投票

AFAIK,它总是有

reuse_actors=True
。 TuneGridSearchCV 没有这种自由度。 您可以在源代码中看到。

© www.soinside.com 2019 - 2024. All rights reserved.