{"id":13628402,"url":"https://github.com/benedekrozemberczki/BANE","last_synced_at":"2025-04-17T04:31:45.215Z","repository":{"id":102016307,"uuid":"157595045","full_name":"benedekrozemberczki/BANE","owner":"benedekrozemberczki","description":"A sparsity aware implementation of \"Binarized Attributed Network Embedding\" (ICDM 2018).","archived":false,"fork":false,"pushed_at":"2023-03-18T12:09:06.000Z","size":816,"stargazers_count":87,"open_issues_count":1,"forks_count":17,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-11T15:15:23.081Z","etag":null,"topics":["bane","deepwalk","diff2vec","dimensionality-reduction","embedding","factorization","fscnmf","gemsec","graph","graph2vec","icdm","lane","line","musae","node","node2vec","svd","tadw","tridnr","word2vec"],"latest_commit_sha":null,"homepage":"https://karateclub.readthedocs.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/benedekrozemberczki.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["benedekrozemberczki"]}},"created_at":"2018-11-14T18:47:37.000Z","updated_at":"2024-12-15T08:13:20.000Z","dependencies_parsed_at":"2023-10-27T18:30:14.148Z","dependency_job_id":null,"html_url":"https://github.com/benedekrozemberczki/BANE","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benedekrozemberczki%2FBANE","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benedekrozemberczki%2FBANE/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benedekrozemberczki%2FBANE/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benedekrozemberczki%2FBANE/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benedekrozemberczki","download_url":"https://codeload.github.com/benedekrozemberczki/BANE/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249315935,"owners_count":21249860,"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":["bane","deepwalk","diff2vec","dimensionality-reduction","embedding","factorization","fscnmf","gemsec","graph","graph2vec","icdm","lane","line","musae","node","node2vec","svd","tadw","tridnr","word2vec"],"created_at":"2024-08-01T22:00:51.394Z","updated_at":"2025-04-17T04:31:44.579Z","avatar_url":"https://github.com/benedekrozemberczki.png","language":"Python","funding_links":["https://github.com/sponsors/benedekrozemberczki"],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"BANE \n=====\n[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/binarized-attributed-network-embedding/link-prediction-on-cora)](https://paperswithcode.com/sota/link-prediction-on-cora?p=binarized-attributed-network-embedding) [![codebeat badge](https://codebeat.co/badges/3728636b-e766-429e-a453-4c4349e56d57)](https://codebeat.co/projects/github-com-benedekrozemberczki-bane-master) [![repo size](https://img.shields.io/github/repo-size/benedekrozemberczki/BANE.svg)](https://github.com/benedekrozemberczki/BANE/archive/master.zip) [![benedekrozemberczki](https://img.shields.io/twitter/follow/benrozemberczki?style=social\u0026logo=twitter)](https://twitter.com/intent/follow?screen_name=benrozemberczki)\n\n\u003cp align=\"justify\"\u003e\nAn implementation of \"Binarized Attributed Network Embedding\". Attributed network embedding enables joint representation learning of node links and attributes. Existing attributed network embedding models are designed in continuous Euclidean spaces which often introduce data redundancy and impose challenges to storage and computation costs. To this end, we present a Binarized Attributed Network Embedding model (BANE for short) to learn binary node representation. Specifically, we define a new Weisfeiler-Lehman proximity matrix to capture data dependence between node links and attributes by aggregating the information of node attributes and links from neighboring nodes to a given target node in a layer-wise manner. Based on the Weisfeiler-Lehman proximity matrix, we formulate a new Weisfiler-Lehman matrix factorization learning function under the binary node representation constraint. The learning problem is a mixed integer optimization and an efficient cyclic coordinate descent (CCD) algorithm is used as the solution. Node classification and link prediction experiments on real-world datasets show that the proposed BANE model outperforms the state-of-the-art network embedding methods.\n\u003c/p\u003e\n\u003cdiv style=\"text-align:center\"\u003e\u003cimg src =\"bane.jpeg\" ,width=720/\u003e\u003c/div\u003e\n\nThe model is now also available in the package [Karate Club](https://github.com/benedekrozemberczki/karateclub).\n\n-------------------------------\n\nThis repository provides an implementation for **BANE** as described in the paper:\n\n\u003e **Binarized Attributed Network Embedding**\n\u003e YHong Yang, Shirui Pan, Peng Zhang, Ling Chen, Defu Lian, and Chengqi Zhang.\n\u003e ICDM, 2018.\n\u003e [[Paper]](https://www.researchgate.net/publication/328688614_Binarized_Attributed_Network_Embedding)\n\nThe reference dense MatLab implementation is available [[here]](https://github.com/ICDM2018-BANE/BANE).\n\n### Requirements\n\nThe codebase is implemented in Python 3.5.2. package versions used for development are just below.\n```\nnetworkx          2.4\ntqdm              4.28.1\nnumpy             1.15.4\npandas            0.23.4\ntexttable         1.5.0\nscipy             1.1.0\nargparse          1.1.0\nsklearn           0.20.0\n```\n### Datasets\n\u003cp align=\"justify\"\u003e\nThe code takes an input graph in a csv file. Every row indicates an edge between two nodes separated by a comma. The first row is a header. Nodes should be indexed starting with 0. Sample graphs for the `Twitch Brasilians` ,`Wikipedia Chameleons` and `Wikipedia Giraffes` are included in the  `input/` directory. \u003c/p\u003e\n\nThe feature matrix can be stored two ways:\n\u003cp align=\"justify\"\u003e\nIf the feature matrix is a **sparse binary** one it is stored as a json. Nodes are keys of the json and features are the values. For each node feature column ids are stored as elements of a list. The feature matrix is structured as:\u003c/p\u003e\n\n```javascript\n{ 0: [0, 1, 38, 1968, 2000, 52727],\n  1: [10000, 20, 3],\n  2: [],\n  ...\n  n: [2018, 10000]}\n```\n\u003cp align=\"justify\"\u003e\nIf the feature matrix is **dense** it is assumed that it is stored as csv with comma separators. It has a header, the first column contains node identifiers and it is sorted by these identifers. It should look like this:\u003c/p\u003e\n\n| **NODE ID**| **Feature 1** | **Feature 2** | **Feature 3** | **Feature 4** |\n| --- | --- | --- | --- |--- |\n| 0 | 3 |0 |1.37 |1 |\n| 1 | 1 |1 |2.54 |-11 |\n| 2 | 2 |0 |1.08 |-12 |\n| 3 | 1 |1 |1.22 |-4 |\n| ... | ... |... |... |... |\n| n | 5 |0 |2.47 |21 |\n\n\n### Options\n\u003cp align=\"justify\"\u003e\nLearning of the embedding is handled by the `src/main.py` script which provides the following command line arguments.\u003c/p\u003e\n\n#### Input and output options\n\n```\n  --edge-path    STR     Input graph path.           Default is `input/ptbr_edges.csv`.\n  --feature-path STR     Input Features path.        Default is `input/ptbr_features.json`.\n  --output-path  STR     Embedding path.             Default is `output/ptbr_bane.csv`.\n```\n\n#### Model options\n\n```\n  --features               STR         Structure of the feature matrix.       Default is `sparse`. \n  --dimensions             INT         Number of embeding dimensions.         Default is 48.\n  --order                  INT         Order of adjacency matrix powers.      Default is 1.\n  --binarization-rounds    INT         Number of power interations.           Default is 10.\n  --approximation-rounds   INT         Number of CDC interations.             Default is 5.\n  --alpha                  FLOAT       Regularization parameter.              Default is 0.7.\n  --gamma                  FLOAT       Weisfeiler-Lehman mixing parameter.    Default is 0.1.  \n```\n\n### Examples\n\u003cp align=\"justify\"\u003e\nThe following commands learn a graph embedding and write the embedding to disk. The node representations are ordered by the ID.\u003c/p\u003e\n\u003cp align=\"justify\"\u003e\nCreating a BANE embedding of the default dataset with the default hyperparameter settings. Saving the embedding at the default path.\u003c/p\u003e\n\n```sh\n$ python src/main.py\n```\nCreating a BANE embedding of the default dataset with 128 dimensions and approximation order 1.\n\n```sh\n$ python src/main.py --dimensions 128 --order 1\n```\n\nCreating a BANE embedding of the default dataset with asymmetric mixing.\n\n```sh\n$ python src/main.py --gamma 0.1\n```\n\nCreating an embedding of an other dense structured dataset the `Wikipedia Giraffes`. Saving the output in a custom folder.\n\n```sh\n$ python src/main.py --edge-path input/giraffe_edges.csv --feature-path input/giraffe_features.csv --output-path output/giraffe_bane.csv --features dense\n```\n--------------------------------------------------------\n\n**License**\n\n- [GNU License](https://github.com/benedekrozemberczki/BANE/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenedekrozemberczki%2FBANE","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenedekrozemberczki%2FBANE","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenedekrozemberczki%2FBANE/lists"}