Now, let's say that we fit our Keras model (not shown here) using the scaled sets X_train and Y_train, and get predictions on the training set:prediction = model.predict(X_train) # scaled inputs hereprint(prediction)# [-1.4687586 -0.6596055 0.14954728 0.95870024 1.001172 ]Keras 报告的 MSE 实际上是缩放后的 MSE,即:The MSE reported by Keras is actually the scaled MSE, i.e.:MSE_scaled = mean_squared_error(Y_train, prediction)MSE_scaled# 0.052299712818541934虽然我上面描述的 3 个步骤很简单:while the 3 steps I have described above are simply:MSE = mean_squared_error(Y, sc_Y.inverse_transform(prediction)) # first 2 steps, combinedMSE# 0.10459946572909758np.sqrt(MSE) # 3rd step# 0.323418406602187因此,在我们的例子中,如果我们最初的 Y 是美元,那么相同单位(美元)的实际误差将是 0.32(美元).So, in our case, if our initial Y were US dollars, the actual error in the same units (dollars) would be 0.32 (dollars).请注意对缩放 MSE 进行逆变换的幼稚方法会产生非常不同(且不正确)的结果:Notice how the naive approach of inverse-transforming the scaled MSE would give a very different (and incorrect) result:np.sqrt(sc_Y.inverse_transform([MSE_scaled]))# array([2.25254588]) 这篇关于如何在 Keras Regressor 中解释 MSE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-28 22:19