Making a facemash clone : using elo algorithm to rate two pictures against each other.
So after my last post I decided to put the data I scraped to some (im)practical use.
Having watched David Fincher's fine fictional work. I put on Atticus Ross's and Trent Reznor's music on loop and wrote a facemash clone in a plan to get rusticated from my college.
forking off main database ->
first off I forked out my postgres database using the following command in order to avaoid performing triple joins every time a picture gets rated.->
and added some more columns to it ->
the algo ->
Giving in to following fincher's work I went with elo rating system instead of using better options.
Here's how this algorithm calculates the probability of a player winning the match-up ->
Here's the formula for final rating of the player which won ->
Here's my golang implementation ->
i am using this function to test the various values of k,d and s to see, after how many number of losses the score of a player went negative.Then adjusted the base rating accordingly to a reasonable 200-ish match-ups till negative.
making the website :
onto the worst part. making the front end. Opting the laziest way out, I used the example code from material bootstrap library, modified it and used go's inbuilt templating engine to make the rankings and profile page.
wrangling database :
using the following sql query I fetched two random images with their enums from the DB to hydrate the page every-time it was refreshed.
and this query to get the top 15 for the rankings page ->
after each vote the /vote endpoint is called with winner and looser enums which updates the database with the new ranking of both winners and losers according to the elo algorithm. I'll need to add rate limiting to prevent abuse if I ever decide to release this app to a wider audience (which is never gonna happen).