def load_world(self, world_type):
"""For open world validation, we must keep track of which onion service
a trace came from. However for closed world validation, we can select
traces without consideration of which site they belong to.
:returns: a pandas DataFrame df containing the dataset
"""
select_hs_urls = ', t3.hs_url' if world_type is 'open' else ''
labeled_query = ('select t1.*, t3.is_sd {} '
'from features.frontpage_features t1 '
'inner join raw.frontpage_examples t2 '
'on t1.exampleid = t2.exampleid '
'inner join raw.hs_history t3 '
'on t3.hsid = t2.hsid').format(select_hs_urls)
df = pd.read_sql(labeled_query, self.engine)
return df
评论列表
文章目录