社交网络分析

R 中的欺诈检测

Bart Baesens

Professor Data Science at KU Leuven

社交网络要素

节点(顶点)

  • 客户
  • 公司
  • 产品
  • 信用卡
  • 账户
  • 网页

玩具图 01

R 中的欺诈检测

社交网络要素

边(Edges)

  • 不同关系:如转账、通话、好友、疾病传播、引用

玩具图 02

R 中的欺诈检测

社交网络要素

边(Edges)

  • 不同关系:如转账、通话、好友、疾病传播、引用
  • 可加权:如交互频率、信息重要性、亲密度、情感强度

玩具图 03

R 中的欺诈检测

社交网络要素

边(Edges)

  • 不同关系:如转账、通话、好友、疾病传播、引用
  • 可加权:如交互频率、信息重要性、亲密度、情感强度
  • 可定向:如入边或出边

玩具图 04

R 中的欺诈检测

社交网络表示

社会关系图

R 中的欺诈检测

社交网络表示

连通性矩阵

R 中的欺诈检测

社交网络表示

邻接表

R 中的欺诈检测

社交网络表示

邻接表

R 中的欺诈检测

迈向网络

  • 从交易型数据源 …
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(){{1}} 构建网络
library(igraph)
network <- graph_from_data_frame(transactions, directed = FALSE)
R 中的欺诈检测
plot(network)

普通网络图

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"
R 中的欺诈检测

重叠边

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

多重边

R 中的欺诈检测

重叠边

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

加权边

R 中的欺诈检测

¡Vamos a practicar!

R 中的欺诈检测

Preparing Video For Download...