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)
评论列表
文章目录