mirror of
https://github.com/webclinic017/drift.git
synced 2026-07-28 11:17:47 +00:00
16 lines
417 B
Python
16 lines
417 B
Python
|
|
import matplotlib.pyplot as plt
|
||
|
|
|
||
|
|
|
||
|
|
def visualize_loss(history, title: str):
|
||
|
|
loss = history.history["loss"]
|
||
|
|
val_loss = history.history["val_loss"]
|
||
|
|
epochs = range(len(loss))
|
||
|
|
plt.figure()
|
||
|
|
plt.plot(epochs, loss, "b", label="Training loss")
|
||
|
|
plt.plot(epochs, val_loss, "r", label="Validation loss")
|
||
|
|
plt.title(title)
|
||
|
|
plt.xlabel("Epochs")
|
||
|
|
plt.ylabel("Loss")
|
||
|
|
plt.legend()
|
||
|
|
plt.show()
|