base.py 文件源码

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

项目:vec4ir 作者: lgalke 项目源码 文件源码
def query(self, query, k=None, indices=None):
        if self._fit_X is None:
            raise NotFittedError
        q = super().transform([query])
        if indices is not None:
            fit_X = self._fit_X[indices]
        else:
            fit_X = self._fit_X
        # both fit_X and q are l2-normalized
        D = linear_kernel(q, fit_X)
        ind = argtopk(D[0], k)
        return ind
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号