本文整理匯總了Python中Dataset.Dataset.from_db_rows方法的典型用法代碼示例。如果您正苦於以下問題:Python Dataset.from_db_rows方法的具體用法?Python Dataset.from_db_rows怎麽用?Python Dataset.from_db_rows使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Dataset.Dataset
的用法示例。
在下文中一共展示了Dataset.from_db_rows方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_all_dataset
# 需要導入模塊: from Dataset import Dataset [as 別名]
# 或者: from Dataset.Dataset import from_db_rows [as 別名]
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
示例2: get_benchmarking_data
# 需要導入模塊: from Dataset import Dataset [as 別名]
# 或者: from Dataset.Dataset import from_db_rows [as 別名]
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
示例3: get_random_dataset
# 需要導入模塊: from Dataset import Dataset [as 別名]
# 或者: from Dataset.Dataset import from_db_rows [as 別名]
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