mirror of
https://github.com/Doctorado-ML/benchmark.git
synced 2025-08-15 15:35:52 +00:00
Update be_list to new formats
This commit is contained in:
@@ -27,30 +27,26 @@ class BeListTest(TestBase):
|
||||
self.assertEqual(stderr.getvalue(), "")
|
||||
self.check_output_file(stdout, "be_list_report")
|
||||
|
||||
@patch("benchmark.Results.get_input", side_effect=iter(["q"]))
|
||||
def test_be_list_report_excel_none(self, input_data):
|
||||
stdout, stderr = self.execute_script("be_list", ["-m", "STree", "-x"])
|
||||
self.assertEqual(stderr.getvalue(), "")
|
||||
self.check_output_file(stdout, "be_list_model")
|
||||
|
||||
@patch("benchmark.Results.get_input", side_effect=iter(["r", "q"]))
|
||||
def test_be_list_twice(self, input_data):
|
||||
stdout, stderr = self.execute_script("be_list", ["-m", "STree"])
|
||||
self.assertEqual(stderr.getvalue(), "")
|
||||
self.check_output_file(stdout, "be_list_model_2")
|
||||
|
||||
@patch("benchmark.Results.get_input", side_effect=iter(["2", "q"]))
|
||||
@patch("benchmark.Results.get_input", side_effect=iter(["e 2", "q"]))
|
||||
def test_be_list_report_excel(self, input_data):
|
||||
stdout, stderr = self.execute_script("be_list", ["-m", "STree", "-x"])
|
||||
stdout, stderr = self.execute_script("be_list", ["-m", "STree"])
|
||||
self.assertEqual(stderr.getvalue(), "")
|
||||
self.check_output_file(stdout, "be_list_report_excel")
|
||||
book = load_workbook(Files.be_list_excel)
|
||||
sheet = book["STree"]
|
||||
self.check_excel_sheet(sheet, "excel")
|
||||
|
||||
@patch("benchmark.Results.get_input", side_effect=iter(["2", "1", "q"]))
|
||||
@patch(
|
||||
"benchmark.Results.get_input", side_effect=iter(["e 2", "e 1", "q"])
|
||||
)
|
||||
def test_be_list_report_excel_twice(self, input_data):
|
||||
stdout, stderr = self.execute_script("be_list", ["-m", "STree", "-x"])
|
||||
stdout, stderr = self.execute_script("be_list", ["-m", "STree"])
|
||||
self.assertEqual(stderr.getvalue(), "")
|
||||
self.check_output_file(stdout, "be_list_report_excel_2")
|
||||
book = load_workbook(Files.be_list_excel)
|
||||
@@ -67,7 +63,8 @@ class BeListTest(TestBase):
|
||||
self.assertEqual(stderr.getvalue(), "")
|
||||
self.assertEqual(stdout.getvalue(), f"{NO_RESULTS}\n")
|
||||
|
||||
def test_be_list_nan(self):
|
||||
@patch("benchmark.Results.get_input", side_effect=iter(["h 0", "y", "q"]))
|
||||
def test_be_list_hide(self, input_data):
|
||||
def swap_files(source_folder, target_folder, file_name):
|
||||
source = os.path.join(source_folder, file_name)
|
||||
target = os.path.join(target_folder, file_name)
|
||||
@@ -80,14 +77,15 @@ class BeListTest(TestBase):
|
||||
# move nan result from hidden to results
|
||||
swap_files(Folders.hidden_results, Folders.results, file_name)
|
||||
try:
|
||||
# list and move nan result to hidden
|
||||
stdout, stderr = self.execute_script("be_list", ["--nan"])
|
||||
# list and move nan result to hidden again
|
||||
stdout, stderr = self.execute_script("be_list", [])
|
||||
self.assertEqual(stderr.getvalue(), "")
|
||||
self.check_output_file(stdout, "be_list_nan")
|
||||
print(stdout.getvalue())
|
||||
# self.check_output_file(stdout, "be_list_nan")
|
||||
except Exception:
|
||||
# move back nan result file if be_list couldn't
|
||||
swap_files(Folders.results, Folders.hidden_results, file_name)
|
||||
self.fail("test_be_list_nan() should not raise exception")
|
||||
self.fail("test_be_list_hide() should not raise exception")
|
||||
|
||||
@patch("benchmark.Results.get_input", return_value="q")
|
||||
def test_be_list_nan_no_nan(self, input_data):
|
||||
|
@@ -3,4 +3,3 @@
|
||||
[96m 0 2021-11-01 results_accuracy_STree_macbook-pro_2021-11-01_19:17:07_0.json 0.03790 1.143 default B
|
||||
[94m 1 2021-10-27 results_accuracy_STree_iMac27_2021-10-27_09:40:40_0.json 0.04158 0.943 default A
|
||||
[96m 2 2021-09-30 results_accuracy_STree_iMac27_2021-09-30_11:42:07_0.json 0.04544 0.173 With gridsearched hyperparameters
|
||||
Which result do you want to report? (q to quit, r to list again, number to report):
|
@@ -3,9 +3,8 @@
|
||||
[96m 0 2021-11-01 results_accuracy_STree_macbook-pro_2021-11-01_19:17:07_0.json 0.03790 1.143 default B
|
||||
[94m 1 2021-10-27 results_accuracy_STree_iMac27_2021-10-27_09:40:40_0.json 0.04158 0.943 default A
|
||||
[96m 2 2021-09-30 results_accuracy_STree_iMac27_2021-09-30_11:42:07_0.json 0.04544 0.173 With gridsearched hyperparameters
|
||||
Which result do you want to report? (q to quit, r to list again, number to report): [94m # Date File Score Time(h) Title
|
||||
[94m # Date File Score Time(h) Title
|
||||
=== ========== ============================================================= ======== ======= =================================
|
||||
[96m 0 2021-11-01 results_accuracy_STree_macbook-pro_2021-11-01_19:17:07_0.json 0.03790 1.143 default B
|
||||
[94m 1 2021-10-27 results_accuracy_STree_iMac27_2021-10-27_09:40:40_0.json 0.04158 0.943 default A
|
||||
[96m 2 2021-09-30 results_accuracy_STree_iMac27_2021-09-30_11:42:07_0.json 0.04544 0.173 With gridsearched hyperparameters
|
||||
Which result do you want to report? (q to quit, r to list again, number to report):
|
@@ -3,5 +3,4 @@
|
||||
[96m 0 2021-11-01 results_accuracy_STree_macbook-pro_2021-11-01_19:17:07_0.json 0.03790 1.143 default B
|
||||
[94m 1 2021-10-27 results_accuracy_STree_iMac27_2021-10-27_09:40:40_0.json 0.04158 0.943 default A
|
||||
[96m 2 2021-09-30 results_accuracy_STree_iMac27_2021-09-30_11:42:07_0.json 0.04544 0.173 With gridsearched hyperparameters
|
||||
Which result do you want to report? (q to quit, r to list again, number to report): Invalid option x. Try again!
|
||||
Which result do you want to report? (q to quit, r to list again, number to report):
|
||||
Invalid option. Try again!
|
||||
|
@@ -3,7 +3,7 @@
|
||||
[96m 0 2021-11-01 results_accuracy_STree_macbook-pro_2021-11-01_19:17:07_0.json 0.03790 1.143 default B
|
||||
[94m 1 2021-10-27 results_accuracy_STree_iMac27_2021-10-27_09:40:40_0.json 0.04158 0.943 default A
|
||||
[96m 2 2021-09-30 results_accuracy_STree_iMac27_2021-09-30_11:42:07_0.json 0.04544 0.173 With gridsearched hyperparameters
|
||||
Which result do you want to report? (q to quit, r to list again, number to report): [94m*************************************************************************************************************************
|
||||
[94m*************************************************************************************************************************
|
||||
[94m* STree ver. 1.2.3 Python ver. 3.11x with 5 Folds cross validation and 10 random seeds. 2021-11-01 19:17:07 *
|
||||
[94m* default B *
|
||||
[94m* Random seeds: [57, 31, 1714, 17, 23, 79, 83, 97, 7, 1] Stratified: False *
|
||||
@@ -18,4 +18,3 @@ Dataset Sampl. Feat. Cls Nodes Leaves Depth Score
|
||||
[94m*************************************************************************************************************************
|
||||
[94m* accuracy compared to STree_default (liblinear-ovr) .: 0.0379 *
|
||||
[94m*************************************************************************************************************************
|
||||
Which result do you want to report? (q to quit, r to list again, number to report):
|
@@ -3,19 +3,5 @@
|
||||
[96m 0 2021-11-01 results_accuracy_STree_macbook-pro_2021-11-01_19:17:07_0.json 0.03790 1.143 default B
|
||||
[94m 1 2021-10-27 results_accuracy_STree_iMac27_2021-10-27_09:40:40_0.json 0.04158 0.943 default A
|
||||
[96m 2 2021-09-30 results_accuracy_STree_iMac27_2021-09-30_11:42:07_0.json 0.04544 0.173 With gridsearched hyperparameters
|
||||
Which result do you want to report? (q to quit, r to list again, number to report): [94m*************************************************************************************************************************
|
||||
[94m* STree ver. 1.2.3 Python ver. 3.11x with 5 Folds cross validation and 10 random seeds. 2021-09-30 11:42:07 *
|
||||
[94m* With gridsearched hyperparameters *
|
||||
[94m* Random seeds: [57, 31, 1714, 17, 23, 79, 83, 97, 7, 1] Stratified: False *
|
||||
[94m* Execution took 624.25 seconds, 0.17 hours, on iMac27 *
|
||||
[94m* Score is accuracy *
|
||||
[94m*************************************************************************************************************************
|
||||
|
||||
Dataset Sampl. Feat. Cls Nodes Leaves Depth Score Time Hyperparameters
|
||||
============================== ====== ===== === ======= ======= ======= =============== ================= ===============
|
||||
[96mbalance-scale 625 4 3 7.00 4.00 3.00 0.970560±0.0150 0.014049±0.0020 {'C': 10000.0, 'gamma': 0.1, 'kernel': 'rbf', 'max_iter': 10000.0, 'multiclass_strategy': 'ovr'}
|
||||
[94mballoons 16 4 2 3.00 2.00 2.00 0.860000±0.2850 0.000854±0.0000 {'C': 7, 'gamma': 0.1, 'kernel': 'rbf', 'max_iter': 10000.0, 'multiclass_strategy': 'ovr'}
|
||||
[94m*************************************************************************************************************************
|
||||
[94m* accuracy compared to STree_default (liblinear-ovr) .: 0.0454 *
|
||||
[94m*************************************************************************************************************************
|
||||
Which result do you want to report? (q to quit, r to list again, number to report): Generated file: some_results.xlsx
|
||||
Added results/results_accuracy_STree_iMac27_2021-09-30_11:42:07_0.json to some_results.xlsx
|
||||
Generated file: some_results.xlsx
|
||||
|
@@ -3,34 +3,6 @@
|
||||
[96m 0 2021-11-01 results_accuracy_STree_macbook-pro_2021-11-01_19:17:07_0.json 0.03790 1.143 default B
|
||||
[94m 1 2021-10-27 results_accuracy_STree_iMac27_2021-10-27_09:40:40_0.json 0.04158 0.943 default A
|
||||
[96m 2 2021-09-30 results_accuracy_STree_iMac27_2021-09-30_11:42:07_0.json 0.04544 0.173 With gridsearched hyperparameters
|
||||
Which result do you want to report? (q to quit, r to list again, number to report): [94m*************************************************************************************************************************
|
||||
[94m* STree ver. 1.2.3 Python ver. 3.11x with 5 Folds cross validation and 10 random seeds. 2021-09-30 11:42:07 *
|
||||
[94m* With gridsearched hyperparameters *
|
||||
[94m* Random seeds: [57, 31, 1714, 17, 23, 79, 83, 97, 7, 1] Stratified: False *
|
||||
[94m* Execution took 624.25 seconds, 0.17 hours, on iMac27 *
|
||||
[94m* Score is accuracy *
|
||||
[94m*************************************************************************************************************************
|
||||
|
||||
Dataset Sampl. Feat. Cls Nodes Leaves Depth Score Time Hyperparameters
|
||||
============================== ====== ===== === ======= ======= ======= =============== ================= ===============
|
||||
[96mbalance-scale 625 4 3 7.00 4.00 3.00 0.970560±0.0150 0.014049±0.0020 {'C': 10000.0, 'gamma': 0.1, 'kernel': 'rbf', 'max_iter': 10000.0, 'multiclass_strategy': 'ovr'}
|
||||
[94mballoons 16 4 2 3.00 2.00 2.00 0.860000±0.2850 0.000854±0.0000 {'C': 7, 'gamma': 0.1, 'kernel': 'rbf', 'max_iter': 10000.0, 'multiclass_strategy': 'ovr'}
|
||||
[94m*************************************************************************************************************************
|
||||
[94m* accuracy compared to STree_default (liblinear-ovr) .: 0.0454 *
|
||||
[94m*************************************************************************************************************************
|
||||
Which result do you want to report? (q to quit, r to list again, number to report): [94m*************************************************************************************************************************
|
||||
[94m* STree ver. 1.2.3 Python ver. 3.11x with 5 Folds cross validation and 10 random seeds. 2021-10-27 09:40:40 *
|
||||
[94m* default A *
|
||||
[94m* Random seeds: [57, 31, 1714, 17, 23, 79, 83, 97, 7, 1] Stratified: False *
|
||||
[94m* Execution took 3395.01 seconds, 0.94 hours, on iMac27 *
|
||||
[94m* Score is accuracy *
|
||||
[94m*************************************************************************************************************************
|
||||
|
||||
Dataset Sampl. Feat. Cls Nodes Leaves Depth Score Time Hyperparameters
|
||||
============================== ====== ===== === ======= ======= ======= =============== ================= ===============
|
||||
[96mbalance-scale 625 4 3 11.08 5.90 5.90 0.980000±0.0010 0.285207±0.0603 {'splitter': 'best', 'max_features': 'auto'}
|
||||
[94mballoons 16 4 2 4.12 2.56 2.56 0.695000±0.2757 0.021201±0.0035 {'splitter': 'best', 'max_features': 'auto'}
|
||||
[94m*************************************************************************************************************************
|
||||
[94m* accuracy compared to STree_default (liblinear-ovr) .: 0.0416 *
|
||||
[94m*************************************************************************************************************************
|
||||
Which result do you want to report? (q to quit, r to list again, number to report): Generated file: some_results.xlsx
|
||||
Added results/results_accuracy_STree_iMac27_2021-09-30_11:42:07_0.json to some_results.xlsx
|
||||
Added results/results_accuracy_STree_iMac27_2021-10-27_09:40:40_0.json to some_results.xlsx
|
||||
Generated file: some_results.xlsx
|
||||
|
Reference in New Issue
Block a user