geosink


Namegeosink JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryGeodesic Sinkhorn with Chebyshev approximation
upload_time2024-04-26 15:20:07
maintainerNone
docs_urlNone
authorGuillaume Huguet
requires_python>=3.8
licenseMIT License Copyright (c) 2024 Guillaume Huguet Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords diffusion optimal transport heat kernel sinkhorn
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # GeoSinkhorn
Code for the paper Geodesic Sinkhorn for Fast and Accurate Optimal Transport on Manifolds. 

**Note**: This repository is still in development.

### Installation
Clone the repository and install the library by running:
```bash
pip install -e .
```
or if you want to use the pre existing graph tools, run:
```bash
pip install -e .['graph']
```
To run the tests, you will need additional packages. Install them by running:
```bash
pip install -e .['dev']
```


### Minimal Example
Building a graph between two Gaussian distributions and computing the distance between two signals on the graph.
```python
import numpy as np
from geosink.sinkhorn import GeoSinkhorn 
from geosink.heat_kernel import laplacian_from_data

# Generate data and build graph.
data0 = np.random.normal(0, 1, (100, 5))
data1 = np.random.normal(5, 1, (100, 5))
data = np.concatenate([data0, data1], axis=0)
lap = laplacian_from_data(data, sigma=1.0)

# instantiate the GeoSinkhorn class
conv_sinkhorn = GeoSinkhorn(tau=1.0, order=10, method="cheb", lap=lap)

# create two signals
m_0 = np.zeros(200,)
m_0[:100] = 1
m_0 = m_0 / np.sum(m_0)
m_1 = np.zeros(200,)
m_1[100:] = 1
m_1 = m_1 / np.sum(m_1)

# compute the distance between the two signals
dist_w = conv_sinkhorn(m_0, m_1, max_iter=500)
print(dist_w)
```
Note that it is also possible to provide a graph instance directly to the `GeoSinkhorn` class with `GeoSinkhorn(tau=1.0, order=10, method="cheb", graph=graph)`. The `graph` must have a Laplacian attribute `graph.L`. We suggest using a sparse Laplacian (e.g. in COO format) for better performance.

### How to Cite

If you find this code useful in your research, please cite the following paper (expand for BibTeX):
<details>
<summary>
Huguet, G., Tong, A., Zapatero, M. R., Tape, C. J., Wolf, G., & Krishnaswamy, S. (2023). Geodesic Sinkhorn for fast and accurate optimal transport on manifolds. In 2023 IEEE 33rd International Workshop on Machine Learning for Signal Processing (MLSP).
</summary>

