Social network analytics

Fraud Detection in R

Bart Baesens

Professor Data Science at KU Leuven

Social network components

Nodes (vertices)

  • customers
  • companies
  • products
  • credit cards
  • accounts
  • web pages

toy_graph_01.png

Fraud Detection in R

Social network components

Edges

  • Different kind of relationships, e.g. money transfer, call, friendship, transmission of a disease, reference

toy_graph_02.png

Fraud Detection in R

Social network components

Edges

  • Different kind of relationships, e.g. money transfer, call, friendship, transmission of a disease, reference
  • Weighted based on e.g. interaction frequency, importance of information exchange, intimacy, emotional intensity

toy_graph_03.png

Fraud Detection in R

Social network components

Edges

  • Different kind of relationships, e.g. money transfer, call, friendship, transmission of a disease, reference
  • Weighted based on e.g. interaction frequency, importance of information exchange, intimacy, emotional intensity
  • Directed, e.g. incoming or ougoing

toy_graph_04.png

Fraud Detection in R

Social network representation

sociogram.png

Fraud Detection in R

Social network representation

connectivity_matrix.png

Fraud Detection in R

Social network representation

adjacency_list.png

Fraud Detection in R

Social network representation

adjacency_list.png

Fraud Detection in R

Towards a network

  • From a transactional data source ...
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
  • ... towards a network with function graph_from_data_frame()
library(igraph)
network <- graph_from_data_frame(transactions, directed = FALSE)
Fraud Detection in R
plot(network)

plain_network

Fraud Detection in R
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"
Fraud Detection in R

Overlapping edges

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

multiple_edges.png

Fraud Detection in R

Overlapping edges

E(net)$curved <- FALSE
plot(net)

weighted_edges.png

Fraud Detection in R

Let's practice!

Fraud Detection in R

Preparing Video For Download...