{"id":13958315,"url":"https://github.com/hwwang55/DKN","last_synced_at":"2025-07-20T23:31:01.554Z","repository":{"id":62137368,"uuid":"141019701","full_name":"hwwang55/DKN","owner":"hwwang55","description":"A tensorflow implementation of DKN (Deep Knowledge-aware Network for News Recommendation)","archived":false,"fork":false,"pushed_at":"2023-05-25T04:23:43.000Z","size":34407,"stargazers_count":407,"open_issues_count":20,"forks_count":137,"subscribers_count":16,"default_branch":"master","last_synced_at":"2024-08-09T13:18:35.717Z","etag":null,"topics":["knowledge-graph","recommender-systems"],"latest_commit_sha":null,"homepage":"","language":"C++","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/hwwang55.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}},"created_at":"2018-07-15T10:54:07.000Z","updated_at":"2024-07-31T10:05:17.000Z","dependencies_parsed_at":"2022-10-27T03:45:15.950Z","dependency_job_id":"65c001d9-1de1-40bb-8c72-cd32f11d1f4f","html_url":"https://github.com/hwwang55/DKN","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/hwwang55%2FDKN","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hwwang55%2FDKN/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hwwang55%2FDKN/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hwwang55%2FDKN/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hwwang55","download_url":"https://codeload.github.com/hwwang55/DKN/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226844973,"owners_count":17691137,"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":["knowledge-graph","recommender-systems"],"created_at":"2024-08-08T13:01:29.383Z","updated_at":"2024-11-28T01:31:40.797Z","avatar_url":"https://github.com/hwwang55.png","language":"C++","funding_links":[],"categories":["其他_推荐系统"],"sub_categories":["网络服务_其他"],"readme":"# DKN\n\nThis repository is the implementation of [DKN](https://dl.acm.org/citation.cfm?id=3186175) ([arXiv](https://arxiv.org/abs/1801.08284)):\n\u003e DKN: Deep Knowledge-Aware Network for News Recommendation  \nHongwei Wang, Fuzheng Zhang, Xing Xie, Minyi Guo  \nThe Web Conference 2018 (WWW 2018)\n\n![](https://github.com/hwwang55/DKN/blob/master/framework.jpg)\n\nDKN is a deep knowledge-aware network that takes advantage of knowledge graph representation in news recommendation.\nThe main components in DKN is a KCNN module and an attention module:\n- The KCNN module is to learn from semantic-level and knowledge-level representations of news jointly.\nThe multiple channels and alignment of words and entities enable KCNN to combine information from heterogeneous sources.\n- The attention module is to model the different impacts of a user’s diverse historical interests on current candidate news.\n\n\n### Files in the folder\n\n- `data/`\n  - `kg/`\n    - `Fast-TransX`: an efficient implementation of TransE and its extended models for Knowledge Graph Embedding (from https://github.com/thunlp/Fast-TransX);\n    - `kg.txt`: knowledge graph file;\n    - `kg_preprocess.py`: pre-process the knowledge graph and output knowledge embedding files for DKN;\n    - `prepare_data_for_transx.py`: generate the required input files for Fast-TransX;\n  - `news/`\n    - `news_preprocess.py`: pre-process the news dataset;\n    - `raw_test.txt`: raw test data file;\n    - `raw_train.txt`: raw train data file;\n- `src/`: implementations of DKN.\n\n\u003e Note: Due to the pricacy policies of Bing News and file size limits on Github, the released raw dataset and the knowledge graph in this repository is only a small sample of the original ones reported in the paper.\n\n\n### Format of input files\n- **raw_train.txt** and **raw_test.txt**:  \n  `user_id[TAB]news_title[TAB]label[TAB]entity_info`  \n  for each line, where `news_title` is a list of words `w1 w2 ... wn`, and `entity_info` is a list of pairs of entity id and entity name: `entity_id_1:entity_name;entity_id_2:entity_name...`\n- **kg.txt**:  \n  `head[TAB]relation[TAB]tail`  \n  for each line, where `head` and `tail` are entity ids and `relation` is the relation id.\n\n\n### Required packages\nThe code has been tested running under Python 3.6.5, with the following packages installed (along with their dependencies):\n- tensorflow-gpu == 1.4.0\n- numpy == 1.14.5\n- sklearn == 0.19.1\n- pandas == 0.23.0\n- gensim == 3.5.0\n\n\n### Running the code\n```\n$ cd data/news\n$ python news_preprocess.py\n$ cd ../kg\n$ python prepare_data_for_transx.py\n$ cd Fast-TransX/transE/ (note: you can also choose other KGE methods)\n$ g++ transE.cpp -o transE -pthread -O3 -march=native\n$ ./transE\n$ cd ../..\n$ python kg_preprocess.py\n$ cd ../../src\n$ python main.py (note: use -h to check optional arguments)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhwwang55%2FDKN","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhwwang55%2FDKN","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhwwang55%2FDKN/lists"}