【发布时间】:2022-06-13 03:20:24
【问题描述】:
在建模阶段处理我的机器学习项目时,我想首先尝试所有可能的模型,然后选择最佳模型并对其进行微调。最后我想我会得到最好的数据库模型,但一路走来,我发现了一个有趣的结果。
为了节省时间,我想在多模型训练阶段使用大约 3500 行,而在整个 70692 中,这仅占数据的 4.9%。然后当训练最终完成时,这是我对所有模型得到的结果:
=================================== Accuracy ===================================
name accuracy
3 Support Vector Machines 0.752571
0 Logistic Regression 0.751429
9 Bagging Classifier 0.746857
1 Random Forest 0.742857
2 LightGBM 0.742857
6 Bernoulli Naive Bayes 0.726857
4 XGBoost 0.724571
5 Gaussian Naive Bayes 0.721143
7 KNN 0.674857
8 Decision Tree 0.661143
================================== Precision ===================================
name precision
0 Logistic Regression 0.761427
9 Bagging Classifier 0.747583
3 Support Vector Machines 0.745568
6 Bernoulli Naive Bayes 0.743151
1 Random Forest 0.743041
2 LightGBM 0.739451
5 Gaussian Naive Bayes 0.737986
4 XGBoost 0.728355
7 KNN 0.69409
8 Decision Tree 0.677714
============================== True Positive Rate ==============================
name true_positive_rate
3 Support Vector Machines 0.790929
2 LightGBM 0.775442
9 Bagging Classifier 0.769912
1 Random Forest 0.767699
0 Logistic Regression 0.755531
4 XGBoost 0.744469
6 Bernoulli Naive Bayes 0.720133
5 Gaussian Naive Bayes 0.713496
7 KNN 0.662611
8 Decision Tree 0.655973
================================= Specificity ==================================
name specificity
3 Support Vector Machines 0.790929
2 LightGBM 0.775442
9 Bagging Classifier 0.769912
1 Random Forest 0.767699
0 Logistic Regression 0.755531
4 XGBoost 0.744469
6 Bernoulli Naive Bayes 0.720133
5 Gaussian Naive Bayes 0.713496
7 KNN 0.662611
8 Decision Tree 0.655973
=================================== F1 Score ===================================
name score
3 Support Vector Machines 0.767579
9 Bagging Classifier 0.758583
0 Logistic Regression 0.758468
2 LightGBM 0.757019
1 Random Forest 0.755169
4 XGBoost 0.736324
6 Bernoulli Naive Bayes 0.731461
5 Gaussian Naive Bayes 0.725534
7 KNN 0.677985
8 Decision Tree 0.666667
现在,我不知道要使用什么模型,所以我决定尝试将 7000 行几乎翻倍。起初,我教导结果将保持不变,只是准确性会提高,但你瞧,顺序发生了变化,这是我的 7000 行结果:
=================================== Accuracy ===================================
name accuracy
9 Bagging Classifier 0.736571
2 LightGBM 0.735429
3 Support Vector Machines 0.734
0 Logistic Regression 0.732857
1 Random Forest 0.730571
4 XGBoost 0.721714
6 Bernoulli Naive Bayes 0.72
5 Gaussian Naive Bayes 0.711429
7 KNN 0.674
8 Decision Tree 0.625429
================================== Precision ===================================
name precision
0 Logistic Regression 0.727174
6 Bernoulli Naive Bayes 0.726908
5 Gaussian Naive Bayes 0.725281
9 Bagging Classifier 0.719153
1 Random Forest 0.717895
3 Support Vector Machines 0.716049
2 LightGBM 0.714576
4 XGBoost 0.712533
7 KNN 0.674612
8 Decision Tree 0.63009
============================== True Positive Rate ==============================
name true_positive_rate
2 LightGBM 0.794466
9 Bagging Classifier 0.786561
3 Support Vector Machines 0.785997
1 Random Forest 0.770186
0 Logistic Regression 0.755505
4 XGBoost 0.754376
6 Bernoulli Naive Bayes 0.715415
5 Gaussian Naive Bayes 0.6917
7 KNN 0.687182
8 Decision Tree 0.629023
================================= Specificity ==================================
name specificity
2 LightGBM 0.794466
9 Bagging Classifier 0.786561
3 Support Vector Machines 0.785997
1 Random Forest 0.770186
0 Logistic Regression 0.755505
4 XGBoost 0.754376
6 Bernoulli Naive Bayes 0.715415
5 Gaussian Naive Bayes 0.6917
7 KNN 0.687182
8 Decision Tree 0.629023
=================================== F1 Score ===================================
name score
2 LightGBM 0.752406
9 Bagging Classifier 0.751348
3 Support Vector Machines 0.749394
1 Random Forest 0.743122
0 Logistic Regression 0.741069
4 XGBoost 0.732858
6 Bernoulli Naive Bayes 0.721116
5 Gaussian Naive Bayes 0.708092
7 KNN 0.680839
8 Decision Tree 0.629556
顺序改变了,这让我很惊讶,所以我的问题是更多的训练数据会改变模型与其他模型的比较准确度吗?或者以我自己的理解,为什么会发生上述模型排名的变化?
另外,我还有一个问题是。有没有办法绘制所有这些数据,以便更容易找到全面的最佳模型?现在,我将所有这些数据放在 3 个不同的 panda Dataframe 中进行绘图,我只是不知道该做什么/要制作哪个情节,甚至不知道如何制作情节。
否则,仅此而已,在此先感谢您。 :)
请注意,当我说 3500 和 7000 时,我的意思是我使用的总行数,包括训练和测试。我将整体分成 75% 和 25% 的部分,其中 75% 用于训练,25% 用于测试
【问题讨论】:
-
我投票结束这个问题,因为它缺乏焦点。另外,培训问题属于StackExchange: Data Science
-
@TrentonMcKinney 我很抱歉这个问题缺乏焦点。我实际上尝试搜索并找不到答案。您是否有任何提示或建议可以使我的问题变得更好?而且我尝试在堆栈交换上搜索无济于事,您是否可以给我问题的链接。谢谢你:)
-
我的意思是您关于培训的问题应该发布在数据科学上。一般来说,SO 是针对与修复损坏的代码相关的问题。
-
Stack Overflow 是编程题,这不是编程题。
标签: python machine-learning scikit-learn seaborn