Exercise

Cost of not detecting fraud

When no detection model is used, then all transactions in the transfers dataset are considered legitimate. You will determine the corresponding confusion matrix. Despite fraud being rare, the resulting financial losses can be huge. You will compute the total cost of not detecting the fraudulent transfers.

The caret package is already loaded for you to construct the confusionMatrix(). The transfers dataset is loaded in your workspace, don't hesitate to explore it in the Console.

Instructions

100 XP
  • Use rep.int() to create a vector called predictions in which all transfers are predicted as legitimate (class 0). Don't hesitate to look at the slides on the right of the Console to see how this function was used in the video.
  • Use the function confusionMatrix() from the caret package to compute the confusion matrix of predictions and the fraud_flag column from transfers.
  • Compute the total cost of not detecting fraud as the sum of fraudulent transferred amounts.