It is difficult to answer that without your actual data. But there is a smoking gun, raising suspicions that your validation data might be (very) different from your training & test ones; and it comes from your previous question on this: 如果我在[验证集]功能上使用fit_transform,则不会出现错误,但是我的准确度为52%,这太糟糕了(因为我有89.1%). If i use fit_transform on my [validation set] features, I do not get an error, but I get accuracy of 52%, and that's terrible (because I had 89.1 %).尽管在验证数据上使用fit_transform确实是错误的方法(正确的方法就是您在此处所做的事情),但实际上,它应该不导致这种情况准确性差异很大.Although using fit_transform on the validation data is indeed wrong methodology (the correct one being what you do here), in practice, it should not lead to such a high discrepancy in the accuracy.换句话说,我实际上已经看到很多情况,人们错误地将这样的fit_transform方法应用于他们的验证/部署数据,而从来没有意识到任何错误,只是因为他们没有任何性能差异-因此,他们没有警报.如果确实所有这些数据在质量上都相似,那么这种情况是可以预料的.In other words, I have actually seen many cases where people erroneously apply such fit_transform approaches on their validation/deployment data, without never realizing any mistake in it, simply because they don't get any performance discrepancy - hence they are not alerted. And such a situation is expected, if indeed all these data are qualitatively similar.但是您这里的差异会导致人们强烈怀疑您的验证数据实际上(非常)不同于您的培训和培训;测试的.如果真是这样,那么这样的性能差异是可以预料的:整个ML实践都基于(通常是隐式)假设,即我们的数据(培训,验证,测试,实际部署的数据等)不会发生变化()定性地,它们都来自相同的统计分布.But discrepancies such as yours here lead to strong suspicions that your validation data are actually (very) different from your training & test ones. If this is the case, such performance discrepancies are to be expected: the whole ML practice is founded upon the (often implicit) assumption that our data (training, validation, test, real-world deployment ones etc) do not change qualitatively, and they all come from the same statistical distribution.因此,此处的下一步是对您的培训和验证数据以对此进行调查(实际上,在任何预测性任务中,始终将其假定为步骤#0).我猜想,即使是基本量度(均值和最大/最小值等)也将显示它们之间是否存在强烈差异,正如我所怀疑的那样.So, the next step here is to perform an exploratory analysis to both your training & validation data to investigate this (actually, this is always assumed to be the step #0 in any predictive task). I guess that even elementary measures (mean & max/min values etc) will show if there are strong differences between them, as I suspect.尤其是scikit-learn的 StandardScaler 使用In particular, scikit-learn's StandardScaler usesz = (x - u) / s用于转换,其中u是数据的平均值,而s是数据的标准偏差.如果您的训练和验证集之间的这些值明显不同,那么性能差异就不会出乎意料.for the transformation, where u is the mean value and s the standard deviation of the data. If these values are significantly different between your training and validation sets, the performance discrepancy is not to be unexpected. 这篇关于训练模型和加载模型后,准确性差异很大的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-28 21:55