1
0
Fork 0

Add build amalgamated CIMS method

parallel_struct_est
philpMartin 4 years ago
parent 8a9a0d44ed
commit a20ed4e0eb
  1. 6
      main_package/classes/amalgamated_cims.py
  2. 3
      main_package/classes/network_graph.py

@ -12,9 +12,9 @@ class AmalgamatedCims:
def init_cims_structure(self, keys, dims): def init_cims_structure(self, keys, dims):
for key, dim in (keys, dims): for key, dim in (keys, dims):
self.actual_cims[key] = np.empty(dim, dtype=cim.ConditionalIntensityMatrix) self.actual_cims[key] = np.empty(dim, dtype=cim.ConditionalIntensityMatrix)
for block_matrix in self.actual_cims.values(): for key in self.actual_cims.keys():
for matrix in block_matrix: for indx in range(len(self.actual_cims[key])):
matrix = cim.ConditionalIntensityMatrix(self.states_per_variable) self.actual_cims[key][indx] = cim.ConditionalIntensityMatrix(self.states_per_variable)
def compute_matrix_indx(self, row, col): def compute_matrix_indx(self, row, col):
return self.state_per_variable * row + col return self.state_per_variable * row + col

@ -21,7 +21,6 @@ class NetworkGraph():
def init_graph(self): def init_graph(self):
self.sample_path.build_trajectories() self.sample_path.build_trajectories()
self.sample_path.build_structure() self.sample_path.build_structure()
print(self.sample_path.structure.list_of_edges())
self.add_edges(self.sample_path.structure.list_of_edges()) self.add_edges(self.sample_path.structure.list_of_edges())
def add_edges(self, list_of_edges): def add_edges(self, list_of_edges):
@ -40,4 +39,4 @@ s1 = sp.SamplePath(path)
g1 = NetworkGraph(s1) g1 = NetworkGraph(s1)
g1.init_graph() g1.init_graph()
print(g1.graph)