欺诈检测算法实战

Python 中的欺诈检测

Charlotte Werger

Data Scientist

基于规则的传统欺诈检测

Python 中的欺诈检测

基于规则方法的缺点

基于规则的方法有局限:

  1. 每条规则使用固定阈值判定欺诈
  2. 仅限是/否结果
  3. 难以捕捉特征间的交互
Python 中的欺诈检测

为何用机器学习做欺诈检测?

  1. 机器学习随数据自适应,能随时间更新
  2. 结合全部数据,而非按特征设阈值
  3. 可输出分数,而非单一是/否
  4. 通常表现更好,且可与规则结合

Python 中的欺诈检测

机器学习模型速览

from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
from sklearn import metrics

# Step 1: split your features and labels into train and test data X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
# Step 2: Define which model you want to use model = LinearRegression()
# Step 3: Fit the model to your training data model.fit(X_train, y_train)
# Step 4: Obtain model predictions from your test data y_predicted = model.predict(X_test)
# Step 5: Compare y_test to predictions and obtain performance metrics print (metrics.r2_score(y_test, y_predicted))
0.821206237313
Python 中的欺诈检测

接下来将学习的内容

  • 第2章 监督学习:用现有欺诈标签训练模型

  • 第3章 无监督学习:无标签下用数据界定"可疑"行为

  • 第4章 文本数据的欺诈检测:用文本挖掘与主题建模增强模型

Python 中的欺诈检测

¡Vamos a practicar!

Python 中的欺诈检测

Preparing Video For Download...