def do_table_results(self, parameter_name, parameter_values, scores): rows = [['parameter_value_' + parameter_name, 'score']] x = PrettyTable() x.field_names = ['parameter_value_' + parameter_name, 'score'] for index, parameter_value in enumerate(parameter_values): rows.append([parameter_value, scores[index]]) x.add_row([parameter_value, scores[index]]) if self.output_path is not None: save_csv( self.output_path + '/table_scores_parameter_' + parameter_name, rows) print(x)
def class_frequencies_separate(config, output_path, values, labels, output_labels, visualize, dataframe, verbose): unique, counts = np.unique(output_labels, return_counts=True) rows = [['class', 'predicted_samples_distribution']] x = PrettyTable() x.field_names = ['class', 'predicted_samples_distribution'] for index, _class in enumerate(unique): number_samples = counts[index] rows.append([_class, number_samples]) x.add_row([_class, number_samples]) if output_path is not None: save_csv(output_path + '/samples_distribution', rows) print(x)
def show_metrics_table(config, output_path, values, labels, output_labels, visualize, dataframe, verbose): rows = [[''] + config['metrics']] x = PrettyTable() x.field_names = [''] + config['metrics'] scores = [] for metric in config['metrics']: scores.append(run_evaluation_metric(metric, values, labels, output_labels)) rows.append(['result'] + scores) x.add_row(['result'] + scores) if output_path is not None: save_csv(output_path + '/table_scores', rows) print(x)
def class_frequencies(config, output_path, values, labels, output_labels, visualize, dataframe, verbose): unique1, counts1 = np.unique(labels, return_counts=True) #counts1, unique1 = zip(*sorted(zip(counts1, unique1), reverse=True)) -> show sorted unique2, counts2 = np.unique(output_labels, return_counts=True) rows = [['class', 'original_samples_distribution', 'predicted_samples_distribution']] x = PrettyTable() x.field_names = ['class', 'original_samples_distribution', 'predicted_samples_distribution'] for index, _class in enumerate(unique1): number_samples1 = counts1[index] number_samples2 = counts2[np.where(unique2 == _class)[0]][0] rows.append([_class, number_samples1, number_samples2]) x.add_row([_class, number_samples1, number_samples2]) if output_path is not None: save_csv(output_path + '/samples_distribution', rows) print(x)