def counts_to_tfidf(count_matrix, idfs):
  """Convert counts to Tf-Idf scores given diagonal idf matrix."""
  tfs = count_matrix.log1p()
  tfidfs = idfs.dot(tfs)
  return tfidfs
Convert counts to Tf-Idf scores given diagonal idf matrix.
language/labs/drkit/search_utils.py