Thinning Out My T-shirt Collection with Elo's Rating Algorithm

4 min read Original article ↗

As part of a general attempt to have less stuff, I recently decided to get rid of a lot of my t-shirts. The problem was in deciding which ones; even with something as unimportant as a t-shirt, it can be hard to decide to let go. Nonetheless it seemed to me that, given any two shirts, I could easily say which I’d prefer to keep.

So the problem was one of finding a ranking based on either-or choices. This put me in mind of the film The Social Network, in which Mark Zuckerberg takes an algorithm designed for rating chess players, and uses it to build a website allowing visitors to rate the ‘hotness’ of female Harvard students.

Something approximating Elo's Algorithm in The Social Network

When watching the film, I assumed this was artistic license on the part of the writers, but it turns out that no, FaceMash was a real thing, and it seems like Mark Zuckerberg is actually that much of a douche (or at least was while at university).

Anyway, it seemed to me that if I could have my own local FaceMash-like image rater, I could just take a quick photo of each of my t-shirts, load them all in, and vote for a while until a clear ranking was established. Then I could just get rid of the lowest ranked t-shirts until I had the number I wanted.

There are a lot of public sites that do Elo rating for photos (many of them every bit as creepy as Zuckerberg’s original), but cursory googling revealed no simple desktop systems to do the same job, so I decided to write my own. It’s called elosort, and you can get it from github right now.

How does it work?

Using the tool is pretty simple. You run elosort in the directory containing the images. This starts a little webserver, serving a site that you can look at by pointing your browser at http://localhost:8080. The page is basically just two photos from the directory, side by side. Click the one you like more (or use the left and right arrow keys if you prefer), and elosort registers the vote and displays two more photos to compare. It stores the calculated ratings in an sqlite3 database file (called .elosortdb.sql3), and you can look at the rankings at http://localhost:8080/results. That’s it - it’s simple, and ugly as hell, but it works.

FireFLY or FireFOX?

I sat there re-watching The Social Network and idly playing 'hot or not’ with my t-shirt photos, and by the time the film was done, I had a nice stable ranking, and I could get rid of the lowest rated. Now I only have t-shirts that I really like - t-shirts that have proven themselves in single combat.

To be honest I really doubt I had to keep at it for the whole duration of a film, but there’s something kind of mesmerising about rating things in this way that means you don’t really notice time passing while you’re doing it.

Other uses

This oddly addictive property makes elosort useful for much more than just sorting t-shirts. It’s great for basically any collection of files that you might enjoy browsing through at random, but that you might also want sorted by quality; it lets you sort them by quality by browsing through them at random.

I elosorted a load of my holiday photos - it’s pretty fun to look over old photos, and as a nice side-effect, they’re now on the way to being sorted by quality. I mean, how often do people actually look through their holiday photos? I basically never do, and maybe that’s partly because the good ones are buried under all the mediocre ones. elosort attacks both sides of the problem, by making it more fun to browse them at random, and simultaneously sorting them so you can browse them not-at-random.

Do you have a rarely-looked-at directory of funny images downloaded from the internet? Elosort it!

Future uses

Right now elosort only handles images, but I’d like to extend it to other file types. For example, for the last few years I’ve kept a diary in the form of a load of plaintext files, one for each day. I sometimes like to read these at random, “flipping through the pages” as it were, and reading my thoughts from random days in my past. Some entries are a straightforward account of a fairly uninteresting day, others capture important events, interesting ideas, or the first thing that I ever wrote about a person who grew to be a big part of my life. When I’m randomly browsing my diary, why not be sorting it by interestingness at the same time?

What else might elosort work for? Videos? Music? Bookmarks? Try it out and let me know what you think!