IBCNServices / pyRDF2Vec

🐍 Python Implementation and Extension of RDF2Vec
https://pyrdf2vec.readthedocs.io/en/latest/
MIT License
244 stars 49 forks source link

prediction algorithms in rdf2vec #45

Closed nnadine25 closed 3 years ago

nnadine25 commented 3 years ago

hi , i whould ask what is the algorithm used in rdf2vec : cbow or skip-gram , and how we can change from an algorithm to another ?

rememberYou commented 3 years ago

RDF2Vec uses Word2Vec. Therefore, the use of CBOW or Skip-Gram is up to you, depending on your use case. The pyRDF2Vec library uses gensim's Word2Vec implementation which by default uses CBOW. However, you can use Skip-Gram by modifying the sg hyperparameter:

from pyrdf2vec.embedders import Word2Vec

# To use CBOW (default behavior):
w2v = Word2Vec(sg=0)

# To use Skip-Gram:
w2v = Word2Vec(sg=1)

Refer to the appropriate documentation for more information.