diff --git a/output/Simple Classifier/1Label_confusion_matrix_DevNonNorm.jpg b/output/Simple Classifier/1Label_confusion_matrix_DevNonNorm.jpg deleted file mode 100644 index c863e10..0000000 Binary files a/output/Simple Classifier/1Label_confusion_matrix_DevNonNorm.jpg and /dev/null differ diff --git a/output/Simple Classifier/1Label_confusion_matrix_DevNonNorm.png b/output/Simple Classifier/1Label_confusion_matrix_DevNonNorm.png new file mode 100644 index 0000000..f560093 Binary files /dev/null and b/output/Simple Classifier/1Label_confusion_matrix_DevNonNorm.png differ diff --git a/output/Simple Classifier/1Label_confusion_matrix_DevNormTrue.jpg b/output/Simple Classifier/1Label_confusion_matrix_DevNormTrue.jpg deleted file mode 100644 index 489fcf9..0000000 Binary files a/output/Simple Classifier/1Label_confusion_matrix_DevNormTrue.jpg and /dev/null differ diff --git a/output/Simple Classifier/1Label_confusion_matrix_DevNormTrue.png b/output/Simple Classifier/1Label_confusion_matrix_DevNormTrue.png new file mode 100644 index 0000000..a50f57b Binary files /dev/null and b/output/Simple Classifier/1Label_confusion_matrix_DevNormTrue.png differ diff --git a/output/Simple Classifier/1Label_confusion_matrix_TestNonNorm.jpg b/output/Simple Classifier/1Label_confusion_matrix_TestNonNorm.jpg deleted file mode 100644 index ab192e7..0000000 Binary files a/output/Simple Classifier/1Label_confusion_matrix_TestNonNorm.jpg and /dev/null differ diff --git a/output/Simple Classifier/1Label_confusion_matrix_TestNonNorm.png b/output/Simple Classifier/1Label_confusion_matrix_TestNonNorm.png new file mode 100644 index 0000000..42d193a Binary files /dev/null and b/output/Simple Classifier/1Label_confusion_matrix_TestNonNorm.png differ diff --git a/output/Simple Classifier/1Label_confusion_matrix_TestNormTrue.jpg b/output/Simple Classifier/1Label_confusion_matrix_TestNormTrue.jpg deleted file mode 100644 index 220874f..0000000 Binary files a/output/Simple Classifier/1Label_confusion_matrix_TestNormTrue.jpg and /dev/null differ diff --git a/output/Simple Classifier/1Label_confusion_matrix_TestNormTrue.png b/output/Simple Classifier/1Label_confusion_matrix_TestNormTrue.png new file mode 100644 index 0000000..8cce784 Binary files /dev/null and b/output/Simple Classifier/1Label_confusion_matrix_TestNormTrue.png differ diff --git a/output/Simple Classifier/1Label_confusion_matrix_TrainNonNorm.jpg b/output/Simple Classifier/1Label_confusion_matrix_TrainNonNorm.jpg deleted file mode 100644 index 9f1eda6..0000000 Binary files a/output/Simple Classifier/1Label_confusion_matrix_TrainNonNorm.jpg and /dev/null differ diff --git a/output/Simple Classifier/1Label_confusion_matrix_TrainNonNorm.png b/output/Simple Classifier/1Label_confusion_matrix_TrainNonNorm.png new file mode 100644 index 0000000..5a729a6 Binary files /dev/null and b/output/Simple Classifier/1Label_confusion_matrix_TrainNonNorm.png differ diff --git a/output/Simple Classifier/1Label_confusion_matrix_TrainNormTrue.jpg b/output/Simple Classifier/1Label_confusion_matrix_TrainNormTrue.jpg deleted file mode 100644 index 20c7596..0000000 Binary files a/output/Simple Classifier/1Label_confusion_matrix_TrainNormTrue.jpg and /dev/null differ diff --git a/output/Simple Classifier/1Label_confusion_matrix_TrainNormTrue.png b/output/Simple Classifier/1Label_confusion_matrix_TrainNormTrue.png new file mode 100644 index 0000000..0b993dc Binary files /dev/null and b/output/Simple Classifier/1Label_confusion_matrix_TrainNormTrue.png differ diff --git a/output/Simple Classifier/1labelPredictionsStats.txt b/output/Simple Classifier/1labelPredictionsStats.txt index 829189e..71c246b 100644 --- a/output/Simple Classifier/1labelPredictionsStats.txt +++ b/output/Simple Classifier/1labelPredictionsStats.txt @@ -2,37 +2,37 @@ Performance measures Train set: -Precision macro: 0.48 -Precision Individually: [0.563 0.381 0.876 0.28 0.301] -Recall macro: 0.527 -Recall Individually: [0.542 0.571 0.591 0.271 0.658] -F1 Score micro: 0.541 -F1 Score macro: 0.481 -F1 Score weighted: 0.565 -F1 Score Individually: [0.552 0.457 0.706 0.275 0.413] +Precision macro: 0.477 +Precision Individually: [0.563 0.381 0.857 0.28 0.301] +Recall macro: 0.518 +Recall Individually: [0.542 0.571 0.55 0.271 0.658] +F1 Score micro: 0.52 +F1 Score macro: 0.474 +F1 Score weighted: 0.541 +F1 Score Individually: [0.552 0.457 0.67 0.275 0.413] Dev set: -Precision macro: 0.399 -Precision Individually: [0.533 0. 0.88 0.25 0.333] -Recall macro: 0.441 -Recall Individually: [0.615 0. 0.629 0.182 0.778] -F1 Score micro: 0.557 -F1 Score macro: 0.396 -F1 Score weighted: 0.566 -F1 Score Individually: [0.571 0. 0.733 0.211 0.467] +Precision macro: 0.398 +Precision Individually: [0.533 0. 0.875 0.25 0.333] +Recall macro: 0.439 +Recall Individually: [0.615 0. 0.618 0.182 0.778] +F1 Score micro: 0.551 +F1 Score macro: 0.395 +F1 Score weighted: 0.559 +F1 Score Individually: [0.571 0. 0.724 0.211 0.467] Test set: -Precision macro: 0.424 -Precision Individually: [0.6 0. 0.885 0.333 0.3 ] -Recall macro: 0.438 -Recall Individually: [0.643 0. 0.676 0.273 0.6 ] -F1 Score micro: 0.586 -F1 Score macro: 0.417 -F1 Score weighted: 0.601 -F1 Score Individually: [0.621 0. 0.767 0.3 0.4 ] +Precision macro: 0.421 +Precision Individually: [0.6 0. 0.87 0.333 0.3 ] +Recall macro: 0.432 +Recall Individually: [0.643 0. 0.645 0.273 0.6 ] +F1 Score micro: 0.567 +F1 Score macro: 0.412 +F1 Score weighted: 0.581 +F1 Score Individually: [0.621 0. 0.741 0.3 0.4 ] diff --git a/simpleclassifier.py b/simpleclassifier.py index ddfbf01..f3c3911 100644 --- a/simpleclassifier.py +++ b/simpleclassifier.py @@ -84,20 +84,21 @@ def simple_classifier(sents_ref_json): test_pred_array = [sent['label'] for sent in test_pred_dict] test_pred_first_label = [label[0] for label in test_pred_array] +labels=['Commit to privacy', 'Declare opinion about privacy','Not applicable','Related to privacy','Violate privacy'] # Confusion Matrixes path='output/Simple Classifier/1Label_confusion_matrix_TrainNormTrue.png' -create_confusion_matrix(train_ref_primary_label, train_pred_first_label, "true", path, None, None) +create_confusion_matrix(train_ref_primary_label, train_pred_first_label, "true", path, labels, labels) path='output/Simple Classifier/1Label_confusion_matrix_DevNormTrue.png' -create_confusion_matrix(dev_ref_primary_label, dev_pred_first_label, "true", path, None, None) +create_confusion_matrix(dev_ref_primary_label, dev_pred_first_label, "true", path, labels, labels) path='output/Simple Classifier/1Label_confusion_matrix_TestNormTrue.png' -create_confusion_matrix(test_ref_primary_label, test_pred_first_label, "true", path, None, None) +create_confusion_matrix(test_ref_primary_label, test_pred_first_label, "true", path, labels, labels) path='output/Simple Classifier/1Label_confusion_matrix_TrainNonNorm.png' -create_confusion_matrix(train_ref_primary_label, train_pred_first_label, None, path, None, None) +create_confusion_matrix(train_ref_primary_label, train_pred_first_label, None, path, labels, labels) path='output/Simple Classifier/1Label_confusion_matrix_DevNonNorm.png' -create_confusion_matrix(dev_ref_primary_label, dev_pred_first_label, None, path, None, None) +create_confusion_matrix(dev_ref_primary_label, dev_pred_first_label, None, path, labels, labels) path='output/Simple Classifier/1Label_confusion_matrix_TestNonNorm.png' -create_confusion_matrix(test_ref_primary_label, test_pred_first_label, None, path, None, None) +create_confusion_matrix(test_ref_primary_label, test_pred_first_label, None, path, labels, labels) # Performance Measures @@ -105,6 +106,6 @@ def simple_classifier(sents_ref_json): os.makedirs(os.path.dirname(path), exist_ok=True) with open(path, 'w') as file: print("Performance measures\n", file=file) -write_output_stats_file(path, "Train", train_ref_primary_label, train_pred_first_label) -write_output_stats_file(path, "Dev", dev_ref_primary_label, dev_pred_first_label) -write_output_stats_file(path, "Test", test_ref_primary_label, test_pred_first_label) \ No newline at end of file +write_output_stats_file(path, "Train", train_ref_primary_label, train_pred_first_label, labels) +write_output_stats_file(path, "Dev", dev_ref_primary_label, dev_pred_first_label, labels) +write_output_stats_file(path, "Test", test_ref_primary_label, test_pred_first_label, labels) \ No newline at end of file