Problem description

Given the class imbalance ratio, we recommend measuring the accuracy using the Area Under the Precision-Recall Curve (AUPRC). Confusion matrix accuracy is not meaningful for imbalanced classification. Regarding this, use linear machine learning models, such as random forests, logistic regression, or support vector machines, by applying over-or under-sampling techniques. Alternatively, we can try to find anomalies in the data, since an assumption like only a few fraud cases being anomalies within the whole dataset.

When dealing with such a severe imbalance of response labels, we also need to be careful when measuring model performance. Because there are only a handful of fraudulent instances, a model that predicts everything ...

Get Scala Machine Learning Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.