{"id":19381203,"url":"https://github.com/j2kun/earthmover","last_synced_at":"2025-04-23T20:31:52.896Z","repository":{"id":30656783,"uuid":"123741826","full_name":"j2kun/earthmover","owner":"j2kun","description":"Implementation of the Earthmover distance metric in python.","archived":false,"fork":false,"pushed_at":"2023-07-04T02:03:55.000Z","size":56,"stargazers_count":14,"open_issues_count":3,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-02T19:46:55.849Z","etag":null,"topics":["earthmover-distance","linear-programming","optimization","python"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/j2kun.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-03-04T00:00:09.000Z","updated_at":"2024-04-03T14:14:14.000Z","dependencies_parsed_at":"2023-01-14T17:24:42.591Z","dependency_job_id":"c465da11-17dc-4f35-95b7-0c92bd5ee8f4","html_url":"https://github.com/j2kun/earthmover","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j2kun%2Fearthmover","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j2kun%2Fearthmover/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j2kun%2Fearthmover/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j2kun%2Fearthmover/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/j2kun","download_url":"https://codeload.github.com/j2kun/earthmover/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250509691,"owners_count":21442478,"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":["earthmover-distance","linear-programming","optimization","python"],"created_at":"2024-11-10T09:16:19.543Z","updated_at":"2025-04-23T20:31:52.610Z","avatar_url":"https://github.com/j2kun.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Earthmover distance\n\nPython code for the post [Earthmover Distance](https://jeremykun.com/2018/03/05/earthmover-distance/).\n\nTo install:\n\n```\ngit clone https://github.com/j2kun/earthmover.git\ncd earthmover\nvirtualenv -p python3 venv\nsource venv/bin/activate\npip install -r requirements.txt\n```\n\nTo run:\n\n```\n$ python earthmover.py\n```\n\nExample usage\n\n```python\np1 = [\n    (0, 0),\n    (0, 1),\n    (0, -1),\n    (1, 0),\n    (-1, 0),\n]\n\np2 = [\n    (0, 0),\n    (0, 2),\n    (0, -2),\n    (2, 0),\n    (-2, 0),\n]\n\nprint(earthmover_distance(p1, p2))\n```\n\nExample output (with logging):\n\n```\nmove 0.2 dirt from (0, 0) to (0, 0) for a cost of 0.0\nmove 0.2 dirt from (0, 1) to (0, 2) for a cost of 0.2\nmove 0.2 dirt from (0, -1) to (0, -2) for a cost of 0.2\nmove 0.2 dirt from (1, 0) to (2, 0) for a cost of 0.2\nmove 0.2 dirt from (-1, 0) to (-2, 0) for a cost of 0.2\n0.8\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj2kun%2Fearthmover","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fj2kun%2Fearthmover","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj2kun%2Fearthmover/lists"}