replace pairtest lose test

This commit is contained in:
2022-04-26 16:07:47 +02:00
parent 7ddfa829d4
commit 358c1f386c
5 changed files with 26 additions and 5 deletions

View File

@@ -1252,6 +1252,7 @@ class PairCheck:
self.score_b = report_b.score
for result_a, result_b in zip(report_a.lines, report_b.lines):
result = result_a["score"] - result_b["score"]
if result > 0:
self.winners.append(result_a["dataset"])
elif result < 0:

View File

@@ -41,7 +41,9 @@ class PairCheckTest(unittest.TestCase):
self.assertEqual(computed, expected)
def test_pair_check_lose(self):
report = self.build_model(lose=True)
report = self.build_model(
model1="RandomForest", model2="STree", lose=True
)
report.compute()
with patch("sys.stdout", new=StringIO()) as fake_out:
report.report()

View File

@@ -3,7 +3,6 @@ import unittest
from io import StringIO
from unittest.mock import patch
from ..Results import Summary
from ..Utils import Symbols
class SummaryTest(unittest.TestCase):
@@ -232,3 +231,15 @@ class SummaryTest(unittest.TestCase):
),
}
self.assertSequenceEqual(computed, expected)
def test_show_top(self):
report = Summary()
report.acquire()
with patch("sys.stdout", new=StringIO()) as fake_out:
report.show_top()
computed = fake_out.getvalue()
with open(
os.path.join("test_files", "summary_show_top.test"), "r"
) as f:
expected = f.read()
self.assertEqual(computed, expected)

View File

@@ -1,6 +1,6 @@
Model File Score Win Tie Lose
==================== ====================================================================== ========== === === ====
STree results_accuracy_STree_iMac27_2021-09-30_11:42:07_0.json 0.04544
RandomForest results_accuracy_RandomForest_iMac27_2022-01-14_12:39:30_0.json 0.03627  2  0  0
RandomForest results_accuracy_RandomForest_iMac27_2022-01-14_12:39:30_0.json 0.03627
STree results_accuracy_STree_iMac27_2021-09-30_11:42:07_0.json 0.04544  0  0  2
losers:
[]
['balance-scale', 'balloons']

View File

@@ -0,0 +1,7 @@
Date File Score Time(h) Title
========== =============================================================== ======== ======= ============================================
2021-09-30 results_accuracy_STree_iMac27_2021-09-30_11:42:07_0.json 0.04544 0.173 With gridsearched hyperparameters
2022-04-20 results_accuracy_ODTE_Galgo_2022-04-20_10:52:20_0.json 0.04341 6.275 Gridsearched hyperparams v022.1b random_init
2021-10-27 results_accuracy_STree_iMac27_2021-10-27_09:40:40_0.json 0.04158 0.943 default A
2021-11-01 results_accuracy_STree_macbook-pro_2021-11-01_19:17:07_0.json 0.03790 1.143 default B
2022-01-14 results_accuracy_RandomForest_iMac27_2022-01-14_12:39:30_0.json 0.03627 0.076 Test default paramters with RandomForest