{ "info": { "author": "Allan Inocencio de Souza Costa", "author_email": "allan@cloudwalk.io", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.3", "Topic :: Scientific/Engineering :: Artificial Intelligence" ], "description": "Discrete DBSCAN\n===============\n\n.. image:: https://travis-ci.org/cloudwalkio/ddbscan.svg?branch=master\n :target: https://travis-ci.org/cloudwalkio/ddbscan\n\n.. image:: https://img.shields.io/coveralls/cloudwalkio/ddbscan/master.svg\n :target: https://coveralls.io/r/cloudwalkio/ddbscan?branch=master\n\n.. image:: https://landscape.io/github/cloudwalkio/ddbscan/master/landscape.png\n :target: https://landscape.io/github/cloudwalkio/ddbscan\n :alt: Landscape quality score\n\n.. image:: https://img.shields.io/pypi/v/ddbscan.svg\n :target: https://pypi.python.org/pypi/ddbscan/\n :alt: Latest Version\n\n.. image:: https://pypip.in/py_versions/ddbscan/badge.svg\n :target: https://pypi.python.org/pypi/ddbscan/\n :alt: Supported Python versions\n\n.. image:: https://img.shields.io/pypi/dm/ddbscan.svg\n :target: https://pypi.python.org/pypi/ddbscan/\n :alt: Downloads on PyPI\n\n.. image:: https://img.shields.io/pypi/l/ddbscan.svg\n :target: https://pypi.python.org/pypi/ddbscan/\n :alt: License\n\n|\n\nThis is a version of `DBSCAN`_ clustering algorithm optimized for discrete,\nbounded data, reason why we call it Discrete DBSCAN (DDBSCAN). The base for\nthe current implementation is from `this source`_. The algorithm code is in\nfile ``ddbscan/ddbscan.py`` and can easily be read. The main algorithm itself\nis in method ``compute()``, and can be understood following the links above\nor reading papers describing it.\n\nAnother feature of this implementation is that it is designed towards online\nlearning. As a result, when we add points to our DDBSCAN object, we must pass\none point each time to method ``add_point``. See usage below.\n\nOptimization for discrete and bounded data\n------------------------------------------\n\nOur main optimization to the vanilla algorithm described in the links above is\nbased on the fact that for discrete and bounded data, we expect to see many\ntimes the same point occurring, so we can keep track of how many times the\npoint ocurred and optimize our algorithm to use that information.\n\nTo speed up insertions of new points and computation of clusters, each DDBSCAN\nobject keeps, for each point, the index of its neighbours and the neighbourhood\nsize (the sum of the counts of the neighbours points). So, when we insert a new\npoint, we see if it is an already existing pair and just increment its counter\nand the neighbourhood size of its neighbours. We recompute a KDTree with the\npoints in case a new pair is inserted, updating the point data for its\nneighbours.\n\nParameters\n----------\n\nA DBSCAN model has two parameters:\n\n- ``min_pts``: minimum amount of neighbours of a point to create a cluster.\n- ``eps`` : radius to look for neighbours.\n\nBy tunning the two parameters we are, in fact, setting the anomaly (outlier)\ndetection sensitiveness. A greater value for ``min_pts`` implies that to\nrecognize a new pattern as a cluster, instead of an anomaly, we must see a\nlarger amount of points with that pattern. A greater value for ``eps`` implies\nbigger clusters can form easier, so that points in less dense areas can be\nrecognized as clusters members given this large ``eps``. Given the importance\nof tunning this parameters, we have a method to set them, called\n``set_params()``, which updates the internal state of the model accordingly.\n\nInstall\n-------\n\nTo just install the package the easist way is to use pip:\n\n.. code-block:: console\n\n $ pip install ddbscan\n\nAnother option is to clone this repo and run\n\n.. code-block:: console\n\n $ python setup.py install\n\nTo run the tests:\n\n.. code-block:: console\n\n $ python setup.py test\n\n\nUsage\n-----\n\nA typical example would be as following:\n\n.. code-block:: python\n\n import ddbscan\n\n # Create a DDBSCAN model with eps = 2 and min_pts = 5\n scan = ddbscan.DDBSCAN(2, 5)\n\n # Add points to model\n data = [[1, 2], [2, 2], [1, 3], [2, 3], [3, 3], [8, 9],\n [7, 6], [9, 7], [6, 9], [6, 8], [5, 5], [7, 8]]\n\n for point in data:\n scan.add_point(point=point, count=1, desc=\"\")\n\n # Compute clusters\n scan.compute()\n\n print 'Clusters found and its members points index:'\n cluster_number = 0\n for cluster in scan.clusters:\n print '=== Cluster %d ===' % cluster_number\n print 'Cluster points index: %s' % list(cluster)\n cluster_number += 1\n\n print '\\nCluster assigned to each point:'\n for i in xrange(len(scan.points)):\n print '=== Point: %s ===' % scan.points[i]\n print 'Cluster: %2d' % scan.points_data[i].cluster,\n # If a point cluster is -1, it's an anomaly\n if scan.points_data[i].cluster == -1:\n print '\\t <== Anomaly found!'\n else:\n print\n\n\n\nLicense\n-------\n\n::\n\n The MIT License (MIT)\n\n Copyright (c) 2014 CloudWalk, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n\n.. _DBSCAN: http://en.wikipedia.org/wiki/DBSCAN\n.. _this source: http://cjauvin.blogspot.com.br/2014/06/dbscan-blues.html", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/cloudwalkio/ddbscan", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "ddbscan", "package_url": "https://pypi.org/project/ddbscan/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/ddbscan/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/cloudwalkio/ddbscan" }, "release_url": "https://pypi.org/project/ddbscan/0.3.0/", "requires_dist": null, "requires_python": null, "summary": "Discrete DBSCAN algorithm optimized for discrete and bounded data.", "version": "0.3.0" }, "last_serial": 1284739, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "257f4fed9a0e37a8e2df8cc0bec8dc29", "sha256": "0a4d6ba2f8f0786c072c9ded13ee75cd05d2630ef9ab3b319a9ef1335a478d4e" }, "downloads": -1, "filename": "ddbscan-0.1.0.tar.gz", "has_sig": false, "md5_digest": "257f4fed9a0e37a8e2df8cc0bec8dc29", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5036, "upload_time": "2014-09-05T19:11:16", "url": "https://files.pythonhosted.org/packages/65/61/ab62372eacb0859d527df45e062ec5f8a6455787a360a1757d2c97046c9e/ddbscan-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "75fc601c1087e034d9d12d1864f95d61", "sha256": "e09d5631f06a50003a9843789925ef840117e4a4f454541bb265dca18e9abaa8" }, "downloads": -1, "filename": "ddbscan-0.2.0.tar.gz", "has_sig": false, "md5_digest": "75fc601c1087e034d9d12d1864f95d61", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5400, "upload_time": "2014-09-05T19:31:47", "url": "https://files.pythonhosted.org/packages/a9/e8/a0d9a1bf93f1cd4fc6d5115b904863e6efc614f42a1bb191cb12ae9ff823/ddbscan-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "5085a7dcc2910c881ddd33f8fbd3e184", "sha256": "477a87786409ec7086b376ee7b08f7143ec537e82eb4734a8b69ee381afaefa1" }, "downloads": -1, "filename": "ddbscan-0.2.1.tar.gz", "has_sig": false, "md5_digest": "5085a7dcc2910c881ddd33f8fbd3e184", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5506, "upload_time": "2014-09-05T20:28:20", "url": "https://files.pythonhosted.org/packages/72/35/b2fed378c86a160ba34e001f27e05746eb698cee711cf37ba9e2eee032df/ddbscan-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "5cdf71f0d3f714f071e836e9f8ab6768", "sha256": "37d091e02d2ad055240f234636921f09ecf47712bc38c48b37a1b308e9abf798" }, "downloads": -1, "filename": "ddbscan-0.2.2.tar.gz", "has_sig": false, "md5_digest": "5cdf71f0d3f714f071e836e9f8ab6768", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5858, "upload_time": "2014-09-12T14:55:20", "url": "https://files.pythonhosted.org/packages/07/bc/9c27d007908e4e940f0dffe2e3968f7adaddb7e877bf138dc06137ec9270/ddbscan-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "a6af05fcfc2568da02d4b4d205702612", "sha256": "524090507cc57dc7c1b5d1f433b01b6791e4ba63c701ef01435452f01025f2d3" }, "downloads": -1, "filename": "ddbscan-0.2.3.tar.gz", "has_sig": false, "md5_digest": "a6af05fcfc2568da02d4b4d205702612", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5703, "upload_time": "2014-10-21T12:31:26", "url": "https://files.pythonhosted.org/packages/56/3c/45bc08bef4804e12dcf20e2c5dcf74213a99530400a003d501c05c2722aa/ddbscan-0.2.3.tar.gz" } ], "0.2.4": [ { "comment_text": "", "digests": { "md5": "5783b62df4082e83e14a43588e780cfb", "sha256": "36e34af5d449b510f44c6f4cae9901a2aa10cba34bd176259290ae6f4525b682" }, "downloads": -1, "filename": "ddbscan-0.2.4.tar.gz", "has_sig": false, "md5_digest": "5783b62df4082e83e14a43588e780cfb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5697, "upload_time": "2014-10-21T12:36:54", "url": "https://files.pythonhosted.org/packages/83/7b/2d9859b06b6e596b146d61e92864d798f1663f19ead74ed3bfb75db855b7/ddbscan-0.2.4.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "5a994c7f4f440f5ad71a7084490cea14", "sha256": "a9f1878ffe1d0699ffa1cc442054784c96a4671593a08ed47a5090ac93ad5c2c" }, "downloads": -1, "filename": "ddbscan-0.3.0.tar.gz", "has_sig": false, "md5_digest": "5a994c7f4f440f5ad71a7084490cea14", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5778, "upload_time": "2014-10-27T19:20:37", "url": "https://files.pythonhosted.org/packages/c1/d5/fea87ff9e2307f06867c4670651df25f4c8b47e979303d75d31e88d691b3/ddbscan-0.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5a994c7f4f440f5ad71a7084490cea14", "sha256": "a9f1878ffe1d0699ffa1cc442054784c96a4671593a08ed47a5090ac93ad5c2c" }, "downloads": -1, "filename": "ddbscan-0.3.0.tar.gz", "has_sig": false, "md5_digest": "5a994c7f4f440f5ad71a7084490cea14", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5778, "upload_time": "2014-10-27T19:20:37", "url": "https://files.pythonhosted.org/packages/c1/d5/fea87ff9e2307f06867c4670651df25f4c8b47e979303d75d31e88d691b3/ddbscan-0.3.0.tar.gz" } ] }