Visualizing patterns in the data
The first step before you start modeling is to explore your data. Let's start by examining your dataset and visualizing different patterns between fraudulent and regular samples. Exceptionally, you're going to build the visualization!
The dataset transfers contains credit transfers and some of them were recorded as fraud. The column fraud_flag indicates whether the transaction is fraudulent (fraud_flag = 1) or not (fraud_flag = 0). This dataset and the ggplot2 package are loaded in your workspace.
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
Fraud Detection in R
คำแนะนำการฝึกหัด
- Plot the column
amountas the independent variable on the x axis, and the columnorig_balance_before, which is the balance on the originator's account before booking the transfer, as the dependent variable on the y axis. - Color and shape the data based on the value in the
fraud_flagcolumn.
แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ
ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์
# Make a scatter plot
ggplot(transfers, aes(x = ___, y = ___)) +
geom_point(aes(color = ___, shape = ___)) +
scale_color_manual(values = c('dodgerblue', 'red'))