```bibtex
@inproceedings{huguet2023geodesic,
  title={Geodesic Sinkhorn for fast and accurate optimal transport on manifolds},
  author={Huguet, Guillaume and Tong, Alexander and Zapatero, Mar{\'\i}a Ramos and Tape, Christopher J and Wolf, Guy and Krishnaswamy, Smita},
  booktitle={2023 IEEE 33rd International Workshop on Machine Learning for Signal Processing (MLSP)},
  pages={1--6},
  year={2023},
  organization={IEEE}
}
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "geosink",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "diffusion, optimal transport, heat, kernel, sinkhorn",
    "author": "Guillaume Huguet",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/42/16/9f796d964d6412f78716477f06d80e4eddeb9a6cc8763dab7521d7d1d390/geosink-0.1.0.tar.gz",
    "platform": null,
    "description": "# GeoSinkhorn\nCode for the paper Geodesic Sinkhorn for Fast and Accurate Optimal Transport on Manifolds. \n\n**Note**: This repository is still in development.\n\n### Installation\nClone the repository and install the library by running:\n```bash\npip install -e .\n```\nor if you want to use the pre existing graph tools, run:\n```bash\npip install -e .['graph']\n```\nTo run the tests, you will need additional packages. Install them by running:\n```bash\npip install -e .['dev']\n```\n\n\n### Minimal Example\nBuilding a graph between two Gaussian distributions and computing the distance between two signals on the graph.\n```python\nimport numpy as np\nfrom geosink.sinkhorn import GeoSinkhorn \nfrom geosink.heat_kernel import laplacian_from_data\n\n# Generate data and build graph.\ndata0 = np.random.normal(0, 1, (100, 5))\ndata1 = np.random.normal(5, 1, (100, 5))\ndata = np.concatenate([data0, data1], axis=0)\nlap = laplacian_from_data(data, sigma=1.0)\n\n# instantiate the GeoSinkhorn class\nconv_sinkhorn = GeoSinkhorn(tau=1.0, order=10, method=\"cheb\", lap=lap)\n\n# create two signals\nm_0 = np.zeros(200,)\nm_0[:100] = 1\nm_0 = m_0 / np.sum(m_0)\nm_1 = np.zeros(200,)\nm_1[100:] = 1\nm_1 = m_1 / np.sum(m_1)\n\n# compute the distance between the two signals\ndist_w = conv_sinkhorn(m_0, m_1, max_iter=500)\nprint(dist_w)\n```\nNote that it is also possible to provide a graph instance directly to the `GeoSinkhorn` class with `GeoSinkhorn(tau=1.0, order=10, method=\"cheb\", graph=graph)`. The `graph` must have a Laplacian attribute `graph.L`. We suggest using a sparse Laplacian (e.g. in COO format) for better performance.\n\n### How to Cite\n\nIf you find this code useful in your research, please cite the following paper (expand for BibTeX):\n<details>\n<summary>\nHuguet, G., Tong, A., Zapatero, M. R., Tape, C. J., Wolf, G., & Krishnaswamy, S. (2023). Geodesic Sinkhorn for fast and accurate optimal transport on manifolds. In 2023 IEEE 33rd International Workshop on Machine Learning for Signal Processing (MLSP).\n</summary>\n\n```bibtex\n@inproceedings{huguet2023geodesic,\n  title={Geodesic Sinkhorn for fast and accurate optimal transport on manifolds},\n  author={Huguet, Guillaume and Tong, Alexander and Zapatero, Mar{\\'\\i}a Ramos and Tape, Christopher J and Wolf, Guy and Krishnaswamy, Smita},\n  booktitle={2023 IEEE 33rd International Workshop on Machine Learning for Signal Processing (MLSP)},\n  pages={1--6},\n  year={2023},\n  organization={IEEE}\n}\n```\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Guillaume Huguet  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Geodesic Sinkhorn with Chebyshev approximation",
    "version": "0.1.0",
    "project_urls": null,
    "split_keywords": [
        "diffusion",
        " optimal transport",
        " heat",
        " kernel",
        " sinkhorn"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6d168dc100b0de04c359884b35926f9ad416809d3e33e05c7cf2cef5687bb9d0",
                "md5": "fc196dcb5569ba1f222def5c90aba745",
                "sha256": "c42b3707f19e2667a559e37ca2467072da49874e3d9b556bc05ef665cc88450a"
            },
            "downloads": -1,
            "filename": "geosink-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fc196dcb5569ba1f222def5c90aba745",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 6724,
            "upload_time": "2024-04-26T15:20:05",
            "upload_time_iso_8601": "2024-04-26T15:20:05.661301Z",
            "url": "https://files.pythonhosted.org/packages/6d/16/8dc100b0de04c359884b35926f9ad416809d3e33e05c7cf2cef5687bb9d0/geosink-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "42169f796d964d6412f78716477f06d80e4eddeb9a6cc8763dab7521d7d1d390",
                "md5": "61ce50a045de05d2263595ce640e3a54",
                "sha256": "c19694f65666fbeb697684f845231ec6efaee1080f7a5af29406369f8c49f5aa"
            },
            "downloads": -1,
            "filename": "geosink-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "61ce50a045de05d2263595ce640e3a54",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 7627,
            "upload_time": "2024-04-26T15:20:07",
            "upload_time_iso_8601": "2024-04-26T15:20:07.709475Z",
            "url": "https://files.pythonhosted.org/packages/42/16/9f796d964d6412f78716477f06d80e4eddeb9a6cc8763dab7521d7d1d390/geosink-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-26 15:20:07",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "geosink"
}
        
Elapsed time: 0.26908s