Algorithm for efficiently sorting large lists based on user preference

I’ll preface this question by saying I’m having a difficult time even formulating the problem, so my explanation might be fuzzy and/or I might be missing obvious solutions.

I have a list of 479 books which I would like to sort based on a “Fuzzy” criterion such as “which books would I like to read before the others in this list?”.

I took a stab at solving this by storing a record for each book in a database, and pre-populating a rank column with a unique sequential number from 1 to 479. For any particular rank, I’d like to read the corresponding book more than a book with a higher rank number. If the rank number is closer to 1, the corresponding book is one I wish to read earlier.

I created an interface that presents me with a choice between two books selected randomly from the database. After I click the book I would rather read first, the following happens:

• If the rank of the selected book is already lower (more interesting) than the other, I don’t change the rank of either book;
• If the selected book has a rank that’s higher (less interesting) than the other, I change the selected book’s rank to be the same as the other book, and add 1 to the rank of all the other books where the rank is more than or equal (including the other book, which would now be ranked directly below the selected book).

Finally, for each book I also store a counter of the times it has been evaluated. After I make a selection between two books, this counter increases for both the books that were presented to me. This allows me to avoid presenting books that have already been evaluated a certain number of times until all other books have been evaluated the same number of times.

I found the algorithm to be utterly ineffective: after going through all 479 of the books once, I looked at the list sorted by rank and noticed the list does not reflect at all my own perception of how I’d prioritize these books.

I’m looking for an algorithm that:

• Allows me to organize the list in an order that I would perceive to be accurate based on my personal notion of which books I’d like to read first;
• Can prioritize the aforementioned list with as little effort required as possible (i.e. an algorithm that requires the user to compare every book with every other book in the list in order to come to a valid sorting order isn’t ideal).

1 Answer

"Being more interesting" is not a transitive property. I can simultaneously find book A more interesting than B, book B more interesting than C, and book C more interesting than A. (On top of that, whether A is more interesting than B might also depend on when you ask me).

I wouldn't use a yes/no decision but let's say a range from -10 to +10, which allows the user to say that a book is much more interesting or just a tiny little bit more interesting than another boo.

I wouldn't modify ranks after each user comparison of two books, but remember all the rankings, and then each time give all the books a ranking, and find one that minimises the difference between the ranking and the user comparisons.

There's probably a good algorithm to do so. A not very good algorithm: Start ranking all books with an "interestingness" of zero. For each set of rankings we can calculate the error: For each user comparison between books A and B, calculate rating (A vs. B) minus (ranking A - ranking B), sum the squares of these.

Pick a book at random and change its ranking to minimise the error while leaving all other rankings unchanged. Repeat until you can't manage to improve it anymore.

• Thank you! Just to check I understood correctly: are you suggesting that I still present a choice between two books, but ask the user to rate both books individually on a scale from -10 to 10 (or similar) and, after that, to still choose which one they prefer between the two (essentially a three-step process)? I'm also wondering if you have any suggestions in terms of keywords I could use to do my own research into this area. My main struggle is that I'm not even sure how to google solutions to this problem, maybe that'd help shed some light. Oct 28, 2019 at 11:17