Sujit-O / pykg2vec

Python library for knowledge graph embedding and representation learning.
MIT License
606 stars 111 forks source link

Issue for using pykg2vec #89

Closed PAVITHRA-CP closed 4 years ago

PAVITHRA-CP commented 4 years ago

Hi,

I have a graph based on the wordnet knowledge base. I want to convert each relation edge into a vector with ConvE and TransE model using pykg2vec. Can anyone help me with the same?

Thanks!

PAVITHRA-CP commented 4 years ago

How to use the wordnet18RR dataset. When I give "WordNet18RR" instead of "Freebase15k" it is showing "NotImplementedError: WN18RR dataset config not found!"

baxtree commented 4 years ago

As shown on this line https://github.com/Sujit-O/pykg2vec/blob/e285cd3a655eea7c4ee804dee8004cfaa677269c/pykg2vec/utils/kgcontroller.py#L552 , there is an underscore expected in the dataset name. So try WordNet18_RR or wn18_rr?

PAVITHRA-CP commented 4 years ago

Screenshot from 2020-01-02 15-51-55

baxtree commented 4 years ago

Hi, @PAVITHRA-CP, I guess you have been following experiment.py. I don't think it is up to date coz I can no longer see DataPrep, SMEBilinear or SMELinear defined anywhere. You may want to follow https://github.com/Sujit-O/pykg2vec/blob/master/examples/train.py to conduct the training on WordNet18_RR.

PAVITHRA-CP commented 4 years ago

I went through train.py, but while running that what all the arguments I have to pass. When I run the code without giving any arguments it automatically downloading FB15K.

Thank you for your great help.

Screenshot from 2020-01-03 11-22-15

baxtree commented 4 years ago

Looking closer to README.md, you will find you need to pass in the right flags: https://github.com/Sujit-O/pykg2vec#using-well-known-dataset

The following command worked for me: python pykg2vec/examples/train.py -mn TransE -ds WordNet18_RR

PAVITHRA-CP commented 4 years ago

What is "config = config_def(args=args)". I'm getting error that "'NoneType' object is not callable".

12

23

PAVITHRA-CP commented 4 years ago

Hi SIr,

I'm Confused with this code on after creating the model if we want to check the model what will be the input format and what will be the label?

PAVITHRA-CP commented 4 years ago

Hi Sir,

That code worked for me and the training was done. Thanks for your help.

Can you please help me to sort out: 1) How to test the model 2) What should be the format of input to be checked 3) What will be the output

baxtree commented 4 years ago

Glad it works for you now.

The most useful feature so far to me is the inference and I used it to do Knowledge Graph completion. In this case, the input are the trained model itself plus two triple parts (e.g., head and tail) and the output are top-k predicted triples containing the missing 3rd triple part (e.g, relation).

Take a look at those lines after https://github.com/Sujit-O/pykg2vec/blob/e285cd3a655eea7c4ee804dee8004cfaa677269c/pykg2vec/test/test_inference.py#L42 and run the test if you want to see the top-k predication.

PAVITHRA-CP commented 4 years ago

Hi Sir,

Thank you for your answers.

I'm using this for the implementation of 'Word sense disambiguation'. So I need to build a model with wordnet using kg2vec. For which I'm using this.

So from this dataset I will get top-k IDS as output? But testing and validating data is also in same format. There is no difference in training , testing, and validating data.

So what is the basics learning of this model while training the code.

PAVITHRA-CP commented 4 years ago

Hi Sir,

When I run the test_inference.py I got the result like this:

rslt

But I'm not getting what to infer from this result. If I want to check any other one triplet how to check that?

Please help me sir.

Thank @you.baxtree

louisccc commented 4 years ago

move the discussion to #136