集成方法

Python 中的欺诈检测

Charlotte Werger

Data Scientist

什么是集成方法:Bagging 与 Stacking

Python 中的欺诈检测

Stacking 集成方法

Python 中的欺诈检测

为何在欺诈检测中使用集成方法

集成方法:

  • 更稳健
  • 可帮助避免过拟合
  • 通常提升预测性能
  • 在 Kaggle 顶级比赛中屡获佳绩
Python 中的欺诈检测

投票分类器

from sklearn.ensemble import VotingClassifier

clf1 = LogisticRegression(random_state=1) clf2 = RandomForestClassifier(random_state=1) clf3 = GaussianNB()
ensemble_model = VotingClassifier(estimators=[('lr', clf1), ('rf', clf2), ('gnb', clf3)], voting='hard')
ensemble_model.fit(X_train, y_train) ensemble_model.predict(X_test)
VotingClassifier(estimators=[('lr', clf1), ('rf', clf2), ('gnb', clf3)], voting='soft', weights=[2,1,1])
Python 中的欺诈检测

欺诈检测中的可靠标签

Python 中的欺诈检测

¡Vamos a practicar!

Python 中的欺诈检测

Preparing Video For Download...