title: Algorithm - group users based on most similar preferences
body: <p>I'm developing an application where users are grouped in teams of 'n' based on a set of questions they answered. The set of questions is a basic multiple choice and each user has to answer each question. </p>
  
  <p>These are the hard criteria:</p>
  
  <ul>
  <li>Each group can have up to 'n' users </li>
  <li>Each user can only be assigned to 1 team </li>
  <li>Each team consist of users that have a high similarity</li>
  </ul>
  
  <p>the datasets I am using are looking as followed (I can change this tho)</p>
  
  <pre><code>{
   1: { 1: 'a', 2: 'b', 3: 'a', 4: 'c' },
   2: { 1: 'b', 2: 'c', 3: 'b', 4: 'd' },
   3: { 1: 'b', 2: 'a', 3: 'c', 4: 'd' },
   ...
  }
  </code></pre>
  
  <p><strong>In my first attempt</strong> : I created a function that will, when given an initial user, return a set of users in order of similarity. This worked fine but does not provide solid groups.</p>
  
  <p><strong>In my second attempt</strong> : I tried to define a lower and upper precision. 
  I then recursively looped over all users and pushed them on the team where the joined similarity of the members was higher then the upper precision. If not I would adjust the precision in the next iteration. This gave me solid groups but the users in each group are not as accurate as it should/could? be.</p>
  
  <p>I'm now looking into actual algorithms, specifically the Gale-Shapely Algorithm
  In order to solve my problem. Yet given the fact i'm a developer and not a data scientist the details are lost on me.</p>
  
  <p>Any advice or solutions for my problem are well appreciated.</p>