How it works...
In Step 2, we defined a set of parameters that we use in this recipe (number of folds for cross-validation, the maximum number of iterations in the optimization procedure). Then, we imported the dataset and created the training and test sets. We used the same dataset as in the previous recipe, so please refer to it for a description.
In Step 4, we defined the true objective function (the one for which the Bayesian optimization will create a surrogate). The function takes the set of hyperparameters as inputs and uses stratified 5-fold cross-validation to calculate the loss value to be minimized. In the case of fraud detection, we want to detect as much fraud as possible, even if it means creating more false positives. That ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access