This repository contains the course materials from Math 157: Intro to Mathematical Software.
Creative Commons BY-SA 4.0 license.
License: OTHER
Math 157: Intro to Mathematical Software
UC San Diego, winter 2018
This script creates the final project groups based on the Google Form input. This input was sanitized to remove duplicate names and to insert students that did not fill out the Google Form.
We set a random seed to make this calculation reproducible.
Import a CSV file retrieved from Google Docs.
Timestamp | Your name (as shown in CoCalc) | First choice of topic | Second choice of topic | |
---|---|---|---|---|
count | 129 | 149 | 129 | 129 |
unique | 129 | 149 | 6 | 6 |
top | 2/28/2018 14:06:51 | Jiawei Zhou | Model selection for machine learning | Combinatorial designs |
freq | 1 | 1 | 35 | 32 |
We only need the name and the first choice. Let's use the name as the axis.
Name | Topic | |
---|---|---|
count | 149 | 129 |
unique | 149 | 6 |
top | Jiawei Zhou | Model selection for machine learning |
freq | 1 | 35 |
Standardize capitalization and whitespace in the names.
Name | Topic | |
---|---|---|
0 | Aliaksandr Sumak | NaN |
1 | An-Vy Hoang | Numerical solution of ODEs |
2 | Anastasia Guanio | Fourier transforms |
3 | Andrew Or | Model selection for machine learning |
4 | Ansh Sancheti | Numerical solution of ODEs |
To make sure that the input was sanitized correctly, compare with a CSV file of course grades generated by CoCalc.
Name | ||
---|---|---|
count | 149 | 149 |
unique | 149 | 149 |
top | Jiawei Zhou | [email protected] |
freq | 1 | 1 |
Standardize capitalization and whitespace in the names.
Name | ||
---|---|---|
0 | Aliaksandr Sumak | [email protected] |
1 | An-Vy Hoang | [email protected] |
2 | Anastasia Guanio | [email protected] |
3 | Andrew Or | [email protected] |
4 | Ansh Sancheti | [email protected] |
Check that everything matches up. Make sure this is valid before using the results!
Convert the poll results into a dictionary.
Remove predefined groups before processing the rest of the list.
Separately, count the number of instances of each topic, including nan (blank).
In order to make the groups evenly sized, we add a dummy topic. Just like for real topics, we want no two dummies in the same group.
Distribute topics among the groups, from most to least popular (skipping the blanks). No topic may be assigned more than once within a group. To assign a particular topic, we choose a random subset of groups where each group is weighted by the number of empty spaces it has.
There is a probability of failure because we run out of empty groups. In case this occurs, we give up and try again.
Pad the remaining groups with blanks.
Fill students in at random according to their chosen topics.
Add back the preassigned groups.
For each group, assign each student who did not choose a topic to a random choice.
Print the groups to a file.
Create a workspace for each project. Make sure to edit the template chat room as appropriate before doing this.
After running this command, move the folder final_project_workspaces
into the shared project.