简体   繁体   English

GridSearchCV 没有提高我的测试准确性

[英]GridSearchCV does not improve my test accuracy

I am making multiple classifier models and the test accuracy for all of them is 0.508.我正在制作多个分类器模型,所有这些模型的测试精度都是 0.508。

I find it weird that multiple models have the same accuracy.我发现多个模型具有相同的准确度很奇怪。 The models I used are Logistic Regressor,DesicionTreeClassifier, MLPClassifier, RandomForestClassifier, BaggingClassifier, AdaBoostClassifier, XGBClassifier, SVC, and VotingClassifier.我使用的模型是 Logistic Regressor、DesicionTreeClassifier、MLPClassifier、RandomForestClassifier、BaggingClassifier、AdaBoostClassifier、XGBClassifier、SVC 和 VotingClassifier。

After using GridSearchCV to improve the models, all of their test accuracy scores improved.在使用 GridSearchCV 改进模型后,他们所有的测试准确率分数都有所提高。 But the test accuracy scores did not change.但测试准确度分数没有改变。

I wish I could say I changed something, but I don't know why the test scores did not change.我希望我能说我改变了什么,但我不知道为什么考试成绩没有改变。 After using gridsearch, I expected the test scores to improve but it didn't使用 gridsearch 后,我期望考试成绩会有所提高,但没有

I would like to confirm, you mean your training scores improve but you testing scores did not change?我想确认一下,你的意思是你的训练分数提高了但你的测试分数没有变化? If yes, there are a lot of possibility behind this.如果是的话,这背后有很多可能性。

  • You might want to reconfigure and add your hyper parameter range for example if using KNN you can increase the number of k or by adding more distance metric calculation您可能想要重新配置并添加您的超参数范围,例如,如果使用 KNN,您可以增加 k 的数量或通过添加更多距离度量计算
  • If you want to you can change the hyper parameter optimization technique like randomized search or bayesian search如果你愿意,你可以改变超参数优化技术,如随机搜索或贝叶斯搜索
  • I don't have any information about your data but sometimes turn on or turn off the shuffle mode when splitting can affect the scores for instance if you have time series data you have not to shuffle the dataset我没有关于您的数据的任何信息,但有时在拆分时打开或关闭随机播放模式会影响分数,例如,如果您有时间序列数据,则不必随机播放数据集

Looking at your accuracy, first of all I would say: are you performing a binary classification task?看看你的准确性,首先我会说:你在执行二元分类任务吗? Because if it is the case, your models are almost not better than random on the test set, which may suggest that something is wrong with your training.因为如果是这样,你的模型在测试集上几乎不比随机好,这可能表明你的训练有问题。

Otherwise, GridSearchCV , like RandomSearchCV and other hyperparameters optimization techniques try to find optimal parameters among a range that you define .否则, GridSearchCVRandomSearchCV和其他超参数优化技术一样会尝试在您定义的范围内找到最佳参数。 If, after optimization, your optimal parameter has the value of one bound of your range, it may suggest that you need to explore beyond this bound, that is to say set another range on purpose and run the optimization again.如果在优化之后,你的最优参数值是你范围的一个界限,这可能表明你需要探索超出这个界限,也就是说故意设置另一个范围并再次运行优化。

By the way, I don't know the size of your dataset but if it is big I would recommend you to use RandomSearchCV instead of GridSearchCV .顺便说一下,我不知道你的数据集的大小,但如果它很大,我会建议你使用RandomSearchCV而不是GridSearchCV As it is not exhaustive, it takes less time and gives results that are (nearly) optimized.由于它不是详尽无遗的,因此它花费的时间更少,并且给出的结果(几乎)是优化的。

There can be several reasons why the test accuracy didn't change after using GridSearchCV:使用 GridSearchCV 后测试准确性没有改变的原因可能有多种:

The best parameters found by GridSearchCV might not be optimal for the test data. GridSearchCV 找到的最佳参数可能不是测试数据的最佳参数。

The test data may have a different distribution than the training data, leading to low test accuracy.测试数据可能与训练数据有不同的分布,导致测试准确率低。

The models might be overfitting to the training data and not generalizing well to the test data.这些模型可能对训练数据过度拟合,而不能很好地泛化到测试数据。

The test data size might be small, leading to high variance in test accuracy scores.测试数据量可能很小,导致测试准确度分数的差异很大。

The problem itself might be challenging, and a test accuracy of 0.508 might be the best that can be achieved with the current models and data.问题本身可能具有挑战性,0.508 的测试精度可能是当前模型和数据所能达到的最佳精度。

It would be useful to have more information about the data, the problem, and the experimental setup to diagnose the issue further.获得有关数据、问题和实验设置的更多信息以进一步诊断问题会很有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何提高我的迁移学习 BERT 的 model 的验证和测试的准确性 - How to improve an accuracy of validation and test of my model of Transfer Learning BERT 提高我的DNN模型的准确性 - Improve accuracy of my DNN model 有什么建议可以改进我的 CNN 模型(始终保持相同的低测试准确率)? - Any suggestions to improve my CNN model (always the same low test accuracy)? GridSearchCV 是否总是提高 model 分类或回归 model 的准确性? - Does the GridSearchCV always improves model accuracy for classification or regression model? 需要帮助改进我的计算机视觉模型,它在测试数据集上的准确率只有 88% - Need help to improve my Computer vision model, It's getting only 88% accuracy on test dataset 使用keras提高我的模型的准确性 - improve the accuracy of my model buid with keras 使用了SequentialFeatureSelector,但没有提高模型精度 - Used SequentialFeatureSelector but does not improve the model accuracy 如何提高精度并减少我的 model 的损失 - How to improve accuracy and reduce loss of my model 如何改善我的单元测试 - How to improve my unit test GridSearchCV 是考虑了模型的执行时间还是只根据高参数考虑了他的准确性? - Does the GridSearchCV take in account the execution time of a model or he only takes his accuracy according to the high-parameters?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM