How it works...
In Step 1, we imported the required libraries. The StackingClassifier is available in scikit-learn from version 0.22. In Step 2, we loaded the credit card fraud dataset into Python (for more details on the dataset, please refer to the Investigating different approaches to handling imbalanced data recipe), separated the target from the features, split the data into training and test sets, and—lastly—used scaling (StandardScaler) to obtain features with zero mean and unit variance. The transformation is not necessary for tree-based models, however, we later use different classifiers. For simplicity, we did not investigate different properties of the features, such as normality. Additionally, in this step, we also defined the ...
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