import concurrent.futures
import os
score_list = []
def worker(my_random_seed):
model = CatBoostClassifier(
iterations=300,
learning_rate=0.1,
random_seed=my_random_seed
)
model.fit(
X_train, y_train,
cat_features=cat_features,
eval_set=(X_validation, y_validation),
)
return model.best_score_['validation_0']['Logloss']
with concurrent.futures.ProcessPoolExecutor(max_workers=os.cpu_count()) as executor:
futures = {executor.submit(worker, i) for i in range(10)}
for future in concurrent.futures.as_completed(futures):
score_list.append(future.result())