database.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:fingerprint-securedrop 作者: freedomofpress 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号