Пример #1
0
 def display_results(self):
     # Extract scores for plotting
     self.cv_mean_scores = [
         round(result[1], self.SCORE_DECIMAL_PLACES)
         for result in self.results
     ]
     self.test_scores = [
         round(result[2], self.SCORE_DECIMAL_PLACES)
         for result in self.results
     ]
     self.elapsed_times = [
         round(result[3], self.TIME_DECIMAL_PLACES)
         for result in self.results
     ]
     create_2_bar_plot(self.classifier_name_shortcut_list,
                       'Classifier scores',
                       'Accuracy',
                       self.cv_mean_scores,
                       self.test_scores,
                       'cv means',
                       'test set',
                       y_range_tuple=(0, 1),
                       should_autolabel=True)
     create_bar_plot(self.classifier_name_shortcut_list,
                     'Elapsed training times',
                     'Time in seconds',
                     self.elapsed_times,
                     color='red')
     self.print_results_table()
Пример #2
0
test_scores = [round(result[2], SCORE_DECIMAL_PLACES) for result in results]
elapsed_times = [round(result[3], TIME_DECIMAL_PLACES) for result in results]
# create_bar_plot(classifier_name_shortcut_list, 'Classifier scores', 'Accuracy',
#                 cv_mean_scores, y_range_tuple=(0, 1))
create_2_bar_plot(classifier_name_shortcut_list,
                  'Classifier scores',
                  'Accuracy',
                  cv_mean_scores,
                  test_scores,
                  'cv means',
                  'test set',
                  y_range_tuple=(0, 1),
                  should_autolabel=False)
create_bar_plot(classifier_name_shortcut_list,
                'Elapsed training times',
                'Time in seconds',
                elapsed_times,
                color='red')

# results_df = pd.DataFrame(
#         [[classifier_name_shortcut_list[i], results[i][1], results[i][2]] for i in
#          range(0, len(results))]).T

results_df = pd.DataFrame([[
    round(item[1], SCORE_DECIMAL_PLACES),
    round(item[2], SCORE_DECIMAL_PLACES)
] for item in results]).T
results_df.columns = classifier_name_shortcut_list
results_df.index = ['CV Mean', 'Test accuracy']
results_df.to_clipboard()