Ejemplo n.º 1
0
def addLabel(cursor, experiment_label_id, instance_id, final_label, family,
             iteration_number, method, annotation):
    types = ['INT UNSIGNED', 'INT UNSIGNED', 'VARCHAR(200)']
    types += ['VARCHAR(200)', 'INT', 'VARCHAR(200)', 'BIT(1)']
    label_info = [
        experiment_label_id, instance_id, final_label, family,
        iteration_number, method, annotation
    ]
    mysql_tools.insertRowIntoTable(cursor, 'Labels', label_info, types)
Ejemplo n.º 2
0
 def createDbLine(self):
     if self.iteration_number == 1:
         types = ['INT UNSIGNED', 'INT UNSIGNED', 'BIT(1)']
         values = [self.experiment.experiment_id, self.iteration_number, False]
         mysql_tools.insertRowIntoTable(self.experiment.cursor, 'InteractiveExperiments',
                 values, types)
     else:
         query  = 'UPDATE InteractiveExperiments '
         query += 'SET current_iter = ' + str(self.iteration_number) + ', '
         query += 'annotations = 0 '
         query += 'WHERE id = ' + str(self.experiment.experiment_id) + ';'
         self.experiment.cursor.execute(query)
     self.experiment.db.commit()
Ejemplo n.º 3
0
 def addExperimentDB(self):
     ## Get the experiment_label id
     self.cursor.execute('SELECT id FROM ExperimentsLabels \
             WHERE label = %s', (self.experiment_label,))
     experiment_label_id = self.cursor.fetchone()
     if experiment_label_id is not None:
         self.experiment_label_id = experiment_label_id[0]
     else:
         self.experiment_label_id = experiment_db_tools.addExperimentLabel(
                 self.cursor,
                 self.experiment_label)
     types = ['INT UNSIGNED', 'VARCHAR(200)', 'VARCHAR(1000)',
             'INT UNSIGNED', 'INT UNSIGNED']
     values = [0, self.kind, self.experiment_name,
             self.experiment_label_id, self.parent]
     mysql_tools.insertRowIntoTable(self.cursor, 'Experiments',
             values, types)
     self.experiment_id = mysql_tools.getLastInsertedId(self.cursor)
Ejemplo n.º 4
0
def addExperimentLabel(cursor, experiment_label):
    types = ['INT UNSIGNED', 'VARCHAR(1000)']
    values = [0, experiment_label]
    mysql_tools.insertRowIntoTable(cursor, 'ExperimentsLabels', values, types)
    experiment_label_id = mysql_tools.getLastInsertedId(cursor)
    return experiment_label_id