Fraud Detection in R
Bart Baesens
Professor Data Science at KU Leuven
Nodes (vertices)
Edges
Edges
Edges
print(transactions)
originator beneficiary amount time benef_country payment_channel
1 ID14 ID16 102 22:47 GBR CHAN_04
2 ID14 ID15 125 20:21 USA CHAN_02
3 ID02 ID01 1067 10:45 CAN CHAN_04
4 ID05 ID06 59 15:40 USA CHAN_02
graph_from_data_frame()
library(igraph)
network <- graph_from_data_frame(transactions, directed = FALSE)
plot(network)
E(network)
+ 16/16 edges from 297af3c (vertex names):
[1] ID02--ID01 ID11--ID04 ID04--ID01 ID04--ID03 ID03--ID01 ID08--ID09
[7] ID14--ID15 ID03--ID14 ID05--ID06 ID11--ID12 ID02--ID05 ID11--ID13
[13] ID02--ID08 ID14--ID16 ID08--ID10 ID05--ID07
V(network)
+ 16/16 vertices, named, from 297af3c:
ID02 ID11 ID04 ID03 ID08 ID14 ID05 ID01 ID09 ID15 ID06 ID12 ID13 ID16 ID10 ID07
V(network)$name
"ID02" "ID11" "ID04" "ID03" "ID08" "ID14" "ID05" ... "ID16" "ID10" "ID07"
plot(net)
E(net)$width <- count.multiple(net)
edge_attr(net)
$width
7 7 7 7 7 7 7 1 1 1 4 4 4 4 1 1
E(net)$curved <- FALSE
plot(net)
Fraud Detection in R