Algorithm to create recurring random groups
Project description
Use Case
This package exports a single function called create_matching
which can be used to to
create matchings for different meetings from a varying but overlapping set of members.
In particular the internal algorithm makes sure that group matchings in different
meetings are mixed.
Installation
The package can be installed via conda. To do so, type the following commands in your favorite terminal emulator:
$ conda config --add channels conda-forge
$ conda install -c timmens randomgroups
If you prefer to use pip you can install the latest version directly from GitHub.
$ pip install --upgrade git+git://github.com/timmens/random-grouping.git
How to Use
The code expects a csv file containing id, name, and joins columns, where id is used internally to keep track of matchings, name is a str column which is used when creating the human-readable output and joins is a {0, 1} column which denotes if the given individual wants to join the current meeting. An example file is given here names.csv. Note that the rows in id column have to be unique. If new individuals wish to be added these individuals simply need to be appended to the data file, the code will update all further files automatically.
First Time Use:
If no prior matchings have been recorded you can create a new set of groups by running the following lines in a Python shell
from randomgroups import create_matching
names_path = "/path/to/names.csv"
output_path = "/path/to/folder/where/to/store/output/data"
create_matching(
names_path=names_path,
output_path=output_path,
min_size=3,
)
Here the argument min_size
denotes the minimum number of members in a group. In the
folder output_path
two files will be created. One, matchings.txt
which contain the
named matchings for the current meeting, and second, matchings_history.csv
which
contains information on matchings. The latter file needs to be saved since it will be
used in subsequent function calls. Example files are given here:
matching.txt,
matchings_history.csv.
Remark: If the files names.csv
is a Google sheet which is updated on a regular basis
it can be sensible not to donwload the file but to provide a link to the sheet directly.
In the case with Google sheets this is easily done by opening the Google sheet and then
publishing the document in the file options. This creates a link to a downloadable csv
file which updates when the Google sheet is updated. This URL can then be passed to
names_path
.
Subsequent Usage:
Once the file matchings_history.csv
has been created one can further pass the path of
this file to the function call via matchings_history_path=...
. The previous matchings
will then influence new group formations.
Assortative Matching:
The 'status' column in the names csv-file allows one to distuingish between 'student' and 'faculty'. One can then use the 'wants_mixing' column to specify whether an individual wants to be mixed with people from another group. This is not absolute. A float parameter ("faculty_multiplier") can be specified in a dictionary an passed to the main function via the argument "matching_params". If this parameter is very high it will be less likely that faculty that does not want to mix is mixed.
Contributing
If you want to contribute to this repository feel free to open a pull request or submit an issue. You can also simply contact me, see here.
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 randomgroups-0.0.1.tar.gz
.
File metadata
- Download URL: randomgroups-0.0.1.tar.gz
- Upload date:
- Size: 14.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e1824fad5d3a4078ca1ac8bc1c4004fc5569b2d263a9069e94b1145cd405c82 |
|
MD5 | e324b5fb14f6d801db0f39b027e99b6a |
|
BLAKE2b-256 | 204cb52d4139231e6b43a4261c1d99ff87cfd686f46c4e187a160c7913b00486 |
File details
Details for the file randomgroups-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: randomgroups-0.0.1-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 268783f4220b0b7e1da6535d5eccbb0ab6e8ba3a8f913e9f36ced338b6aee5c7 |
|
MD5 | d673862c62f2e3c11660b8b3009cf6c3 |
|
BLAKE2b-256 | cc2a7052599565bb0fd837b4bf0eaf23b7a22be1d4161da266484fedbb2ec046 |