简体   繁体   English

ANN 线性回归的评估 Model

[英]Evaluation of an ANN Linear Regression Model

I have made my first ANN with Keras.我用 Keras 制作了我的第一个 ANN。 It's a Linear Regression Model with 5 features and 1 output.这是一个线性回归 Model,具有 5 个特征和 1 个 output。 I made a plot with "MSE" and "Loss function" and these are the results.我用“MSE”和“损失函数”制作了一个 plot,这些就是结果。 Can we say that it is a good model?我们可以说它是一个好的 model 吗? In addition R^2 = 0.91.此外,R^2 = 0.91。 Is this the right way?这是正确的方法吗?

classifier = Sequential()

classifier.add(Dense(5, input_dim=5,kernel_initializer='normal',activation='relu'))

classifier.add(Dense(5, activation='relu'))

classifier.add(Dense(1,activation='linear'))


classifier.compile(loss='mse', optimizer='adam', metrics=['mse','mae'])

history = classifier.fit(X_train, y_train, batch_size=10, validation_data=(X_test, y_test), epochs=200, verbose=0)

y_pred=classifier.predict(X_test)

train_mse=classifier.evaluate(X_train, y_train, verbose=0)

plt.title('Loss / Mean Squared Error')
plt.plot(history.history['loss'], label='train')
plt.plot(history.history['val_loss'], label='test')
plt.legend()
plt.show()

在此处输入图像描述

Apart from some terminology details (NN regression is not linear regression, and usually we don't call such model a classifier ), your model looks good indeed, with both errors (training & test) reducing smoothly and no signs of overfitting .除了一些术语细节(NN 回归不是线性回归,通常我们不称这样的 model 为classifier )之外,您的 model 看起来确实不错,两个错误(训练和测试)都可以顺利减少并且没有过度拟合的迹象。

Although an R^2 value of 0.91 sounds pretty good, the use of the metric in predictive settings, like here, is quite problematic;尽管 0.91 的 R^2 值听起来不错,但在预测设置中使用该指标,就像这里一样,是有问题的; quoting from my own answer in another SO thread :另一个 SO 线程中引用我自己的答案:

the whole R-squared concept comes in fact directly from the world of statistics, where the emphasis is on interpretative models, and it has little use in machine learning contexts, where the emphasis is clearly on predictive models;整个 R 平方的概念实际上直接来自统计世界,重点是解释模型,在机器学习环境中几乎没有用处,重点显然是预测模型; at least AFAIK, and beyond some very introductory courses, I have never (I mean never ...) seen a predictive modeling problem where the R-squared is used for any kind of performance assessment;至少 AFAIK,除了一些非常入门的课程之外,我从未(我的意思是从未......)见过预测建模问题,其中 R 平方用于任何类型的绩效评估; neither it's an accident that popular machine learning introductions, such as Andrew Ng's Machine Learning at Coursera, do not even bother to mention it.流行的机器学习介绍,例如 Andrew Ng 在 Coursera 的机器学习,甚至懒得提及它也不是偶然的。 And, as noted in the Github thread above (emphasis added):并且,如上面的Github 线程中所述(强调添加):

In particular when using a test set, it's a bit unclear to me what the R^2 means.特别是在使用测试集时,我有点不清楚 R^2 的含义。

with which I certainly concur.我当然同意。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM