How do I optimize for multiple metrics simultaneously inside the objective
function of Optuna. For example, I am training an LGBM classifier and want to find the best hyperparameter set for all common classification metrics like F1, precision, recall, accuracy, AUC, etc.
def objective(trial):
# Train
gbm = lgb.train(param, dtrain)
preds = gbm.predict(X_test)
pred_labels = np.rint(preds)
# Calculate metrics
accuracy = sklearn.metrics.accuracy_score(y_test, pred_labels)
recall = metrics.recall_score(pred_labels, y_test)
precision = metrics.precision_score(pred_labels, y_test)
f1 = metrics.f1_score(pred_labels, y_test, pos_label=1)
...
How do I do it?