0

I'm using deeplearning4j to learn text data.

I'm done with word2vec tutorial at deeplearning4j website and successfully

trained word vectors with 100 documents.

but i don't know how to get cosign distance of two different words like below picture

enter image description here

Like this picture, if i insert word 'France'

i want to get

[similar words with france + cosign distance]

i can get [similar words with france]

but i don't know how to get cosign distance value.

any solution?

2 Answers2

0

oops sorry my bad i missed some parts of tutorial

sorry

i get solution

double cosSim = vec.similarity("day", "night");
        System.out.println(cosSim);
        //output: 0.7704452276229858

sorry

forget about this stupid question

0

if you want to know how to do it with just nd4j, you can also use:

https://github.com/deeplearning4j/nd4j/blob/master/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/ops/transforms/Transforms.java#L53

Adam Gibson
  • 3,055
  • 1
  • 10
  • 12