VAE-Text-Generation icon indicating copy to clipboard operation
VAE-Text-Generation copied to clipboard

where does this 'sent_encoded' comes from?

Open AlucardNosferatu opened this issue 4 years ago • 0 comments

# input: encoded sentence vector
# output: encoded sentence vector in dataset with highest cosine similarity
def find_similar_encoding(sent_vect):
    all_cosine = []
    for sent in sent_encoded:
        result = 1 - spatial.distance.cosine(sent_vect, sent)
        all_cosine.append(result)
    data_array = np.array(all_cosine)
    maximum = data_array.argsort()[-3:][::-1][1]
    new_vec = sent_encoded[maximum]
    return new_vec

AlucardNosferatu avatar Jul 16 '20 01:07 AlucardNosferatu