{"id":17465037,"url":"https://github.com/erdogant/flameplot","last_synced_at":"2025-04-19T20:14:08.723Z","repository":{"id":40761927,"uuid":"234703853","full_name":"erdogant/flameplot","owner":"erdogant","description":"flameplot is a python package for the quantification of local similarity across two maps or embeddings.","archived":false,"fork":false,"pushed_at":"2025-03-02T22:39:44.000Z","size":6480,"stargazers_count":8,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-12T01:12:01.332Z","etag":null,"topics":["dimensionality-reduction","embeddings","high-dimensional","pca","python","quantification","tsne","umap"],"latest_commit_sha":null,"homepage":"https://github.com/erdogant/flameplot","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/erdogant.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":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["erdogant"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2020-01-18T08:23:26.000Z","updated_at":"2025-03-02T22:39:48.000Z","dependencies_parsed_at":"2025-04-12T15:01:00.444Z","dependency_job_id":null,"html_url":"https://github.com/erdogant/flameplot","commit_stats":{"total_commits":96,"total_committers":2,"mean_commits":48.0,"dds":"0.47916666666666663","last_synced_commit":"2cc1144db2d61511d5e1c8b13d2df2ce28b493b5"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erdogant%2Fflameplot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erdogant%2Fflameplot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erdogant%2Fflameplot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erdogant%2Fflameplot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erdogant","download_url":"https://codeload.github.com/erdogant/flameplot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249789158,"owners_count":21325788,"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":["dimensionality-reduction","embeddings","high-dimensional","pca","python","quantification","tsne","umap"],"created_at":"2024-10-18T11:08:34.511Z","updated_at":"2025-04-19T20:14:08.682Z","avatar_url":"https://github.com/erdogant.png","language":"Python","funding_links":["https://github.com/sponsors/erdogant","https://www.buymeacoffee.com/erdogant)--"],"categories":[],"sub_categories":[],"readme":"[![Python](https://img.shields.io/pypi/pyversions/flameplot)](https://img.shields.io/pypi/pyversions/flameplot)\n[![PyPI Version](https://img.shields.io/pypi/v/flameplot)](https://pypi.org/project/flameplot/)\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/erdogant/flameplot/blob/master/LICENSE)\n[![Github Forks](https://img.shields.io/github/forks/erdogant/flameplot.svg)](https://github.com/erdogant/flameplot/network)\n[![GitHub Open Issues](https://img.shields.io/github/issues/erdogant/flameplot.svg)](https://github.com/erdogant/flameplot/issues)\n[![Project Status](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active)\n[![Downloads](https://pepy.tech/badge/flameplot/month)](https://pepy.tech/project/flameplot/)\n[![Downloads](https://pepy.tech/badge/flameplot)](https://pepy.tech/project/flameplot)\n[![DOI](https://zenodo.org/badge/234703853.svg)](https://zenodo.org/badge/latestdoi/234703853)\n[![Sphinx](https://img.shields.io/badge/Sphinx-Docs-Green)](https://erdogant.github.io/flameplot/)\n[![Medium](https://img.shields.io/badge/Medium-Blog-green)](https://erdogant.github.io/flameplot/pages/html/Documentation.html#medium-blog)\n\u003c!---[![BuyMeCoffee](https://img.shields.io/badge/buymea-coffee-yellow.svg)](https://www.buymeacoffee.com/erdogant)--\u003e\n\u003c!---[![Coffee](https://img.shields.io/badge/coffee-black-grey.svg)](https://erdogant.github.io/donate/?currency=USD\u0026amount=5)--\u003e\n\n# Flameplot - Comparison of (high) dimensional embeddings.\n\n**⭐️ Star this repo if you like it ⭐️**\n\n\n### Medium Blog\n\nAlso checkout [The Similarity between t-SNE, UMAP, PCA, and Other Mappings](https://erdogant.github.io/flameplot/pages/html/Documentation.html#medium-blog) to get a structured overview and usage of ``flameplot``.\n\n\n#\n\n### Method\nTo compare the embedding of samples in two different maps, we propose a scale dependent similarity measure. For a pair of maps X and Y, we compare the sets of the, respectively, kx and ky nearest neighbours of each sample. We first define the variable rxij as the rank of the distance of sample j among all samples with respect to sample i, in map X. The nearest neighbor of sample i will have rank 1, the second nearest neighbor rank 2, etc. Analogously, ryij is the rank of sample j with respect to sample i in map Y. Now we define a score on the interval [0, 1], as (eq. 1)\n\u003cp align=\"left\"\u003e\n  \u003cimg src=\"https://github.com/erdogant/flameplot/blob/master/docs/figs/eq1.png\" width=\"450\" /\u003e\n\u003c/p\u003e\nwhere the variable n is the total number of samples, and the indicator function is given by (eq. 2)\n\u003cp align=\"left\"\u003e\n  \u003cimg src=\"https://github.com/erdogant/flameplot/blob/master/docs/figs/eq2.png\" width=\"250\" /\u003e\n\u003c/p\u003e\nThe score sx,y(kx, ky) will have value 1 if, for each sample, all kx nearest neighbours in map X are also the ky nearest neighbours in map Y, or vice versa. Note that a local neighborhood of samples can be set on the minimum number of samples in the class. Alternatively, kxy can be also set on the average class size.\n\n### Schematic overview\nSchematic overview to systematically compare local and global differences between two sample projections. For illustration we compare two input maps (x and y) in which each map contains n samples (step 1). The second step is the ranking of samples based on Euclidean distance. The ranks of map x are subsequently compared to the ranks of map y for kx and ky nearest neighbours (step 3). The overlap between ranks (step 4), is subsequently summarized in Score: Sx,y(kx,ky).\n\u003cp align=\"left\"\u003e\n  \u003cimg src=\"https://github.com/erdogant/flameplot/blob/master/docs/figs/schematic_overview.png\" width=\"350\" /\u003e\n\u003c/p\u003e\n\n\n### Functions in flameplot\n```python\nscores = flameplot.compare(map1, map2)\nfig    = flameplot.plot(scores)\nX,y    = flameplot.import_example()\nfig    = flameplot.scatter(Xcoord,Ycoord)\n\n```\n\n#### Install flameplot from PyPI\n\n```bash\npip install flameplot\n```\n\n#### Import flameplot package\n\n```python\nimport flameplot as flameplot\n```\n# \n\n\n### [Documentation pages](https://erdogant.github.io/flameplot/)\n\nOn the [documentation pages](https://erdogant.github.io/flameplot/) you can find detailed information about the working of the ``flameplot`` with examples. \n\n\u003chr\u003e \n\n### Examples\n\n# \n\n* [Example: Comparison between two maps follow the quantification of local similarity approach.](https://erdogant.github.io/flameplot/pages/html/Examples.html)\n\n\u003cp align=\"left\"\u003e\n  \u003ca href=\"https://erdogant.github.io/flameplot/pages/html/Examples.html\"\u003e\n  \u003cimg src=\"https://github.com/erdogant/flameplot/blob/master/docs/figs/pca50_tsne.png\" width=\"400\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n# \n\n* [Example: Comparison 2D embeddings: PCA vs tSNE](https://erdogant.github.io/flameplot/pages/html/Examples.html#comparison-2d-embeddings-pca-vs-tsne)\n\n\u003cp align=\"left\"\u003e\n  \u003ca href=\"https://erdogant.github.io/flameplot/pages/html/Examples.html#comparison-2d-embeddings-pca-vs-tsne\"\u003e\n  \u003cimg src=\"https://github.com/erdogant/flameplot/blob/master/docs/figs/pca2_tsne.png\" width=\"400\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n# \n\n* [Example: Comparison Random data vs. t-SNE](https://erdogant.github.io/flameplot/pages/html/Examples.html#comparison-random-data-vs-t-sne)\n\n\u003cp align=\"left\"\u003e\n  \u003ca href=\"https://erdogant.github.io/flameplot/pages/html/Examples.html#comparison-random-data-vs-t-sne\"\u003e\n  \u003cimg src=\"https://github.com/erdogant/flameplot/blob/master/docs/figs/random_tsne.png\" width=\"400\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\n# \n\n* [Example: Scatterplots](https://erdogant.github.io/flameplot/pages/html/Examples.html#scatterplots)\n\n\u003cp align=\"left\"\u003e\n  \u003ca href=\"https://erdogant.github.io/flameplot/pages/html/Examples.html#scatterplots\"\u003e\n  \u003cimg src=\"https://github.com/erdogant/flameplot/blob/master/docs/figs/scatter_pca.png\" width=\"600\" /\u003e\n  \u003cimg src=\"https://github.com/erdogant/flameplot/blob/master/docs/figs/scatter_tsne.png\" width=\"600\" /\u003e\n  \u003cimg src=\"https://github.com/erdogant/flameplot/blob/master/docs/figs/scatter_random.png\" width=\"600\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003chr\u003e\n\n\u003chr\u003e\n\n\n### Support\n\n\tThis project needs some love! ❤️ You can help in various ways.\n\n\t* Become a Sponsor!\n\t* Star this repo at the github page.\n\t* Other contributions can be in the form of feature requests, idea discussions, reporting bugs, opening pull requests.\n\t* Read more why becoming an sponsor is important on the Sponsor Github Page.\n\t\n\tCheers Mate.\n\n\n## References\n* Taskesen, E. et al. Pan-cancer subtyping in a 2D-map shows substructures that are driven by specific combinations of molecular characteristics. Sci. Rep. 6, 24949\n* https://static-content.springer.com/esm/art%3A10.1038%2Fsrep24949/MediaObjects/41598_2016_BFsrep24949_MOESM12_ESM.pdf\n* https://www.nature.com/articles/srep24949\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferdogant%2Fflameplot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferdogant%2Fflameplot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferdogant%2Fflameplot/lists"}