{ "info": { "author": "Stiene Praet", "author_email": "stiene.praet@uantwerp.be", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# SW-transformation\nThe SW-transformation is a fast classifier for binary node classification in bipartite graphs ([Stankova et al., 2015](\nhttps://hdl.handle.net/10067/1274850151162165141)). Bipartite graphs (or bigraphs), are defined by having two types of nodes such that edges only exist between nodes of the different type (see Fig. 1). \n\n![title](https://github.com/SPraet/SW-transformation/blob/master/Bigraph.PNG)\n\n**Fig. 1: Bigraph, top node projection and bottom node projection (left), adjacency matrix representation of the bigraph (right)** (Stankova et al., 2015, p. 8).\n\nThe SW-transformation combines the weighted-vote Relational Neighbor (wvRN) classifier with an aggregation function that sums the weights of the top nodes. The transformation optimally considers for each test instance only the weights of the neighboring top nodes multiplied by the number of training instances in that column which have a positive label (the positive neighbors of the node). The SW-transformation yields very fast run times and allows easy scaling of the method to big data sets of millions of nodes (Stankova et al., 2015).\n\n## Installation\nRequirements: numpy\n```\npip install numpy\n```\nTo build and install on your local machine, download and unzip the repository and run from there:\n\n```\npython setup.py install\n```\n\nOr you can automatically download and install from the PyPI repository:\n\n```\npip install SW-transformation\n```\n## Usage\nThe SW transformation can be used to calculate the probability of a node in a bipartite graph to belong to the positive class. Three top node weight functions are included: simple weight assignment, inverse degree and hyperbolic tangent. Users can also directly insert the top node weights, using their own weight function.\n\n**SW-transformation**(weight_function='tanh', weights=None)\n\n### Parameters\n* weight_function : 'tanh', 'inverse', 'simple' or 'own' (default='tanh'). \n For 'own', the top node weights should be provided in weights\n* weights : array-like, shape (1, n_top_nodes). Vector containing the top\n node weights, where n_top_nodes is the number of top nodes. When \n weight_function is set at 'own', the top node weights should be \n provided here. \n\n### Examples\n```\nfrom sklearn.model_selection import GridSearchCV\nimport numpy as np\nimport SW\n\nX = load_adjacency_matrix_here #sparse matrix\ny = load_node_labels_here\n\ncustom = lambda X: np.ones((X.shape[1],)) # define custom weight function\n\nsw = SW.SW_transformation()\nparameters = {'weight_function':('tanh','inverse','simple',custom)}\nclf = GridSearchCV(sw, parameters, cv=5, scoring = 'roc_auc', verbose=3)\nclf.fit(X,y)\n```\n### Methods\n* fit(X, y) - Fit the model according to the given training data.\n* predict_proba(X) - Probability estimates.\n\nX: sparse matrix, shape(n_bottom_nodes, n_top_nodes): the adjacency matrix (see Fig. 1, right)\n\ny: array_like, shape(n_bottom_nodes, 1): the binary class labels (0 for negative and 1 for positive instance)\n\n## Authors and contributors\n\nStiene Praet \n\n[ddvlamin](https://github.com/ddvlamin)\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](https://github.com/SPraet/SW-transformation/blob/master/LICENSE) file for details\n\n\n## Acknowledgements\nBased on the work of Marija Stankova, David Martens and Foster Provost\n\n## References\nStankova, M., Martens, D., & Provost, F. (2015). Classification over bipartite graphs through projection. (Research paper / University of Antwerp. Faculty of Applied Economics ; 2015-001 D/2015/1169/001). Full text (open access): https://repository.uantwerpen.be/docman/irua/07acff/c5909d64.pdf\n\n\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/SPraet/SW-transformation", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "SW-transformation", "package_url": "https://pypi.org/project/SW-transformation/", "platform": "", "project_url": "https://pypi.org/project/SW-transformation/", "project_urls": { "Homepage": "https://github.com/SPraet/SW-transformation" }, "release_url": "https://pypi.org/project/SW-transformation/0.0.2/", "requires_dist": null, "requires_python": "", "summary": "A fast classifier for binary node classification in bipartite graphs", "version": "0.0.2" }, "last_serial": 4835992, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "a2c6644857abae6a24e7783ec7660ba8", "sha256": "dc6868141331538bd52b076800972cd023305083e5eab77b460340f464e36a81" }, "downloads": -1, "filename": "SW_transformation-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "a2c6644857abae6a24e7783ec7660ba8", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5080, "upload_time": "2019-02-08T17:06:05", "url": "https://files.pythonhosted.org/packages/6d/1f/36ea8474aeb9be9387102afce05e5ce449d52309195beca61a71cc75457a/SW_transformation-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "760b2596261fe95e33949195efdc9ffc", "sha256": "957852e1ccd205af121a0058e81111a4a270c991e8a098b8a51a3c24929708d9" }, "downloads": -1, "filename": "SW-transformation-0.0.1.tar.gz", "has_sig": false, "md5_digest": "760b2596261fe95e33949195efdc9ffc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3607, "upload_time": "2019-02-08T17:06:07", "url": "https://files.pythonhosted.org/packages/02/44/2189518c7f43a79bd5cf80afd9ad3cb4115c840c75fc0022b25c060ecc25/SW-transformation-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "e67d208d8f62252738acfadb84a006c2", "sha256": "f26f8454fc785f1805713da4891e32ac316e8358f781c5f3b1b31581fed490c6" }, "downloads": -1, "filename": "SW_transformation-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "e67d208d8f62252738acfadb84a006c2", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5500, "upload_time": "2019-02-18T16:34:13", "url": "https://files.pythonhosted.org/packages/37/3f/3b3ddb57cc51426ebc43b673d20bfd48a50b5dae59e5474792a58c950981/SW_transformation-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "45e0dd88af596a5649cf918d3cd8bebb", "sha256": "5b3e4516b6c7e94c4dbce9630bb9f172b32371fd652723e40ada2b2619bc4028" }, "downloads": -1, "filename": "SW-transformation-0.0.2.tar.gz", "has_sig": false, "md5_digest": "45e0dd88af596a5649cf918d3cd8bebb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4003, "upload_time": "2019-02-18T16:34:15", "url": "https://files.pythonhosted.org/packages/5e/bd/293752f7ba9135208dea4225ce7b675d593ae4688edbe045f8a8687e8f13/SW-transformation-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e67d208d8f62252738acfadb84a006c2", "sha256": "f26f8454fc785f1805713da4891e32ac316e8358f781c5f3b1b31581fed490c6" }, "downloads": -1, "filename": "SW_transformation-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "e67d208d8f62252738acfadb84a006c2", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5500, "upload_time": "2019-02-18T16:34:13", "url": "https://files.pythonhosted.org/packages/37/3f/3b3ddb57cc51426ebc43b673d20bfd48a50b5dae59e5474792a58c950981/SW_transformation-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "45e0dd88af596a5649cf918d3cd8bebb", "sha256": "5b3e4516b6c7e94c4dbce9630bb9f172b32371fd652723e40ada2b2619bc4028" }, "downloads": -1, "filename": "SW-transformation-0.0.2.tar.gz", "has_sig": false, "md5_digest": "45e0dd88af596a5649cf918d3cd8bebb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4003, "upload_time": "2019-02-18T16:34:15", "url": "https://files.pythonhosted.org/packages/5e/bd/293752f7ba9135208dea4225ce7b675d593ae4688edbe045f8a8687e8f13/SW-transformation-0.0.2.tar.gz" } ] }