A Python package for dividing a set of units into two most comparable groups based on their characteristics.
Project description
Introduction
This project provides a Python package and REST API applications for dividing a set of units into two most comparable groups based on their characteristics.
Problem Statement
Balancing Numeric Characteristics Across Two Groups
Input:
-
A set of units, where each unit possesses one or more numeric characteristics.
-
Desired size for each of the two groups.
-
(Optional) Pre-assignment constraints:
- Specify units that must belong to a particular group (Group A or Group B).
- Specify units that cannot belong to a particular group (Group A or Group B).
Objective:
Partition the units into two groups (Group A and Group B) of the specified size, ensuring maximum similarity between the groups. Similarity is measured by minimizing the sum of absolute differences in mean values for each characteristic across the two groups.
Constraints:
- Each unit is assigned to either Group A, Group B, or remains unassigned.
- The final size of Group A and Group B must match the specified desired size.
Output:
- A list of units assigned to Group A and Group B.
- The mean values for each characteristic in Group A and Group B.
- The sum of absolute differences in mean values for each characteristic across the two groups.
Local development
You are more than welcome to contribute to this project. To make your start easier we have prepared a docker image with all the necessary tools to run it as interpreter for Pycharm or to run tests.
Build docker image
docker build `
--tag surquest/surquest/split-balancer:latest `
--file package.base.dockerfile `
--target test .
Run docker container
docker run --rm -it `
-v "${pwd}:/opt/project" `
-w "/opt/project/test" `
surquest/surquest/split-balancer:latest pytest
REST API Quick Start
# Build the docker image
docker build `
--no-cache `
--tag surquest/app-split-balancer:latest `
--file app.base.dockerfile `
--target base .
docker build `
--no-cache `
--tag python/instore/pmp-integration-proxy `
--file app.base.dockerfile `
--target app .
# Run the docker container
docker run --rm -it `
--name pmp-integration-proxy `
-v "$(pwd):/opt/project" `
-p 1010:8080 surquest/app-split-balancer:latest
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file surquest_split_balancer-0.0.6.tar.gz
.
File metadata
- Download URL: surquest_split_balancer-0.0.6.tar.gz
- Upload date:
- Size: 14.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28ce67214e26a568609541adc7a0d6958057cb2ced9ecb95266baa2345bb4b8c |
|
MD5 | 42f27a583ac67bb8062d03c1f14f4789 |
|
BLAKE2b-256 | dccabd59f3171575f93a55c25eb04b3bf81ddb959572eb044979d2a2c1e3fef9 |
File details
Details for the file surquest_split_balancer-0.0.6-py2.py3-none-any.whl
.
File metadata
- Download URL: surquest_split_balancer-0.0.6-py2.py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d576a1dab5e8a4110fc65752c1bfba6f2545b55519a9421185d7bf97000f5ff3 |
|
MD5 | 669d0598a7be70d39a921044785a007f |
|
BLAKE2b-256 | 92c3845613cf08e00baa56065a148e47e14bb336ef95b50909c296d18df2b504 |