Word2Vec

Quick AI

Written By Brian Sathinathan (Super Administrator)

Updated at October 14th, 2020

Description 

Word2vec is a node used to create visualizations of a given Word2vec model that can be viewed via Tensorboard. This node can also be used to retrieve the Word2vec vector of a given word.

Word2Vec Visualization 

The node can act as a standalone node for visualization.

!Note: make sure the interplay port 8066 is open for visualization to work.

Code for above flow 

[{"id":"13e1f716.af5499","type":"Word2Vector","z":"3dc59f97.6b91f","name":"","data":"","file_path":"","tensorboard_path":"","outputs":1,"x":340,"y":600,"wires":[[]]}]

Parameters

Name (string) – optional

The name of the word2vec model node.

Model path (string) – required

The file path for the pre-trained Word2vec model.

To see the visualization press the ““` ‘Visualize Word2Vec model‘ button.


Word2Vec Inference

The Word2vec node can be also use to retrieve the Word2vec vector of a given word. However, the node can only infer words which are already in the Word2vec vocabulary.

Code for above flow 

[{"id":"13e1f716.af5499","type":"Word2Vector","z":"3dc59f97.6b91f","name":"","data":"","file_path":"/interplay/dataset/word2vec_path","tensorboard_path":"","outputs":1,"x":320,"y":600,"wires":[["d6f32211.c83e2"]]},{"id":"d6f32211.c83e2","type":"console","z":"3dc59f97.6b91f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":530,"y":600,"wires":[]},{"id":"58479270.83d61c","type":"inject","z":"3dc59f97.6b91f","name":"","topic":"","payload":"word","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":600,"wires":[["13e1f716.af5499"]]}]

Input

Payload (string)

The word that needs the Word2vec vector of.

Name (string) – optional

The name of the word2vec model node.

Model path (string) – required

The file path for the pre-trained Word2vec model.

Parameters

Name (string) – optional

The name of the word2vec model node.

Model path (string) – required

The file path for the pre-trained Word2vec model.

To see the visualization press the ““` ‘Visualize Word2Vec model’ button.