Exemple #1
0
    def get_all_dataset(self, idmodel):
        con = lite.connect(self.name)

        with con:
            con.row_factory = lite.Row
            cur = con.cursor()
            cur.execute("SELECT * FROM dataset where idmodel=:idmodel", {'idmodel': idmodel})
                    
            rows = cur.fetchall()
            dataset = Dataset.from_db_rows(rows, self.setup)
            
        return dataset   
Exemple #2
0
 def get_benchmarking_data(self, idmodel, it=-1):
     """
     Returns a Dataset instance with the data used for learning up to iteration it
     """
     con = lite.connect(self.name)
     
     cues = []
     obs = []
     nobs = defaultdict(int)
     
     with con:
         con.row_factory = lite.Row
         cur = con.cursor()
         if it < 0:
             cur.execute("SELECT * FROM benchmark_data WHERE idmodel=:idmodel", {'idmodel': idmodel})
         else:
             cur.execute("SELECT * FROM benchmark_data WHERE idmodel=:idmodel AND it<=:it", {'idmodel': idmodel, 'it': it})
     
         rows = cur.fetchall()
         dataset = Dataset.from_db_rows(rows, self.setup)
 
     return dataset
Exemple #3
0
 def get_random_dataset(self, idmodel, nexp, max_stimuli=0, max_inhibitors=0):
     rows = self.get_population_rows(idmodel, max_stimuli, max_inhibitors)
     exps = random.sample(rows, nexp)
     dataset = Dataset.from_db_rows(exps, self.setup)
         
     return dataset