我已经为 MNIST 数据集训练了一个带有 keras 的顺序模型,这是我使用的代码。
# Create the model
model = Sequential()
# Add the first hidden layer
model.add(Dense(50, activation='relu', input_shape = (X.shape[1],)))
# Add the second hidden layer
model.add(Dense(50, activation='relu'))
# Add the output layer
model.add(Dense(10, activation = 'softmax'))
# Compile the model
model.compile(optimizer='adam', loss='categorical_crossentropy', metrics = ['accuracy'])
# Fit the model
model.fit(X, y, validation_split=.3)
输出:
Train on 1750 samples, validate on 750 samples
1750/1750 [==============================] - 0s - loss: 0.1002 - acc: 0.9811 - val_loss: 0.3777 - val_acc: 0.8800
你能解释一下什么是loss, acc , val_loss, val_acc吗?我如何从输出中的这些指标中了解我的模型性能。请尽可能解释。