使用学习曲线判断模型性能

时间:2020-03-29 18:27:21

标签: python tensorflow keras

我的学习曲线看起来与我在网上遇到的一切都不一样。基于this article,我的情节最类似于“无代表性火车数据集”的情况。但是,该模型的精度为0.993

基于准确性,我不会说有问题。但是从训练图来看,似乎确实存在问题。我将如何解释以下情节?

enter image description here

这是情节的代码:

def show_learning_curves(history):
    plt.title('Learning Curves')
    plt.xlabel('Epoch')
    plt.ylabel('Cross Entropy')
    plt.plot(history.history['loss'], label='train')
    plt.plot(history.history['val_loss'], label='val')
    plt.legend()
    plt.show()

这是我的模特:

def create_model(n_features):
    model = tf.keras.Sequential()
    model.add(layers.Flatten(input_shape=n_features))
    model.add(layers.Dense(25, activation='relu', kernel_initializer='he_normal'))
    model.add(layers.Dense(8, activation='relu', kernel_initializer='he_normal'))
    model.add(layers.Dense(1, activation='sigmoid'))
    model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy']) 
    return model

0 个答案:

没有答案