Once the training process is complete, break down the reconstruction error in the testing set by fraudulent and non-fraudulent (normal) transactions. Generate the reconstruction error by different classes of transactions:
def plot_reconstruction_error_by_class(self):self.get_test_predictions()mse = np.mean(np.power(self.test_data - self.test_predictions, 2), axis=1)self.recon_error = pd.DataFrame({'recon_error': mse,'true_class': self.y_test})## Plotting the errors by class# Normal Transactionsfig = plt.figure(num = "Recon Error with Normal Transactions")fig.set_size_inches(12, 6)ax = fig.add_subplot(111)normal_error_df = self.recon_error[(self.recon_error['true_class'] == 0) & (self.recon_error['recon_error'] ...