shiralkarprashant / knowledgestream

Code to reproduce results in "Finding Streams in Knowledge Graphs to Support Fact Checking"
36 stars 18 forks source link

Implementation methods in this repo on my knowledge graph #12

Closed ram7i closed 2 years ago

ram7i commented 2 years ago

Hi, I'm interested in implementing some methods on my knowledge graph. When I read that in your paper,

relational similarity using TF-IDF representation and cosine similarity.

I'm confused how to get this square matrix which contains 'rel sim' scores. How do you use TF-IDF to count relational weights? I guess I need to first construct an adjacency matrix between relations based on my knowledge graph, Could you briefly describe how you do it in code or provide the relevant code? Thanks in advance, looking forward to your reply

shiralkarprashant commented 2 years ago

Hi,

As described in the paper, we create the relational similarity matrix based on a TF-iDF computation on the co-occurrence matrix of relations in our knowledge graph.

The code computing this similarity matrix is at https://github.com/shiralkarprashant/knowledgestream/blob/ca662ec6d4f57d0d776183ff53accb933d470b63/algorithms/relcooc/relsim.py#L102

If you’d like to know how to count the co-occurrence, take a look at this module: https://github.com/shiralkarprashant/knowledgestream/blob/master/algorithms/relcooc/relcooc.py

Hope this helps. Let me know if you have any questions.

On Tue, Jan 25, 2022 at 05:29 ram7i @.***> wrote:

Hi, I'm interested in implementing some methods on my knowledge graph. When I read that in your paper,

relational similarity using TF-IDF representation and cosine similarity.

I'm confused how to get this square matrix which contains 'rel sim' scores. How do you use TF-IDF to count relational weights? I guess I need to first construct an adjacency matrix between relations based on my knowledge graph, Could you briefly describe how you do it in code or provide the relevant code? Thanks in advance, looking forward to your reply

— Reply to this email directly, view it on GitHub https://github.com/shiralkarprashant/knowledgestream/issues/12, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADSVZIBW7FQRSO5ANI5772LUX2QUFANCNFSM5MYILPNA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>