Search code examples
pythonnlpnegative-numberdoc2vecnmf

How to make Doc2Vec document vectors all positive?


I'm trying to use nonnegative matrix factorization on the output of Doc2Vec. However there is a constraint that there can be no negative input. How do I make it positive without doing something like absolute value that will construe the results? If it helps, I'm loading in a new paragraph and computing similarity but I thought that using Doc2Vec would capture more meaning.


Solution

  • You can normalize all the values, to be between 0 and 1, for instance, if you have a vector X, you can obtain a normalized version Z:

    enter image description here