def regenerate(self, markov_model_id):
     """ Regenerate the markvov chain """
     try:
         markov_model = self.get_markov_model(int(markov_model_id))
     except KeyError:
         print_error('No such markov model id')
         return False
     label = __group_of_labels__.get_label_by_id(
         markov_model.get_label_id())
     connections = label.get_connections_complete()
     # Get all the group of models and connections names
     state = ""
     for group_of_model_id in connections:
         # Get all the connections
         for conn in connections[group_of_model_id]:
             # Get the model group
             group = __groupofgroupofmodels__.get_group(group_of_model_id)
             # Get the model
             model = group.get_model(conn)
             # Get each state
             state += model.get_state() + '#'
     # Delete the last #
     state = state[:-1]
     # Store the state
     markov_model.set_state(state)
     # Store the connections
     markov_model.set_connections(connections)
     # Create the MM itself
     markov_model.create(markov_model.get_state())
     print_info('Markov model {} regenerated.'.format(markov_model_id))
 def regenerate(self, markov_model_id):
     """ Regenerate the markvov chain """
     try:
         markov_model = self.get_markov_model(int(markov_model_id))
     except KeyError:
         print_error('No such markov model id')
         return False
     label = __group_of_labels__.get_label_by_id(markov_model.get_label_id())
     connections = label.get_connections_complete()
     # Get all the group of models and connections names
     state = ""
     for group_of_model_id in connections:
         # Get all the connections
         for conn in connections[group_of_model_id]:
             # Get the model group
             group = __groupofgroupofmodels__.get_group(group_of_model_id)
             # Get the model
             model = group.get_model(conn)
             # Get each state
             state += model.get_state() + '#'
     # Delete the last #
     state = state[:-1]
     # Store the state
     markov_model.set_state(state)
     # Store the connections
     markov_model.set_connections(connections)
     # Create the MM itself
     markov_model.create(markov_model.get_state())
     print_info('Markov model {} regenerated.'.format(markov_model_id))
 def get_label(self):
     """ Return the label name"""
     label = __group_of_labels__.get_label_by_id(self.get_label_id())
     if label:
         label_name = label.get_name()
     else:
         print_error('The label used in the markov model {} does not exist anymore. You should delete the markov chain manually (The markov chain {} does not appear in the following list).'.format(self.get_id(), self.get_id()))
     return label
Exemple #4
0
 def get_label(self):
     """ Return the label name"""
     label = __group_of_labels__.get_label_by_id(self.get_label_id())
     if label:
         label_name = label.get_name()
     else:
         print_error('The label used in the markov model {} does not exist anymore. You should delete the markov chain manually (The markov chain {} does not appear in the following list).'.format(self.get_id(), self.get_id()))
     return label
 def __repr__(self):
     label = __group_of_labels__.get_label_by_id(self.get_label_id())
     if label:
         label_name = label.get_name()
     else:
         label_name = 'Deleted'
     #current_connections = label.get_connections_complete()
     response = "Id:"+str(self.get_id())+", Label: "+label_name+", State Len:"+str(len(self.get_state()))+", #Conns:"+str(self.count_connections())+", First 50 states: "+self.get_state()[0:50]
     return(response)
Exemple #6
0
 def __repr__(self):
     label = __group_of_labels__.get_label_by_id(self.get_label_id())
     if label:
         label_name = label.get_name()
     else:
         label_name = 'Deleted'
     #current_connections = label.get_connections_complete()
     response = "Id:"+str(self.get_id())+", Label: "+label_name+", State Len:"+str(len(self.get_state()))+", #Conns:"+str(self.count_connections())+", First 50 states: "+self.get_state()[0:50]
     return(response)
 def get_testing_label(self):
     """ Get the testing label of the training model """
     try:
         model_testing = self.get_model_from_id(self.get_structure_testing(), self.get_model_testing_id())
     except AttributeError:
         labelname = 'Deleted'
         return labelname
     try:
         label = __group_of_labels__.get_label_by_id(model_testing.get_label_id())
     except AttributeError:
         labelname = 'Deleted'
         return labelname
     if label:
         labelname = label.get_name()
     else:
         labelname = 'Deleted'
     return labelname