{"id":19669176,"url":"https://github.com/tommyod/paretoset","last_synced_at":"2025-04-05T08:03:45.136Z","repository":{"id":43824947,"uuid":"248201896","full_name":"tommyod/paretoset","owner":"tommyod","description":"Compute the Pareto (non-dominated) set, i.e., skyline operator/query.","archived":false,"fork":false,"pushed_at":"2025-01-25T15:33:39.000Z","size":748,"stargazers_count":58,"open_issues_count":7,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T07:01:41.709Z","etag":null,"topics":["data-mining","data-science","datascience","multi-objective-optimization","optimization","pandas","skyline-query"],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","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/tommyod.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-18T10:33:22.000Z","updated_at":"2025-03-20T11:16:38.000Z","dependencies_parsed_at":"2024-06-19T19:47:03.704Z","dependency_job_id":"5c47b760-3227-43d5-baac-7fa4489957bb","html_url":"https://github.com/tommyod/paretoset","commit_stats":{"total_commits":31,"total_committers":3,"mean_commits":"10.333333333333334","dds":0.06451612903225812,"last_synced_commit":"9da133c7aceeeb8e089438279552920a1af338c1"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tommyod%2Fparetoset","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tommyod%2Fparetoset/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tommyod%2Fparetoset/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tommyod%2Fparetoset/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tommyod","download_url":"https://codeload.github.com/tommyod/paretoset/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247305930,"owners_count":20917207,"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":["data-mining","data-science","datascience","multi-objective-optimization","optimization","pandas","skyline-query"],"created_at":"2024-11-11T16:39:16.285Z","updated_at":"2025-04-05T08:03:45.106Z","avatar_url":"https://github.com/tommyod.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# paretoset ![Build Status](https://github.com/tommyod/paretoset/workflows/Python%20CI/badge.svg?branch=master) [![](https://badge.fury.io/py/paretoset.svg)](https://pypi.org/project/paretoset/) [![](https://pepy.tech/badge/paretoset)](https://pepy.tech/project/paretoset) [![](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)\n\nCompute the Pareto (non-dominated) set, i.e., skyline operator/query.\n\nWatch the YouTube video: [Analyzing data with the Pareto set](https://www.youtube.com/watch?v=rkSmkkzM3ao)\n\n## Installation\n\nThe software is available through GitHub, and through [PyPI](https://pypi.org/project/paretoset/).\nYou may install the software using `pip`:\n\n```bash\npip install paretoset\n```\n\n## Examples - Skyline queries for data analysis and insight\n\n### Hotels that are cheap and close to the beach\n\nIn the database context, the Pareto set is called the *skyline* and computing the Pareto set is called a *skyline query*.\nThe folllowing example is from the paper \"*The Skyline Operator*\" by Börzsönyi et al.\n\n\u003e Suppose you are going on holiday and you are looking for a hotel that is cheap and close to the beach. \n  These two goals are complementary as the hotels near the beach tend to be more expensive. \n  The database system is unable to decide which hotel is best for you, but it can at least present you all interesting hotels. \n  Interesting are all hotels that are not worse than any other hotel in both dimensions. \n  You can now make your final decision, weighing your personal preferences for price and distance to the beach.\n\nHere's an example showing hotels in the Pareto set.\n\n```python\nfrom paretoset import paretoset\nimport pandas as pd\n\nhotels = pd.DataFrame({\"price\": [50, 53, 62, 87, 83, 39, 60, 44], \n                       \"distance_to_beach\": [13, 21, 19, 13, 5, 22, 22, 25]})\nmask = paretoset(hotels, sense=[\"min\", \"min\"])\nparetoset_hotels = hotels[mask]\n```\n\n![](https://raw.githubusercontent.com/tommyod/paretoset/master/scripts/example_hotels.png)\n\n### Top performing salespeople\n\nSuppose you wish to query a database for salespeople that might be eligible for a raise.\nTo find top performers (low salary, but high sales) for every department:\n\n```python\nfrom paretoset import paretoset\nimport pandas as pd\n\nsalespeople = pd.DataFrame(\n    {\n        \"salary\": [94, 107, 67, 87, 153, 62, 43, 115, 78, 77, 119, 127],\n        \"sales\": [123, 72, 80, 40, 64, 104, 106, 135, 61, 81, 162, 60],\n        \"department\": [\"c\", \"c\", \"c\", \"b\", \"b\", \"a\", \"a\", \"c\", \"b\", \"a\", \"b\", \"a\"],\n    }\n)\nmask = paretoset(salespeople, sense=[\"min\", \"max\", \"diff\"])\ntop_performers = salespeople[mask]\n```\n\n![](https://raw.githubusercontent.com/tommyod/paretoset/master/scripts/example_salespeople.png)\n\n## Example - Pareto efficient solutions in multiobjective optimization\n\nSuppose you wish to query a database for salespeople that might be eligible for a raise.\nTo find top performers (low salary, but high sales) for every department:\n\n```python\nfrom paretoset import paretoset\nimport numpy as np\nfrom collections import namedtuple\n\n# Create Solution objects holding the problem solution and objective values\nSolution = namedtuple(\"Solution\", [\"solution\", \"obj_value\"])\nsolutions = [Solution(solution=object, obj_value=np.random.randn(2)) for _ in range(999)]\n\n# Create an array of shape (solutions, objectives) and compute the non-dominated set\nobjective_values_array = np.vstack([s.obj_value for s in solutions])\nmask = paretoset(objective_values_array, sense=[\"min\", \"max\"])\n\n# Filter the list of solutions, keeping only the non-dominated solutions\nefficient_solutions = [solution for (solution, m) in zip(solutions, mask) if m]\n```\n\n![](https://raw.githubusercontent.com/tommyod/paretoset/master/scripts/example_optimization.png)\n\n## Contributing\n\nYou are very welcome to scrutinize the code and make pull requests if you have suggestions and improvements.\nYour submitted code must be PEP8 compliant, and all tests must pass.\n\nContributors: [Kartik](https://github.com/kartiksubbarao)\n\n## Performance\n\nThe graph below shows how long it takes to compute the Pareto set.\nGaussian data has only a few observations in the Pareto set, while uniformly distributed data on a simplex has every observations in the Pareto set.\n\n![](https://raw.githubusercontent.com/tommyod/paretoset/master/scripts/times_pareto_set.png)\n\n\n## References\n\n- \"*The Skyline Operator*\" by Börzsönyi et al. introduces the *Skyline Operator* in the database context.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftommyod%2Fparetoset","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftommyod%2Fparetoset","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftommyod%2Fparetoset/lists"}