Exemplo n.º 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()
Exemplo n.º 2
0
def plot_comparison():
    p1 = ['BBC News Summary', 'ArXiv Dataset']
    p2 = ''
    p3 = 'Celność testowa'
    p4 = [0.9809, 0.8542]
    p5 = [0.9182, 0.619]
    p6 = 'uczenie nadzorowane'
    p7 = 'uczenie nienadzorowane'
    create_2_bar_plot(p1, p2, p3, p4, p5, p6, p7)
Exemplo n.º 3
0
# # Load from disk
# classifier_list = util.load_classifier_list(classifier_name_list,
#                                             CLASSIFIERS_AND_RESULTS_DIR_PATH)
# results = util.load_object(RESULTS_PATH)

# create_cv_test_time_plots(results, classifier_name_shortcut_list)
cv_mean_scores = [round(result[1], SCORE_DECIMAL_PLACES) for result in results]
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([[
Exemplo n.º 4
0
    # util.save_object(results, RESULTS_PATH)
    # util.save_classifier_list(classifier_list, classifier_name_list,
    #                           CLASSIFIERS_AND_RESULTS_DIR_PATH)
    return results


results = train_and_save(classifier_list, classifier_name_list, training_data)

mean_scores = [round(result[1], SCORE_DECIMAL_PLACES) for result in results]
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_2_bar_plot(classifier_name_shortcut_list,
                  'Classifier scores',
                  'Accuracy',
                  mean_scores,
                  test_scores,
                  'cv means',
                  'test set',
                  y_range_tuple=(0, 1))
create_bar_plot(classifier_name_shortcut_list,
                'Elapsed training times',
                'Time in seconds',
                elapsed_times,
                color='red')

# LR
# CV Accuracy (5-fold): [0.53598633 0.53020957 0.53526308 0.53578329 0.53255054]
# Mean CV Accuracy: 0.5339585613382408 Test Accuracy: 0.5334731505650527
# Time elapsed: 1860.7 seconds