def _end_callback(self, x, y, iterations, data_summary, polar, epochs, batch_size, confusion_matrix, test_results, pbar, w_save):
    if (self.verbose == 1):
        pbar.close()
    self.pandas_full_data = self.pandas_full_data.reset_index(drop=True)
    self.monte_carlo_analyzer.set_df(self.pandas_full_data)
    if self.output_config['save_weights']:
        np.save((self.monte_carlo_analyzer.path / 'initial_weights.npy'), np.array(w_save))
    if self.output_config['excel_summary']:
        try:
            num_classes = str(y.shape[1])
        except IndexError:
            num_classes = (max(y) - min(y))
        self._save_montecarlo_log(iterations=iterations, dataset_name=data_summary, num_classes=num_classes, polar_mode=('Yes' if polar else 'No'), dataset_size=str(x.shape[0]), features_size=str(x.shape[1:]), epochs=epochs, batch_size=batch_size)
    if self.output_config['confusion_matrix']:
        if (confusion_matrix is not None):
            for model_cm in confusion_matrix:
                cm = model_cm['matrix']
                cols = cm.columns.tolist()
                strs = list(filter((lambda x: (type(x) == str)), cols))
                ints = list(filter((lambda x: (type(x) == int)), cols))
                ints.sort()
                strs.sort()
                cm_sorted = cm.fillna(0)[(ints + strs)]
                model_cm['matrix'] = cm_sorted.groupby(cm_sorted.index).mean()
                model_cm['matrix'].to_csv((self.monte_carlo_analyzer.path / (model_cm['name'] + '_confusion_matrix.csv')))
    if (test_results is not None):
        test_results.groupby('network').describe().to_csv((self.monte_carlo_analyzer.path / 'test_results.csv'))
    if self.output_config['plot_all']:
        return self.monte_carlo_analyzer.do_all()
def _end_callback(self, x, y, iterations, data_summary, polar, epochs, batch_size, confusion_matrix, test_results, pbar, w_save):
    if (self.verbose == 1):
        pbar.close()
    self.pandas_full_data = self.pandas_full_data.reset_index(drop=True)
    self.monte_carlo_analyzer.set_df(self.pandas_full_data)
    if self.output_config['save_weights']:
        np.save((self.monte_carlo_analyzer.path / 'initial_weights.npy'), np.array(w_save))
    if self.output_config['excel_summary']:
        try:
            num_classes = str(y.shape[1])
        except IndexError:
            num_classes = (max(y) - min(y))
        self._save_montecarlo_log(iterations=iterations, dataset_name=data_summary, num_classes=num_classes, polar_mode=('Yes' if polar else 'No'), dataset_size=str(x.shape[0]), features_size=str(x.shape[1:]), epochs=epochs, batch_size=batch_size)
    if self.output_config['confusion_matrix']:
        if (confusion_matrix is not None):
            for model_cm in confusion_matrix:
                cm = model_cm['matrix']
                cols = cm.columns.tolist()
                strs = list(filter((lambda x: (type(x) == str)), cols))
                ints = list(filter((lambda x: (type(x) == int)), cols))
                ints.sort()
                strs.sort()
                cm_sorted = cm.fillna(0)[(ints + strs)]
                model_cm['matrix'] = cm_sorted.groupby(cm_sorted.index).mean()
                model_cm['matrix'].to_csv((self.monte_carlo_analyzer.path / (model_cm['name'] + '_confusion_matrix.csv')))
    if (test_results is not None):
        test_results.groupby('network').describe().to_csv((self.monte_carlo_analyzer.path / 'test_results.csv'))
    if self.output_config['plot_all']:
        return self.monte_carlo_analyzer.do_all()