{ "info": { "author": "Louis Abraham", "author_email": "louis.abraham@yahoo.fr", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Science/Research", "Topic :: Scientific/Engineering" ], "description": "[![PyPI\nversion](https://badge.fury.io/py/tomaster.svg)](https://badge.fury.io/py/tomaster)\n[![Downloads](https://pepy.tech/badge/tomaster)](https://pepy.tech/project/tomaster)\n\n[![Build\nStatus](https://travis-ci.org/louisabraham/tomaster.svg?branch=master)](https://travis-ci.org/louisabraham/tomaster)\n\n# tomaster: Topological Mode Analysis on Steroids\n\n`tomaster` implements algorithms for topological mode analysis.\n\nThe code is simple to read because it is written in pure Python.\n\nThe performance is good thanks to jit compilation with\n[numba](https://numba.pydata.org/).\n\n# Usage\n\n``` pycon\n>>> from tomaster import tomato\n>>> from sklearn import datasets\n>>> X, y = datasets.make_moons(n_samples=1000, noise=0.05, random_state=1337)\n>>> clusters, _ = tomato(X, k=5, n_clusters=2)\n\n>>> import matplotlib.pyplot as plt\n>>> plt.scatter(*X.T, c=clusters)\n>>> plt.show()\n```\n\n![](https://raw.githubusercontent.com/louisabraham/tomaster/master/examples/moons.png)\n\n# Installation\n\n pip install tomaster\n\n# Testing\n\n pytest\n\n# API\n\n def tomato(\n points,\n *,\n k,\n tau=None,\n n_clusters=None,\n relative_tau: bool = True,\n keep_cluster_labels: bool = False,\n ):\n \"\"\"ToMATo clustering\n\n Parameters\n ----------\n\n points : np.ndarray\n Array of shape (n, dim)\n k : int\n Number of nearest neighbors to build the graph with\n tau : float or None\n Prominence threshold. Must not be specified if `n_clusters` is given.\n relative_tau : bool\n If `relative_tau` is set to `True`, `tau` will be multiplied by the standard deviation of the densities, making easier to have a unique value of `tau` for multiple datasets. \n n_clusters : int or None\n Target number of clusters. Must not be specified if `tau` is given.\n keep_cluster_labels : bool\n If False, converts the labels to make them contiguous and start from 0.\n\n Returns\n -------\n\n clusters : np.ndarray\n Array of shape (n,) containing the cluster indexes.\n tau : float\n Prominence threshold. Only present if `n_clusters` was given.\n\n \"\"\"\n\n def tomato_img(\n img: np.ndarray, *, spatial_weight: float = 0, lab_space: bool = True, **kwargs\n ):\n \"\"\"ToMATo for images\n\n Parameters\n ----------\n\n img : np.ndarray\n Image of shape (h, w) or (h, w, 3)\n spatial_weight : float\n Importance of the pixel positions in the distance function\n lab_space : bool\n If True, converts color images to the CIE L*a*b color space ()\n\n see tomato() for other arguments.\n\n Returns\n -------\n\n clusters : np.ndarray\n Array of shape (h, w) containing the cluster indexes.\n \"\"\"\n\n# References\n\n - Chazal, Fr\u00e9d\u00e9ric, Leonidas J. Guibas, Steve Y. Oudot, and Primoz\n Skraba. \"Persistence-based clustering in riemannian manifolds.\"\n Journal of the ACM (JACM) 60, no. 6 (2013): 41.\n [\\[pdf\\]](https://geometrica.saclay.inria.fr/data/Steve.Oudot/clustering/jacm_oudot.pdf)\n\n - Reference implementations:\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/louisabraham/tomaster", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "tomaster", "package_url": "https://pypi.org/project/tomaster/", "platform": "", "project_url": "https://pypi.org/project/tomaster/", "project_urls": { "Homepage": "https://github.com/louisabraham/tomaster" }, "release_url": "https://pypi.org/project/tomaster/0.0.1/", "requires_dist": [ "numpy", "numba", "scikit-learn", "scikit-image" ], "requires_python": "", "summary": "Topological Mode Analysis on Steroids", "version": "0.0.1" }, "last_serial": 5930068, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "0e74b4a79b25ff025efface75236a1f7", "sha256": "55eb1abe45ecdc61af3541e504d8b777e1c94a8ae5ca7286cfc504e95645af03" }, "downloads": -1, "filename": "tomaster-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "0e74b4a79b25ff025efface75236a1f7", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5126, "upload_time": "2019-10-04T20:32:21", "url": "https://files.pythonhosted.org/packages/0f/f4/cbd3a550583b8acd7e13cf660b55e9b93a7faaed390000cc613a1cff5cd5/tomaster-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "61a0a553d92fd48601d6708ce58ac617", "sha256": "1205533476684dfa5eb6a8edc2086775a20cb98890f599907eefcfa0df6261ef" }, "downloads": -1, "filename": "tomaster-0.0.1.tar.gz", "has_sig": false, "md5_digest": "61a0a553d92fd48601d6708ce58ac617", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4379, "upload_time": "2019-10-04T20:32:23", "url": "https://files.pythonhosted.org/packages/58/b4/61e9f1196d2f3ed945563ae142386a6d53f8ef6198a391f4b9a46c48c3e3/tomaster-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0e74b4a79b25ff025efface75236a1f7", "sha256": "55eb1abe45ecdc61af3541e504d8b777e1c94a8ae5ca7286cfc504e95645af03" }, "downloads": -1, "filename": "tomaster-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "0e74b4a79b25ff025efface75236a1f7", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5126, "upload_time": "2019-10-04T20:32:21", "url": "https://files.pythonhosted.org/packages/0f/f4/cbd3a550583b8acd7e13cf660b55e9b93a7faaed390000cc613a1cff5cd5/tomaster-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "61a0a553d92fd48601d6708ce58ac617", "sha256": "1205533476684dfa5eb6a8edc2086775a20cb98890f599907eefcfa0df6261ef" }, "downloads": -1, "filename": "tomaster-0.0.1.tar.gz", "has_sig": false, "md5_digest": "61a0a553d92fd48601d6708ce58ac617", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4379, "upload_time": "2019-10-04T20:32:23", "url": "https://files.pythonhosted.org/packages/58/b4/61e9f1196d2f3ed945563ae142386a6d53f8ef6198a391f4b9a46c48c3e3/tomaster-0.0.1.tar.gz" } ] }