{"id":13605388,"url":"https://github.com/HKUST-KnowComp/query2particles","last_synced_at":"2025-04-12T05:32:48.860Z","repository":{"id":75540409,"uuid":"485246040","full_name":"HKUST-KnowComp/query2particles","owner":"HKUST-KnowComp","description":"query2particles","archived":false,"fork":false,"pushed_at":"2023-02-16T06:28:47.000Z","size":91,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-08-02T19:37:21.330Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HKUST-KnowComp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-04-25T06:17:17.000Z","updated_at":"2023-10-03T19:43:02.000Z","dependencies_parsed_at":"2023-06-06T20:30:28.340Z","dependency_job_id":null,"html_url":"https://github.com/HKUST-KnowComp/query2particles","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HKUST-KnowComp%2Fquery2particles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HKUST-KnowComp%2Fquery2particles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HKUST-KnowComp%2Fquery2particles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HKUST-KnowComp%2Fquery2particles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HKUST-KnowComp","download_url":"https://codeload.github.com/HKUST-KnowComp/query2particles/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223497762,"owners_count":17155202,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T19:00:58.205Z","updated_at":"2024-11-07T10:30:29.630Z","avatar_url":"https://github.com/HKUST-KnowComp.png","language":"Python","funding_links":[],"categories":[":wrench: Implementations"],"sub_categories":["Dataset tools"],"readme":"# Query2particles\n\n\n\nThe code is for the implementation of the paper *Query2Particles: Knowledge Graph Reasoning with Particle Embeddings*, \naccepted by the Findings of NAACL 2022. \n\n\nBefore running the code please download the knowledge graph data from [here](http://snap.stanford.edu/betae/KG_data.zip)\n, and put them into \u003ccode\u003e ./data \u003c/code\u003e folder. For the details of the data, please check [here](https://github.com/snap-stanford/KGReasoning).\n\nThis code includes running two benchmark datasets for evaluating FOL and EPFL queries respectively. \nTo run the code, first you need to change the permissions of the shell scripts:\n\n\u003ccode\u003echmod u+x *.sh \u003c/code\u003e\n\nTo train and evaluate the results on FOL queries, you can run the following scripts separately:\n\u003ccode\u003e./run_beta_benchmark_FB15K.sh \u003c/code\u003e\n\u003ccode\u003e./run_beta_benchmark_FB15K_237.sh \u003c/code\u003e\n\u003ccode\u003e./run_beta_benchmark_NELL.sh \u003c/code\u003e\n\n\nTo train and evaluate the results on EPFL queries, you can run the following scripts separately:\n\u003ccode\u003e./run_q2p_benchmark_FB15K.sh \n\u003c/code\u003e\n\u003ccode\u003e./run_q2p_benchmark_FB15K_237.sh \u003c/code\u003e\n\u003ccode\u003e./run_q2p_benchmark_NELL.sh \u003c/code\u003e\n\nYou can also use tensorboard to monitor the training and evaluating process. To start the tensorboard,\nplease use\n\u003ccode\u003e tensorboard --logdir ./q2p_logs/gradient_tape/the-directory-named-by-starting-time --port the-port-you-fancy \u003c/code\u003e.\n\nIf you think this code is useful, please cite the original paper. \n\n```\n@inproceedings{bai-etal-2022-query2particles,\n    title = \"{Q}uery2{P}articles: Knowledge Graph Reasoning with Particle Embeddings\",\n    author = \"Bai, Jiaxin  and\n      Wang, Zihao  and\n      Zhang, Hongming  and\n      Song, Yangqiu\",\n    booktitle = \"Findings of the Association for Computational Linguistics: NAACL 2022\",\n    month = jul,\n    year = \"2022\",\n    address = \"Seattle, United States\",\n    publisher = \"Association for Computational Linguistics\",\n    url = \"https://aclanthology.org/2022.findings-naacl.207\",\n    doi = \"10.18653/v1/2022.findings-naacl.207\",\n    pages = \"2703--2714\",\n    abstract = \"Answering complex logical queries on incomplete knowledge graphs (KGs) with missing edges is a fundamental and important task for knowledge graph reasoning. The query embedding method is proposed to answer these queries by jointly encoding queries and entities to the same embedding space. Then the answer entities are selected according to the similarities between the entity embeddings and the query embedding. As the answers to a complex query are obtained from a combination of logical operations over sub-queries, the embeddings of the answer entities may not always follow a uni-modal distribution in the embedding space. Thus, it is challenging to simultaneously retrieve a set of diverse answers from the embedding space using a single and concentrated query representation such as a vector or a hyper-rectangle. To better cope with queries with diversified answers, we propose Query2Particles (Q2P), a complex KG query answering method. Q2P encodes each query into multiple vectors, named particle embeddings. By doing so, the candidate answers can be retrieved from different areas over the embedding space using the maximal similarities between the entity embeddings and any of the particle embeddings. Meanwhile, the corresponding neural logic operations are defined to support its reasoning over arbitrary first-order logic queries. The experiments show that Query2Particles achieves state-of-the-art performance on the complex query answering tasks on FB15k, FB15K-237, and NELL knowledge graphs.\",\n}\n```\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHKUST-KnowComp%2Fquery2particles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FHKUST-KnowComp%2Fquery2particles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHKUST-KnowComp%2Fquery2particles/lists"}