From 96a93957e61b7dea2782d89e2a6126ae94edb83d Mon Sep 17 00:00:00 2001 From: Luca Moretti Date: Mon, 2 Nov 2020 14:19:34 +0100 Subject: [PATCH] Completed first results tests --- main_package/classes/estimators/fam_score_calculator.py | 5 +++-- .../tests/estimators/test_structure_score_based_estimator.py | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/main_package/classes/estimators/fam_score_calculator.py b/main_package/classes/estimators/fam_score_calculator.py index 3392faa..5ac59c3 100644 --- a/main_package/classes/estimators/fam_score_calculator.py +++ b/main_package/classes/estimators/fam_score_calculator.py @@ -22,8 +22,6 @@ import structure_graph.conditional_intensity_matrix as cim_class ''' TODO: Parlare dell'idea di ciclare sulle cim senza filtrare -TODO: Parlare del problema con gamma in scipy e math(overflow) -TODO: Problema warning overflow durante l'esecuzione ''' @@ -105,6 +103,9 @@ class FamScoreCalculator: 'remove the index because of the x != x^ condition in the summation ' values.remove(index) + 'uncomment for alpha xx not uniform' + #alpha_xxu = alpha_xu * cim.state_transition_matrix[index,index_x_first] / cim.state_transition_matrix[index, index]) + return (loggamma(alpha_xu) - loggamma(alpha_xu + cim.state_transition_matrix[index, index])) \ + \ np.sum([self.single_internal_cim_xxu_marginal_likelihood_theta( diff --git a/main_package/tests/estimators/test_structure_score_based_estimator.py b/main_package/tests/estimators/test_structure_score_based_estimator.py index 9d1c56c..3321ed3 100644 --- a/main_package/tests/estimators/test_structure_score_based_estimator.py +++ b/main_package/tests/estimators/test_structure_score_based_estimator.py @@ -23,7 +23,7 @@ class TestStructureScoreBasedEstimator(unittest.TestCase): @classmethod def setUpClass(cls): #cls.read_files = glob.glob(os.path.join('../../data', "*.json")) - cls.importer = ji.JsonImporter("../../data/networks_and_trajectories_quaternary_data_01_3.json", 'samples', 'dyn.str', 'variables', 'Time', 'Name') + cls.importer = ji.JsonImporter("../../data/networks_and_trajectories_binary_data_01_3.json", 'samples', 'dyn.str', 'variables', 'Time', 'Name') cls.s1 = sp.SamplePath(cls.importer) cls.s1.build_trajectories() cls.s1.build_structure() @@ -38,7 +38,7 @@ class TestStructureScoreBasedEstimator(unittest.TestCase): edges = se1.estimate_structure( max_parents = None, iterations_number = 100, - patience = None + patience = None )