Plotting Keras training history with Matplotlib

Talles L - Aug 20 - - Dev Community
import matplotlib.pyplot as plt

def plot_training(history):  
    plt.figure(figsize=(8, 5))  # 8x5 inches

    for key in history.keys():
        plt.plot(history[key], label=key)

    plt.grid(True)
    plt.ylim(0, 1)
    plt.xlabel('Epoch')
    plt.ylabel('Value')
    plt.title('Learning Curve')
    plt.legend()
    plt.show()

training_history = model.fit(...)
plot_history(training_history)
Enter fullscreen mode Exit fullscreen mode

Example:

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player