加入網路特徵
將資料擴充為包含網路特徵與其他類型的變數,可以提升模型偵測詐欺的能力。
網路 net 建立自不同帳戶之間的交易資料集 transfers。資料 account_info 包含這些帳戶的詳細資訊,這些帳戶就是網路中的節點。你可以把 degree、closeness 和 betweenness 等網路特徵加入 account_info。
本練習屬於課程
R 的詐欺偵測
練習說明
- 繪製網路
net,並印出包含帳戶(亦即節點)資訊的account_info。 - 將
degree、closeness和betweenness特徵加入資料框account_info,分別以「正規化」後的 degree、closeness 與 betweenness 表示。 - 透過印出
account_info,顯示帳戶(亦即節點)的新特徵。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Plot network and print account info
___
legend("bottomleft", legend = c("known money mule", "legit account"), fill = c("darkorange", "lightblue"), bty = "n")
print(___)
# Degree
account_info$___ <- ___(___, normalized = ___)
# Closeness
account_info$___ <- ___(___, ___ = ___)
# Betweenness
account_info$___ <- ___(___, ___ = ___)
print(___)