FairSplit - Shiny Contest Submission

FairSplit

Authors: Douglas Mesquita; Luís Gustavo Silva e Silva

Abstract: We proposed a tool to split teams/groups based on attributes ensuring that the attributes' averages are similar among teams. Therefore, we obtain balanced teams/groups. The method can be applied to sports, business, and also for fun!

Full Description:

Links

About the app

Wouldn't it be nice to have an approach to fairly split teams? We did it!

Quick reading: Highlights

Soccer is the most popular sport in Brazil and before every (non-professional)
match, a task is necessary: split the teams. A common way to do it is to choose
as many captains as the number of teams. They have the role to select their
teams based on their previous knowledge about the players' skills. The algorithm
starts with one of these captains selecting one player among all available
ones. After that, it is time for the next captain to start selecting their team
and again another player is selected among all available players. The algorithm
keeps going until all the players are allocated to a team.

Usually, the last captain has a weaker team as the other captains have already
selected the best players before. Also, the 'best player' can be someone good
in one specific position and the concept itself is completely subjective. The
same situation is rapidly applicable to other sports as volleyball, handball,
basketball, eSports, and so on. However, the task of creating teams is not just
applied to sports. It is common to have teams in a company, for example. In such
a case, the teams are defined based on the needs of each project.

Algorithm

We implemented a simple and useful iterative method. For each individual, a set
of attributes is collected, and, based on them, teams are created ensuring that
the overall teams’ metrics are similar. To do so, individuals are divided into
teams and teams’ similarity is calculated. After this, new settings are proposed,
and we keep the one in which the similarity is the biggest.

As a result, we have competitive teams with similar characteristics which can
ensure a more enjoyable match.

In our app the user can specify algorithm parameters:

  • Number of iterations
  • Number of teams
  • Size of each team

Examples

  • Nossa Pelada:

This example is based on a weekly match we usually had (before COVID-19 era)
in Belo Horizonte, Brazil. People and attributes are real and based on my
perception.

  • Fifa:

This example is based on FIFA 20 scouts. To make it simple we only selected
players from Barcelona, Juventus, Paris Saint-Germain, Real Madrid, Manchester
City, and Liverpool. Also, we only selected midfielders and attacking players.


Source: FIFA 20 complete player dataset | Kaggle

  • Pokémon:

We used the Pokémon dataset in the highcharts package. It has several Pokémon
and some characteristics.

Source: highcharter/data/pokemon.rda at main · jbkunst/highcharter · GitHub

  • Company:

Some data science skills from people in my company.

  • Rstudio:

A fake dataset simulating how we could split the RStudio team based on their
knowledge about some R packages. The attributes are completely random.

  • Upload your own data:

Try yourself!

Download our template and fill it with your data and split your teams.

Preview

ezgif.com-gif-maker


Keywords: sports, visualization, split tool, iterative method, clustering
Shiny app: https://voronoys.shinyapps.io/fairsplit/
Repo: GitHub - voronoys/fairsplit
RStudio Cloud: Posit Cloud

Thumbnail:
image

Full image:

2 Likes

Nice work. Thanks for sharing.

1 Like

Thank you, @Asitav_Sen

I am glad you like it :smile:

Hi there!
The upload data option didnt work for me :frowning: do you guys know how to acces it? thanks

Hello :slight_smile:

You need to follow the structure in the template. Are you using it?

It must be something like (column names are important):

Screenshot from 2023-09-01 09-34-38

If you share the file here I can try to help as well :slight_smile:

Thanks so much - here is the file!
I want to make teams of 4 (and I guess one team will have 3)

Try this file and then select 8 teams of size 4:

id photo c1 c2 c3
https://image.flaticon.com/icons/png/512/147/147144.png 1 10 2
https://image.flaticon.com/icons/png/512/147/147144.png 1 12 2
https://image.flaticon.com/icons/png/512/147/147144.png 1 12 2
https://image.flaticon.com/icons/png/512/147/147144.png 1 12.4 2
https://image.flaticon.com/icons/png/512/147/147144.png 1 14 2
https://image.flaticon.com/icons/png/512/147/147144.png 2 14 1
https://image.flaticon.com/icons/png/512/147/147144.png 1 15 1
https://image.flaticon.com/icons/png/512/147/147144.png 1 16 2
https://image.flaticon.com/icons/png/512/147/147144.png 2 18 1
https://image.flaticon.com/icons/png/512/147/147144.png 2 18 1
https://image.flaticon.com/icons/png/512/147/147144.png 1 18 2
https://image.flaticon.com/icons/png/512/147/147144.png 1 20 1
https://image.flaticon.com/icons/png/512/147/147144.png 1 20 2
https://image.flaticon.com/icons/png/512/147/147144.png 1 22 1
https://image.flaticon.com/icons/png/512/147/147144.png 1 24 1
https://image.flaticon.com/icons/png/512/147/147144.png 1 25 1
https://image.flaticon.com/icons/png/512/147/147144.png 2 25 1
https://image.flaticon.com/icons/png/512/147/147144.png 2 25 2
https://image.flaticon.com/icons/png/512/147/147144.png 2 25 2
https://image.flaticon.com/icons/png/512/147/147144.png 1 25 2
https://image.flaticon.com/icons/png/512/147/147144.png 2 27 2
https://image.flaticon.com/icons/png/512/147/147144.png 2 30 2
https://image.flaticon.com/icons/png/512/147/147144.png 1 30 1
https://image.flaticon.com/icons/png/512/147/147144.png 1 30 1
https://image.flaticon.com/icons/png/512/147/147144.png 2 30 1
https://image.flaticon.com/icons/png/512/147/147144.png 1 30 2
https://image.flaticon.com/icons/png/512/147/147144.png 2 32 1
https://image.flaticon.com/icons/png/512/147/147144.png 2 33 1
https://image.flaticon.com/icons/png/512/147/147144.png 2 35 1
https://image.flaticon.com/icons/png/512/147/147144.png 1 35 1
https://image.flaticon.com/icons/png/512/147/147144.png 2 45 1
https://image.flaticon.com/icons/png/512/147/147144.png 1 45 2
https://image.flaticon.com/icons/png/512/147/147144.png 2 45 2
https://image.flaticon.com/icons/png/512/147/147144.png 2 45 1
https://image.flaticon.com/icons/png/512/147/147144.png 2 50 1

Thank you Douglas,

However I run into an error before I get to upload the page, every time it disconnects me -
Maybe its work laptop safety?
image

Please double-check your .txt/.csv file. I just tested it again and it worked. Try with the template (download it in the upload section) just to be sure it is working .

Hi douglas I tried with another server and it worked - thank you!

It is because you are requesting 9 teams of 4. Ask for 8 teams of 4 (them Out will contain 3).

Thanks so much Douglas I got it!!
And is there a button to export the teams? Thank you!

1 Like

Unfortunately, we did not think about it so there is no export button. Sorry!

No Problem, this is so helpful!! Thank you so much for sharing the tool!

Do you mind deleting the names as they are employee names? Thank you so much again!

You are welcome.
Just deleted the names :slight_smile: