| | import matplotlib.pyplot as plt
|
| | import json
|
| |
|
| | def plot_training_history(history):
|
| |
|
| | if isinstance(history, dict):
|
| | hist = history
|
| | else:
|
| | hist = history.history
|
| |
|
| | plt.figure(figsize=(12, 5))
|
| |
|
| |
|
| | plt.subplot(1, 2, 1)
|
| | plt.plot(hist['loss'], label='Train Loss')
|
| | plt.plot(hist['val_loss'], label='Val Loss')
|
| | plt.title('Loss por Época')
|
| | plt.xlabel('Época')
|
| | plt.ylabel('MSE')
|
| | plt.legend()
|
| |
|
| |
|
| | plt.subplot(1, 2, 2)
|
| | plt.plot(hist['mae'], label='Train MAE')
|
| | plt.plot(hist['val_mae'], label='Val MAE')
|
| | plt.title('Erro Absoluto Médio por Época')
|
| | plt.xlabel('Época')
|
| | plt.ylabel('MAE')
|
| | plt.legend()
|
| |
|
| | plt.tight_layout()
|
| | plt.show()
|
| |
|
| |
|
| |
|
| | def load_history_from_json(filepath):
|
| | with open(filepath, 'r') as f:
|
| | return json.load(f)
|
| |
|
| |
|
| |
|
| |
|
| |
|