MVectorizer.py 文件源码

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

项目:QuestionAnswerNLP 作者: debjyoti385 项目源码 文件源码
def normalize(matrix):
  '''Normalize each row (L2-norm) of a CSR sparse matrix (it should work with most sparse matrices though)'''
  sparsy = matrix.tocoo()
  data = [float(d) for d in sparsy.data]
  return Normalizer().transform(csr_matrix((data, (sparsy.row, sparsy.col))))


#
# Simple tests
#
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号