分类方法回顾

Python 中的欺诈检测

Charlotte Werger

Data Scientist

什么是分类?

分类目标: 用已知欺诈样本训练模型,识别新的欺诈样本

示例:

  • 邮件 垃圾/非垃圾
  • 在线交易欺诈:是/否
  • 肿瘤 恶性/良性

待预测变量:$y \in {0,1} $

0:负类("多数"正常样本)

1:正类("少数"欺诈样本)

Python 中的欺诈检测

欺诈检测常用的分类方法

  • 逻辑回归

Python 中的欺诈检测

欺诈检测常用的分类方法

  • 神经网络

Python 中的欺诈检测

欺诈检测常用的分类方法

  • 决策树
  • 随机森林

Python 中的欺诈检测

决策树与随机森林

  • 随机森林由在特征随机子集上训练的多棵树组成

Python 中的欺诈检测

用于欺诈检测的随机森林

from sklearn.ensemble import RandomForestClassifier

model = RandomForestClassifier(random_state=42)
model.fit(X_train, y_train)
predicted = model.predict(X_test)
print (metrics.accuracy_score(y_test, predicted))
0.991324200913242
Python 中的欺诈检测

Passons à la pratique !

Python 中的欺诈检测

Preparing Video For Download...