zoukankan      html  css  js  c++  java
  • 从信用卡欺诈模型看不平衡数据分类(1)数据层面:使用过采样是主流,过采样通常使用smote,或者少数使用数据复制。过采样后模型选择RF、xgboost、神经网络能够取得非常不错的效果。(2)模型层面:使用模型集成,样本不做处理,将各个模型进行特征选择、参数调优后进行集成,通常也能够取得不错的结果。(3)其他方法:偶尔可以使用异常检测技术,IF为主

    总结:不平衡数据的分类,(1)数据层面:使用过采样是主流,过采样通常使用smote,或者少数使用数据复制。过采样后模型选择RF、xgboost、神经网络能够取得非常不错的效果。(2)模型层面:使用模型集成,样本不做处理,将各个模型进行特征选择、参数调优后进行集成,通常也能够取得不错的结果。(3)其他方法:偶尔可以使用异常检测技术,主要有IsolationForest,OneClassSVM,LocalOutlierFactor,KMeans,其中IsolationForest效果最好。但是不及前两种方法。很少使用数据欠采样手法,因为数据无法反映整体特征而导致高误报。

    从信用卡欺诈模型看不平衡数据分类:

    https://www.kaggle.com/joparga3/in-depth-skewed-data-classif-93-recall-acc-now 说明了欠采样不会太好,整体精度难以上去 文中欠采样思路 np.random.choice(normal_indices, number_records_fraud, replace = False) 最后精度 134/(134+11090) = 0.011

    https://www.kaggle.com/vincentlugat/votingclassifier-f1-score-0-88-data-viz 直接用原始数据训练,然后集成三个模型来做,效果也不错 VotingClassifier (
    estimators = [('xgb', xgb_cfl), ('lt', log_cfl), ('rf', rf_cfl)],
    voting='soft', weights = [1, 1, 1.33]) 最后效果Precision = 0.950
    Recall = 0.826
    F1_score = 0.884

    https://www.kaggle.com/currie32/predicting-fraud-with-tensorflow 直接用原始数据进行训练,特征工程选择最有用特征,然后使用神经网络进行训练 t-SNE画图 最后效果 召回率82.93% 误报率 0.10% 也还是不错 特征选择使用distplot绘图人眼看 另外提取了一些额外特征 df['V1_'] = df.V1.map(lambda x: 1 if x < -3 else 0)

    https://www.kaggle.com/janiobachmann/credit-fraud-dealing-with-imbalanced-datasets 非常非常好的文章 里面将过采样、欠采样、不做数据处理的几种方法都提到了,并且pca、tsne用到。其中,过采样是+神经网络处理,过采样使用的注意事项也提到了,必须要先split data再过采样。模型:undersample_model = Sequential([
    Dense(n_inputs, input_shape=(n_inputs, ), activation='relu'),
    Dense(32, activation='relu'),
    Dense(2, activation='softmax')
    ])最后效果Confusion matrix, without normalization
    [[56864 0]
    [ 0 98]]还是非常不错的!

    https://www.kaggle.com/bonovandoo/fraud-detection-with-smote-and-xgboost-in-r 使用smote+xgboost来做,最后效果:Precision 0.999841017488076,Recall 0.995497476124312。

    https://www.kaggle.com/gargmanish/how-to-handle-imbalance-data-study-in-detail 过采样和欠采样都讨论了,其中欠采样+RF比较好,acc和recall都是0.86。


    https://www.kaggle.com/kamathhrishi/detecting-credit-card-frauds 讲得比较全,Supervised Learning Algorithms(SVM、RF,注意RandomForestClassifier(max_depth=2, random_state=0) depth=2)和Anomaly Detection Algorithms,后者有One Class SVM(Acc 32%),Isolation Forest(Acc 89%还不错)。另外使用了过采样技术,评估隔离森林和RF,不过由于RF的depth=2,Acc和Recall是0.23、0.83。

    https://www.kaggle.com/shelars1985/anomaly-detection-using-gaussian-distribution 直接使用Gaussian Distribution to detect Anamolous transactions.最终效果:Precision of around 60% with Recall of 74% 算是一个探索性的思路吧,可能不太适合实际工程项目。

    https://www.kaggle.com/matheusfacure/semi-supervised-anomaly-detection-survey 探索了一些半监督的技术使用异常检测来做,分别为(1)Gaussian Model Based,Test Recall Score: 0.793 Test Precision Score: 0.701 Test F2 Score: 0.773(2)Histogram Based,不知道是啥原理,反正最后精度不咋的(3)聚类 GaussianMixture,Test Recall Score: 0.809 Test Precision Score: 0.726 Test F2 Score: 0.791(4)聚类IsolationForest,Test Recall Score: 0.760 Test Precision Score: 0.482 Test F2 Score: 0.681(5)神经网络,neural network named the autoencoder,Test Recall Score: 0.813 Test Precision Score: 0.294 Test F2 Score: 0.601效果也不咋的啊!

    https://www.kaggle.com/rgaddati/unsupervised-fraud-detection-isolation-forest 也探索了使用异常检测思路,主要有IsolationForest,OneClassSVM,LocalOutlierFactor,KMeans综合看IF是效果最好的。


    https://www.kaggle.com/lct14558/imbalanced-data-why-you-should-not-use-roc-curve 结论就是Handling highly imbalance classes and why Receiver Operating Characteristics Curve (ROC Curve) should not be used, and Precision/Recall curve should be preferred in highly imbalanced situations,对于不平衡数据训练模型,最重要的指标是Precision/Recall。


    https://www.kaggle.com/cherzy/visualization-on-a-2d-map-with-t-sne 使用tsne做数据可视化,非常主流的方法!比PCA用得多。

    https://www.kaggle.com/dstuerzer/optimized-logistic-regression 讨论了如何做LR的参数优化。

  • 相关阅读:
    解决urbuntu桌面本客户端输入ll command not found
    小白学习安全测试(二)——httrack的安装和使用
    Selenium + java不借助autolt实现下载文件到指定目录
    用例设计工具PICT — 输入组合覆盖
    解决创建maven项目Could not resolve archetype org.apache.maven.archetypes:maven-archetype-quickstart问题
    作死的自动化测试【转】
    测试开发是什么?为什么现在那么多公司都要招聘测试开发?【转】
    MySql的触发器
    MySql的存储过程
    MySql的索引操作
  • 原文地址:https://www.cnblogs.com/bonelee/p/9089984.html
Copyright © 2011-2022 走看看