def _get_best(self, results, cv_results):
scores = {
k: v[-1]["score"] for k, v in results.info.items() if k in results.models
}
// Could use max(scores, key=score.get), but what if score is repeated?
// Happens in the test case a lot
model_ids = list(scores.keys())
scores = [scores[k] for k in model_ids]
model_idx = np.argmax(scores)
best_model_id = model_ids[model_idx]
best_est = results.models[best_model_id]
idx = cv_results["model_id"] == best_model_id
assert idx.sum() == 1
best_idx = np.argmax(idx)
return best_idx, best_est