{ "info": { "author": "Ziheng Chen", "author_email": "zihengchen2015@u.northwestern.edu", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# Image Algorithm for General Purpose\n\n\nImage Algorithm is a clustering algorithm based [fast search and find of density peaks](http://science.sciencemag.org/content/344/6191/1492). \nComparing with other popular clustering methods, such as DBSCAN, one of the most prominent advantages of Image Algorithm is being highly parallelizable. This repository is an implementation of Image Algorithm for general purpose, supporting strong and easy GPU acceleration. \n\nFor now, the implementation includes three backends: numpy, CUDA and OpenCL.\n\n| backend | dependency | Support Platform | Support Device |\n| :---: | :---: | :---: | :---: |\n| [`numpy`](http://www.numpy.org) | None | Mac/Linux/Windows | CPU |\n| [`CUDA`](https://en.wikipedia.org/wiki/CUDA) | pycuda | Linux | Only NVIDIA GPU |\n| [`OpenCL`](https://en.wikipedia.org/wiki/OpenCL) | pyopencl | Mac | NVIDIA/AMD/Intel GPU, multi-core CPU |\n\nIt has been tested that all three backends give the identical clustering results. Therefore users can feel free to choose whichever faster and easier for their purposes. \n\n\nFor all three backends, two kinds of data structure can be taken in: Flat list and kdbin. KDBin, bins in k-dimention, accommodates points inside spatial bins in k-dimention with dynamic bin distribution and flexible bin capacity. Techniqually it uses hashmap and a set of memory references to obtain nearest neighboring bins and points inside, such that query of neighborhood for each point is O(1) complexity. Performance test shows a strong acceleration in density calculation using KDBin data structure.\n\n| supported data structure | `rho` Calculation | `rhorank` and `nh` Calculation |\n| :---: | :---: | :---: |\n| [`numpy`](http://www.numpy.org) | list/bin | list/bin |\n| [`CUDA`](https://en.wikipedia.org/wiki/CUDA) | list/bin | list |\n| [`OpenCL`](https://en.wikipedia.org/wiki/OpenCL) | list/bin | list |\n\nFor density rho calculation, performance tested is shown below.\n

\n\n\n\n\n\n\nTo do list\n\n* [ ] Calculate `rhorank` in CUDA/OpenCL via 'Merge Sorted List' for parallel sorting.\n* [ ] Support `nh` search in nearest neighboring bins in CUDA/OpenCL\n\n\n## Installation \n\n\n```bash\npip install ImageAlgoKD\n```\n\nRegarding dependency, no dependency is required for numpy backend. And it usually does a good job dealing with small dataset and needs no extra packages. However, for users wanting to use GPU acceleration with either CUDA or OpenCL backend, extra dependency is required. \n\n```bash\n# if want to use opencl backend\npip install pyopencl\n# if want to use CUDA backend\npip install pycuda\n```\n\n## Quick Start\nThe primary usage of the module is the following\nFirst of all, import ImageAlgo class for K-Dimension\n```python\nfrom ImageAlgoKD import *\n```\n\nDeclare an instance of ImageAlgoKD with your algorithm parameters. Then give it the input data points.\n```python\nia = ImageAlgoKD(MAXDISTANCE=20, KERNEL_R=1.0)\nia.setInputsPoints(Points(np.genfromtxt(\"../data/basic.csv\",delimiter=',')))\n```\n\nThen run the clustering over input data points.\n```python\nia.run(\"numpy\")\n# ia.run(\"opencl\") or ia.run(\"cuda\") if want run in parallel\n```\n\nIn the end, the clustering result can be access by\n```python\nia.points.clusterID\n```\n\n## Algorithm Parameters\n\n| Parameters | Comments | Default Value |\n|:------------------:|----------------------------------------------------------------|:-------------:|\n| MAXDISTANCE | the separation distance of the point with highest density. | 10.0 |\n| KERNEL_R | 'd_c' in density calculation | 1.0 |\n| KERNEL_R_NORM | 'd_0' in density calculation | 1.0 |\n| KERNEL_R_POWER | 'k' in density calculation. | 0.0 |\n| DECISION_RHO_KAPPA | the ratio of density threshold of seeds to the highest density | 4.0 |\n| DECISION_NHD | the separation threshold of seeds | 1.0 |\n| CONTINUITY_NHD | the separation threshold of continuous clusters | 1.0 |\n\nwhere density is defined as\n\n

\n\n## Examples\n\n### I. Basic\n\n

\n\nPerform IA clustering on 1000 toy 2D points, sampled from two Gaussian Distrituion and noise. The toy data is in `data/basic.csv`, while the corresponding jupyter notebook can be found [here](/example/example_basic.ipynb) in `examples/`.\n\n### II. MNIST\n

\n \n \n

\n\nPerform IA clustering on 1000 MNIST 28x28 dimension points. The MNIST data is in `data/mnist.csv`, while the corresponding jupyter notebook can be found [here](/example/example_mnist.ipynb) in `examples/`.\n\n### III. HGCal\n\n\n

\n\nThis is an event of 10 Pions with 300 GeV energy in CMS HGCal. A 3D interactive visualization can be found [here](https://plot.ly/~zihengchen/61/#/). In addition, for event with pile up, [here](https://plot.ly/%7Ezihengchen/18/#/) is an 300GeV pion with PU200 event. A PU200 event typically includes about 200k HGVCal reconstructed detector hits, which is input into IA clustering\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/ZihengChen/ImageAlgorithm", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "ImageAlgoKD", "package_url": "https://pypi.org/project/ImageAlgoKD/", "platform": "", "project_url": "https://pypi.org/project/ImageAlgoKD/", "project_urls": { "Homepage": "https://github.com/ZihengChen/ImageAlgorithm" }, "release_url": "https://pypi.org/project/ImageAlgoKD/0.0.4/", "requires_dist": null, "requires_python": "", "summary": "GPU implementation of clustering by fast search and find density peak.", "version": "0.0.4" }, "last_serial": 4941838, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "ca210abfc92f967ce4bb5b92bf0f412c", "sha256": "d56550dcd85df46e3cc5cb8503abb2c7aa4fcbd1cc16218b76e315764c222822" }, "downloads": -1, "filename": "ImageAlgoKD-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "ca210abfc92f967ce4bb5b92bf0f412c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9286, "upload_time": "2018-07-13T02:09:21", "url": "https://files.pythonhosted.org/packages/27/8f/59407f61d8c24a7f1744bd4f908b67d0417201d56bdf2aae999b690b0649/ImageAlgoKD-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "96ff87f62a1a9b150e620fa4035ed2b7", "sha256": "77e0fb4435ca1a78a5761f0ebef0aea2868574e2ab4d6a5bfc4be0cddde1b5d1" }, "downloads": -1, "filename": "ImageAlgoKD-0.0.1.tar.gz", "has_sig": false, "md5_digest": "96ff87f62a1a9b150e620fa4035ed2b7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7844, "upload_time": "2018-07-13T02:09:22", "url": "https://files.pythonhosted.org/packages/d8/43/ddc174e56b3f840e120cbed816212f5b002b987f079739685fb944d6370a/ImageAlgoKD-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "c5c311bd0726e1a06016e739ec14f9e6", "sha256": "753fc2319024603a9566b40f49c140f3216d5f8fc304a03d352f57e5a8e784d2" }, "downloads": -1, "filename": "ImageAlgoKD-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "c5c311bd0726e1a06016e739ec14f9e6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 12957, "upload_time": "2018-07-30T06:22:28", "url": "https://files.pythonhosted.org/packages/53/6c/05df9342f8a126421e39bf26fcc210d453a620e0e2764e4c1b29c1820cc2/ImageAlgoKD-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ab66c8a018df3a040abcff16efc2cff9", "sha256": "718d095a04c29f9d8201f275df763237386f9e4b1eb246727b68921c58dc6527" }, "downloads": -1, "filename": "ImageAlgoKD-0.0.2.tar.gz", "has_sig": false, "md5_digest": "ab66c8a018df3a040abcff16efc2cff9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12847, "upload_time": "2018-07-30T06:22:31", "url": "https://files.pythonhosted.org/packages/27/30/ca666e33b3888baf7f928f8f041bbfcabafcc3a113faeb778aa49674e85d/ImageAlgoKD-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "8fd2cf614f1fe711786866f815901b50", "sha256": "49a81b30d5d80566c10109c7078ee3f0f0054dedcdcc736a65d67e58cc50978f" }, "downloads": -1, "filename": "ImageAlgoKD-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "8fd2cf614f1fe711786866f815901b50", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 13167, "upload_time": "2018-07-30T15:12:35", "url": "https://files.pythonhosted.org/packages/c3/3f/a16a2567a47468ef0e6b61a1e854a7a844df8e4c3b388b87203317e54e41/ImageAlgoKD-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5be3ca0a67ee2672f23351a07d2f2d3b", "sha256": "8ea6571ddd408f61b800e2b3135dc2c96e615388eab49aaea07c24cd9032af08" }, "downloads": -1, "filename": "ImageAlgoKD-0.0.3.tar.gz", "has_sig": false, "md5_digest": "5be3ca0a67ee2672f23351a07d2f2d3b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13267, "upload_time": "2018-07-30T15:12:36", "url": "https://files.pythonhosted.org/packages/72/01/14ff2af37c89f3755990f9a1175fd2c9385cc3a33bc3832e20356b6d0253/ImageAlgoKD-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "efdb6b9131eba9311f07605795eeb5af", "sha256": "2c6fc1ce69af75f38845531723fa9e53493d74a82960e3ecc9403d805891c4c9" }, "downloads": -1, "filename": "ImageAlgoKD-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "efdb6b9131eba9311f07605795eeb5af", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 14033, "upload_time": "2019-03-14T22:12:28", "url": "https://files.pythonhosted.org/packages/d9/13/66d721b7ed480b67cf0d3228baec524643c5861e6f1359985f5d5d53d83c/ImageAlgoKD-0.0.4-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "efdb6b9131eba9311f07605795eeb5af", "sha256": "2c6fc1ce69af75f38845531723fa9e53493d74a82960e3ecc9403d805891c4c9" }, "downloads": -1, "filename": "ImageAlgoKD-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "efdb6b9131eba9311f07605795eeb5af", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 14033, "upload_time": "2019-03-14T22:12:28", "url": "https://files.pythonhosted.org/packages/d9/13/66d721b7ed480b67cf0d3228baec524643c5861e6f1359985f5d5d53d83c/ImageAlgoKD-0.0.4-py3-none-any.whl" } ] }