本文整理汇总了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