Skip to main content

paretoset Build Status

Compute the Pareto (non-dominated) set, i.e., skyline operator/query.

Watch the YouTube video: Analyzing data with the Pareto set

Read a blog post: Multi-Objective Optimization and Pareto Front

Installation

The software is available through GitHub, and through PyPI. You may install the software using pip:

pip install paretoset

Examples - Skyline queries for data analysis and insight

Hotels that are cheap and close to the beach

In the database context, the Pareto set is called the skyline and computing the Pareto set is called a skyline query. The folllowing example is from the paper "The Skyline Operator" by Börzsönyi et al.

Suppose you are going on holiday and you are looking for a hotel that is cheap and close to the beach. These two goals are complementary as the hotels near the beach tend to be more expensive. The database system is unable to decide which hotel is best for you, but it can at least present you all interesting hotels. Interesting are all hotels that are not worse than any other hotel in both dimensions. You can now make your final decision, weighing your personal preferences for price and distance to the beach.

Here's an example showing hotels in the Pareto set.

from paretoset import paretoset
import pandas as pd

hotels = pd.DataFrame({"price": [50, 53, 62, 87, 83, 39, 60, 44], 
                       "distance_to_beach": [13, 21, 19, 13, 5, 22, 22, 25]})
mask = paretoset(hotels, sense=["min", "min"])
paretoset_hotels = hotels[mask]

Top performing salespeople

Suppose you wish to query a database for salespeople that might be eligible for a raise. To find top performers (low salary, but high sales) for every department:

from paretoset import paretoset
import pandas as pd

salespeople = pd.DataFrame(
    {
        "salary": [94, 107, 67, 87, 153, 62, 43, 115, 78, 77, 119, 127],
        "sales": [123, 72, 80, 40, 64, 104, 106, 135, 61, 81, 162, 60],
        "department": ["c", "c", "c", "b", "b", "a", "a", "c", "b", "a", "b", "a"],
    }
)
mask = paretoset(salespeople, sense=["min", "max", "diff"])
top_performers = salespeople[mask]

Example - Pareto efficient solutions in multiobjective optimization

Suppose you wish to query a database for salespeople that might be eligible for a raise. To find top performers (low salary, but high sales) for every department:

from paretoset import paretoset
import numpy as np
from collections import namedtuple

# Create Solution objects holding the problem solution and objective values
Solution = namedtuple("Solution", ["solution", "obj_value"])
solutions = [Solution(solution=object, obj_value=np.random.randn(2)) for _ in range(999)]

# Create an array of shape (solutions, objectives) and compute the non-dominated set
objective_values_array = np.vstack([s.obj_value for s in solutions])
mask = paretoset(objective_values_array, sense=["min", "max"])

# Filter the list of solutions, keeping only the non-dominated solutions
efficient_solutions = [solution for (solution, m) in zip(solutions, mask) if m]

Contributing

You are very welcome to scrutinize the code and make pull requests if you have suggestions and improvements. Your submitted code must be PEP8 compliant, and all tests must pass.

Contributors: Kartik

Performance

The graph below shows how long it takes to compute the Pareto set. Gaussian data has only a few observations in the Pareto set, while uniformly distributed data on a simplex has every observations in the Pareto set.

References

  • "The Skyline Operator" by Börzsönyi et al. introduces the Skyline Operator in the database context.

Metadata

Release files for paretoset 1.2.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for paretoset 1.2.5
File Size Uploaded
paretoset-1.2.5.tar.gz 16.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for paretoset 1.2.5
File Interpreter ABI Platform
paretoset-1.2.5-py3-none-any.whl Python 3 none any Details

Total release size: 34.8 kB

Release files / paretoset-1.2.5.tar.gz

Download URL paretoset-1.2.5.tar.gz
Size 16.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7549716b093ab22068c7cce4ad5faa90e85aff497cb7cedf7930a2ba19927e43
BLAKE2b-256 checksum
How to use checksums
17e2c8ac84ccb5585fa5efcc39d54ebbe1cb2b67825ede0da7c1553c423d4acc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / paretoset-1.2.5-py3-none-any.whl

Download URL paretoset-1.2.5-py3-none-any.whl
Size 18.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e3763187bbc9bcc7feeaedb9fcc63d6026ce2c614bf8468ff2334aeb96cf26e9
BLAKE2b-256 checksum
How to use checksums
3fa345b564f77f48a33d73090baaad41d75cc5b64d4f4119f1daa2de30443060
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

1.2.5 This release

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page