Exercise

Exploring the traditional way to catch fraud

In this exercise you're going to try finding fraud cases in our credit card dataset the "old way". First you'll define threshold values using common statistics, to split fraud and non-fraud. Then, use those thresholds on your features to detect fraud. This is common practice within fraud analytics teams.

Statistical thresholds are often determined by looking at the mean values of observations. Let's start this exercise by checking whether feature means differ between fraud and non-fraud cases. Then, you'll use that information to create common sense thresholds. Finally, you'll check how well this performs in fraud detection.

pandas has already been imported as pd.

Instructions

100 XP
  • Use groupby() to group df on Class and obtain the mean of the features.
  • Create the condition V1 smaller than -3, and V3 smaller than -5 as a condition to flag fraud cases.
  • As a measure of performance, use the crosstab function from pandas to compare our flagged fraud cases to actual fraud cases.