code Copy code
# Create a figure with 3 subplots (1 row, 3 columns)
fig, axes = plt.subplots(2, 3, figsize=(12, 8))
# Plot histograms in each subplot
bin_edges = np.linspace(-1.4e-7, 1.4e-7, 21)
axes[0,0].hist(conf_loss_dTdt_offline_diff, bins=bin_edges, stacked=True, alpha=0.7, label=['U-Net', 'Squeezeformer', 'Pure ResLSTM', 'Pao Model', 'ConvNeXt', 'Encoder-Decoder LSTM'], edgecolor = 'black')
axes[0,0].set_title('dTdt RMSE difference')
axes[0,0].axvline(x=0, color='black', linestyle='--', linewidth=2)
bin_edges = np.linspace(-1.0e-10, 1.0e-10, 21)
axes[0,1].hist(conf_loss_dQvdt_offline_diff, bins=bin_edges, stacked=True, alpha=0.7, label=['U-Net', 'Squeezeformer', 'Pure ResLSTM', 'Pao Model', 'ConvNeXt', 'Encoder-Decoder LSTM'], edgecolor = 'black')
axes[0,1].set_title('dQvdt RMSE difference')
axes[0,1].axvline(x=0, color='black', linestyle='--', linewidth=2)
bin_edges = np.linspace(-2.0e-11, 2.0e-11, 21)
axes[0,2].hist(conf_loss_dQldt_offline_diff, bins=bin_edges, stacked=True, alpha=0.7, label=['U-Net', 'Squeezeformer', 'Pure ResLSTM', 'Pao Model', 'ConvNeXt', 'Encoder-Decoder LSTM'], edgecolor = 'black')
axes[0,2].set_title('dQldt RMSE difference')
axes[0,2].axvline(x=0, color='black', linestyle='--', linewidth=2)
bin_edges = np.linspace(-5.0e-11, 5.0e-11, 21)
axes[1,0].hist(conf_loss_dQidt_offline_diff, bins=bin_edges, stacked=True, alpha=0.7, label=['U-Net', 'Squeezeformer', 'Pure ResLSTM', 'Pao Model', 'ConvNeXt', 'Encoder-Decoder LSTM'], edgecolor = 'black')
axes[1,0].set_title('dQidt RMSE difference')
axes[1,0].axvline(x=0, color='black', linestyle='--', linewidth=2)
axes[1,0].legend(ncol = 1, fontsize = 8)
bin_edges = np.linspace(-1.0e-7, 1.0e-7, 21)
axes[1,1].hist(conf_loss_dUdt_offline_diff, bins=bin_edges, stacked=True, alpha=0.7, label=['U-Net', 'Squeezeformer', 'Pure ResLSTM', 'Pao Model', 'ConvNeXt', 'Encoder-Decoder LSTM'], edgecolor = 'black')
axes[1,1].set_title('dUdt RMSE difference')
axes[1,1].axvline(x=0, color='black', linestyle='--', linewidth=2)
bin_edges = np.linspace(-1.0e-7, 1.0e-7, 21)
axes[1,2].hist(conf_loss_dVdt_offline_diff, bins=bin_edges, stacked=True, alpha=0.7, label=['U-Net', 'Squeezeformer', 'Pure ResLSTM', 'Pao Model', 'ConvNeXt', 'Encoder-Decoder LSTM'], edgecolor = 'black')
axes[1,2].set_title('dVdt RMSE difference')
axes[1,2].axvline(x=0, color='black', linestyle='--', linewidth=2)
# Add overall title and adjust layout
fig.suptitle('Effect of Confidence Loss on Offline Error', fontsize=16)
plt.tight_layout()
plt.show()