├── .gitignore ├── CloudToGrid.ipynb ├── license.md ├── readme.md └── requirements.txt /.gitignore: -------------------------------------------------------------------------------- 1 | .* 2 | *.pyc -------------------------------------------------------------------------------- /license.md: -------------------------------------------------------------------------------- 1 | The code in this repository is available under the [MIT License](https://secure.wikimedia.org/wikipedia/en/wiki/Mit_license). 2 | 3 | Copyright (c) 2016- Kyle McDonald 4 | 5 | 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: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | 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. -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # CloudToGrid 2 | 3 | This repo shows how to map one point cloud to another; for example, creating a 2d grid embedding of a t-SNE point cloud. 4 | 5 | This repo uses [lapjv](https://github.com/gatagat/lapjv.git) wrapper for Jonker's implementation of the [Jonker-Volgenant algorithm](http://link.springer.com/article/10.1007%2FBF02278710) as well as [hungarian](https://github.com/hrldcpr/hungarian), which are both solutions to the "[assignment problem](https://en.wikipedia.org/wiki/Assignment_problem)", a combinatorial optimization problem that asks: how do you assign workers to tasks in a way that minimizes the overall cost? For CloudToGrid, the "task" is point correspondence, and the cost of each correspondence is the squared distance between the original and destination point. The Jonker-Volgenant algorithm is a less tolerant but more efficient solution than the traditional [Hungarian Algorithm](https://en.wikipedia.org/wiki/Hungarian_algorithm). 6 | 7 | The Jonker-Volgenant algorithm implementation used here can fail when the difference between two costs is very small, and both algorithms can fail when the costs are all small. 8 | 9 | ## Installation and Usage 10 | 11 | First, install numpy, scipy, sklearn, matplotlib, [lapjv](https://github.com/gatagat/lapjv.git) and [hungarian](https://github.com/hrldcpr/hungarian) using the requirements file: 12 | 13 | ``` 14 | $ pip install -r requirements.txt 15 | ``` 16 | 17 | Then clone this repository and run the example: 18 | 19 | ``` 20 | $ git clone https://github.com/kylemcdonald/CloudToGrid.git 21 | $ cd CloudToGrid 22 | $ jupyter notebook 23 | ``` 24 | 25 | ## Acknowledgement 26 | 27 | This repository is inspired by Mario Klingemann's [Raster Fairy](https://github.com/Quasimondo/RasterFairy) work. -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | numpy 2 | scipy 3 | sklearn 4 | matplotlib 5 | git+https://github.com/gatagat/lap.git 6 | git+https://github.com/hrldcpr/hungarian.git --------------------------------------------------------------------------------