1
0
Fork 0

Completed first results tests

master
Luca Moretti 4 years ago
parent 6f41a207e1
commit 96a93957e6
  1. 5
      main_package/classes/estimators/fam_score_calculator.py
  2. 4
      main_package/tests/estimators/test_structure_score_based_estimator.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 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 ' 'remove the index because of the x != x^ condition in the summation '
values.remove(index) 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])) \ return (loggamma(alpha_xu) - loggamma(alpha_xu + cim.state_transition_matrix[index, index])) \
+ \ + \
np.sum([self.single_internal_cim_xxu_marginal_likelihood_theta( np.sum([self.single_internal_cim_xxu_marginal_likelihood_theta(

@ -23,7 +23,7 @@ class TestStructureScoreBasedEstimator(unittest.TestCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
#cls.read_files = glob.glob(os.path.join('../../data', "*.json")) #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 = sp.SamplePath(cls.importer)
cls.s1.build_trajectories() cls.s1.build_trajectories()
cls.s1.build_structure() cls.s1.build_structure()
@ -38,7 +38,7 @@ class TestStructureScoreBasedEstimator(unittest.TestCase):
edges = se1.estimate_structure( edges = se1.estimate_structure(
max_parents = None, max_parents = None,
iterations_number = 100, iterations_number = 100,
patience = None patience = None
) )