From 51303bd8a1bae94f229912074a73b1e470fbe1d0 Mon Sep 17 00:00:00 2001 From: Luca Moretti Date: Tue, 2 Mar 2021 16:29:25 +0100 Subject: [PATCH] Removed tests server --- ...cture_constraint_based_estimator_server.py | 58 -------------- ..._structure_score_based_estimator_server.py | 79 ------------------- 2 files changed, 137 deletions(-) delete mode 100644 PyCTBN/tests/estimators/test_structure_constraint_based_estimator_server.py delete mode 100644 PyCTBN/tests/estimators/test_structure_score_based_estimator_server.py diff --git a/PyCTBN/tests/estimators/test_structure_constraint_based_estimator_server.py b/PyCTBN/tests/estimators/test_structure_constraint_based_estimator_server.py deleted file mode 100644 index 5dd3519..0000000 --- a/PyCTBN/tests/estimators/test_structure_constraint_based_estimator_server.py +++ /dev/null @@ -1,58 +0,0 @@ - -import glob -import math -import os -import unittest - -import networkx as nx -import numpy as np -import psutil - -from ...PyCTBN.utility.cache import Cache -from ...PyCTBN.structure_graph.sample_path import SamplePath -from ...PyCTBN.estimators.structure_constraint_based_estimator import StructureConstraintBasedEstimator -from ...PyCTBN.utility.json_importer import JsonImporter - -from multiprocessing import set_start_method - -import copy - - -class TestStructureConstraintBasedEstimator(unittest.TestCase): - @classmethod - def setUpClass(cls): - pass - - def test_structure(self): - #cls.read_files = glob.glob(os.path.join('../../data', "*.json")) - self.importer = JsonImporter("./PyCTBN/test_data/networks_and_trajectories_binary_data_01_3.json", 'samples', 'dyn.str', 'variables', 'Time', 'Name') - self.s1 = SamplePath(self.importer) - self.s1.build_trajectories() - self.s1.build_structure() - - true_edges = copy.deepcopy(self.s1.structure.edges) - true_edges = set(map(tuple, true_edges)) - - - se1 = StructureConstraintBasedEstimator(self.s1,0.1,0.1) - edges = se1.estimate_structure(disable_multiprocessing=False) - - - self.importer = JsonImporter("./PyCTBN/test_data/networks_and_trajectories_binary_data_01_3.json", 'samples', 'dyn.str', 'variables', 'Time', 'Name') - self.s1 = SamplePath(self.importer) - self.s1.build_trajectories() - self.s1.build_structure() - - true_edges = copy.deepcopy(self.s1.structure.edges) - true_edges = set(map(tuple, true_edges)) - - - se1 = StructureConstraintBasedEstimator(self.s1,0.1,0.1) - edges = se1.estimate_structure(disable_multiprocessing=True) - - - - self.assertEqual(edges, true_edges) - -if __name__ == '__main__': - unittest.main() diff --git a/PyCTBN/tests/estimators/test_structure_score_based_estimator_server.py b/PyCTBN/tests/estimators/test_structure_score_based_estimator_server.py deleted file mode 100644 index 8631d70..0000000 --- a/PyCTBN/tests/estimators/test_structure_score_based_estimator_server.py +++ /dev/null @@ -1,79 +0,0 @@ - -import glob -import math -import os -import unittest - -import networkx as nx -import numpy as np -import psutil - -import copy - -from ...PyCTBN.utility.cache import Cache -from ...PyCTBN.structure_graph.sample_path import SamplePath -from ...PyCTBN.estimators.structure_score_based_estimator import StructureScoreBasedEstimator -from ...PyCTBN.utility.json_importer import JsonImporter - - - -class TestStructureScoreBasedEstimator(unittest.TestCase): - - @classmethod - def setUpClass(cls): - pass - - - - def test_structure(self): - #cls.read_files = glob.glob(os.path.join('../../data', "*.json")) - self.importer = JsonImporter("./PyCTBN/test_data/networks_and_trajectories_binary_data_01_3.json", 'samples', 'dyn.str', 'variables', 'Time', 'Name') - self.s1 = SamplePath(self.importer) - self.s1.build_trajectories() - self.s1.build_structure() - - true_edges = copy.deepcopy(self.s1.structure.edges) - true_edges = set(map(tuple, true_edges)) - - - se1 = StructureScoreBasedEstimator(self.s1) - edges = se1.estimate_structure( - max_parents = None, - iterations_number = 100, - patience = 35, - tabu_length = 15, - tabu_rules_duration = 15, - optimizer = 'tabu', - disable_multiprocessing=False - ) - - - self.importer = JsonImporter("./PyCTBN/test_data/networks_and_trajectories_binary_data_01_3.json", 'samples', 'dyn.str', 'variables', 'Time', 'Name') - self.s1 = SamplePath(self.importer) - self.s1.build_trajectories() - self.s1.build_structure() - - true_edges = copy.deepcopy(self.s1.structure.edges) - true_edges = set(map(tuple, true_edges)) - - - se1 = StructureScoreBasedEstimator(self.s1) - edges = se1.estimate_structure( - max_parents = None, - iterations_number = 100, - patience = 35, - tabu_length = 15, - tabu_rules_duration = 15, - optimizer = 'tabu', - disable_multiprocessing=True - ) - - - - self.assertEqual(edges, true_edges) - - - -if __name__ == '__main__': - unittest.main() -