data.py 文件源码

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

项目:bisemantic 作者: wpm 项目源码 文件源码
def _batches(self):
        """
        Partition the data into consecutive data sets of the specified batch size.

        :return: batched data
        :rtype: DataFrame iterator
        """
        t1 = partition_all(self.batch_size, self.data[text_1])
        t2 = partition_all(self.batch_size, self.data[text_2])
        if self._labeled:
            l = partition_all(self.batch_size, self.data[label].cat.codes)
            batches = zip(t1, t2, l)
        else:
            batches = zip(t1, t2)
        for batch in batches:
            if self._labeled:
                columns = [text_1, text_2, label]
            else:
                columns = [text_1, text_2]
            yield DataFrame(dict(zip(columns, batch)), columns=columns)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号