glove.py 文件源码

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

项目:vw_glove 作者: KristianHolsheimer 项目源码 文件源码
def vw_lines_diagonal_only(self, shuffle=True, truncate=None):
        """
        Generator that yields Vowpal Wabbit formatted labeled example lines.

        Params
        ------
        shuffle : bool (default=True)
            Whether to shuffle to data before iterating through it.

        truncate : int (default=None)
            Truncate the generator after

        """
        if not hasattr(self, 'token_dictionary_'):
            raise NotFittedError(
                "No co-occurrence info available; please run either "
                "`get_cooccurrence_info` or `load_cooccurrence_info`")

        vw_template = "|u {0:d} |v {0:d}"

        for i in islice(self.token_dictionary_inv_.index, truncate):
            yield vw_template.format(i)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号