Answers.Body: <p>I don't believe your approach works because you're counting every position as an opening repertiore what you're actually measuring is the degree to which they play openings where theory has prescribed a large number of moves.  For example, a Ruy Lopez player might play the first 15 and 20 moves to reach the end of book play.  In contrast, someone who plays the Trompowsky or another unusual opening might be out of book after six moves.  Therefore, I would define "opening" differently.  For example, you could use ECO standard positions as a starting point for defining a person's opening.  I believe Eric Schiller also has an list of chess openings.  </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-02T10:34:17.733Z
Answers.Text: I think I understand your point. You mean something like (number of different ECOs) / total games. The bigger the result, the broader the repertoire, right?
Answers.UserDisplayName: hoacin
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-02T21:42:23.690Z
Answers.Text: Yes exactly.  However, if you use ECO you should run a check to determine if some of the positions are duplicate positions.  That is, they are the same position on the chessboard but arrived at through a different move order.  I believe there a couple of identical positions in ECO.   Still, you need to consider carefully how you define breadth within the ECO codes because if you look through the ECO codes, you'll see a lot of codes dedicated to Sicilians but less under the A class of openings.  you could consider several measures 1 for classes and 1 for specific codes.
Answers.UserDisplayName: ToddM
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-02T07:16:49.153Z
Answers.LastActivityDate: 2017-02-02T07:16:49.153Z
Answers.UserDisplayName: ToddM
Body: <p>programmers and mathematicians!</p>
  
  <p>I'm looking for some opinions how to build meaningfull formula that represents broadness of opponent's repertoire.</p>
  
  <p>At the moment I do it like this:</p>
  
  <ol>
  <li>I filter all positions that player played at least 2 times. This count = <strong>N</strong>.</li>
  <li>By Monte Carlo I evaluate average "broadness" of Mr. Average  (using book informations about move probabilities) for <strong>N</strong> occurrences in his games.</li>
  <li>I evaluate the same "broadness" for our target player.</li>
  </ol>
  
  <p>This broadness I calculate with "pythagoras thesis"
  sqrt(m1^2+m2^2+m3^2+m4^2 + ... + mn^2)/N where m1 is number of occurrences of move 1, m2 occurrence of move 2 in that position and sum(m1...mx)=<strong>N</strong></p>
  
  <p>So if in 20 games you play 20 times 1.e4, you get sqrt(20^2)/20=1 which means the extreme when repertoire is just as narrow as possible.</p>
  
  <p>When you play 10x 1.e4, 8x 1.d4 1x 1.c4 and 1x 1.Nf3, you get sqrt(10^2+8^2+1^2+1^2)/20=0.64420493633</p>
  
  <p>And when you are on the other side of extreme and make 20x different move in starting position, you get sqrt(20)/20=0.22360679775.</p>
  
  <p>Now I can sum broadness of Mr. Average to find the optimum. I can do the same to the target player and find how the numbers compare to the strategy that I call optimal (playing book moves as Mr. Average). I can weight position broadnesses by any f(N). I can divide player/mr. Average at every position or I can divide sums of these values, there is milions of approaches that can be used but none of them seems easy and logical at the same time.</p>
  
  <p>I'm not concerned here about using correct moves, as I deal with them in other formula. So if it is 10x a4, 8xNh3 etc, I don't mind having same number here like for 10x e4, 8x d4...</p>
  
  <p>With my approach it is possible to see difference between players playing always the same positions compared to coffeehouse masters just picking the line randomly, but still</p>
  
  <ol>
  <li>I don't see much logic in my calculation in the first place.</li>
  <li>The numbers aren't distribured very nicely</li>
  <li>With changing amount of games/positions same number might have different meaning.</li>
  <li>I worry there can be problem that the final result can be created by one huge number making the rest of calculation irrelevant.</li>
  </ol>
  
  <p>The only thing I really like here is comparing to Mr. Average, as I don't want to blame players not to be creative in positions where only one move is serious.</p>
  
  <p>If you have some ideas, link to mathematics page dealing with similar problem, anything, I will be happy to think about it!</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-12-22T16:33:46.610Z
Comments.Text: Seems you are after some sort of diversity index (https://en.wikipedia.org/wiki/Diversity_index)
Comments.UserDisplayName: jf328
Tags: <opening><programming><mathematics>
Title: Mathematical formula to get how broad opening repertoire is
ThreadText: # Mathematical formula to get how broad opening repertoire is
  
  (Asked by: username_0 on 2016-12-22)
  
  programmers and mathematicians!
  
  I'm looking for some opinions how to build meaningfull formula that represents broadness of opponent's repertoire.
  
  At the moment I do it like this:
  
  1. I filter all positions that player played at least 2 times. This count = **N**.
  2. By Monte Carlo I evaluate average "broadness" of Mr. Average (using book informations about move probabilities) for **N** occurrences in his games.
  3. I evaluate the same "broadness" for our target player.
  
  This broadness I calculate with "pythagoras thesis"
  sqrt(m1^2+m2^2+m3^2+m4^2 + ... + mn^2)/N where m1 is number of occurrences of move 1, m2 occurrence of move 2 in that position and sum(m1...mx)=**N**
  
  So if in 20 games you play 20 times 1.e4, you get sqrt(20^2)/20=1 which means the extreme when repertoire is just as narrow as possible.
  
  When you play 10x 1.e4, 8x 1.d4 1x 1.c4 and 1x 1.Nf3, you get sqrt(10^2+8^2+1^2+1^2)/20=0.64420493633
  
  And when you are on the other side of extreme and make 20x different move in starting position, you get sqrt(20)/20=0.22360679775.
  
  Now I can sum broadness of Mr. Average to find the optimum. I can do the same to the target player and find how the numbers compare to the strategy that I call optimal (playing book moves as Mr. Average). I can weight position broadnesses by any f(N). I can divide player/mr. Average at every position or I can divide sums of these values, there is milions of approaches that can be used but none of them seems easy and logical at the same time.
  
  I'm not concerned here about using correct moves, as I deal with them in other formula. So if it is 10x a4, 8xNh3 etc, I don't mind having same number here like for 10x e4, 8x d4...
  
  With my approach it is possible to see difference between players playing always the same positions compared to coffeehouse masters just picking the line randomly, but still
  
  1. I don't see much logic in my calculation in the first place.
  2. The numbers aren't distribured very nicely
  3. With changing amount of games/positions same number might have different meaning.
  4. I worry there can be problem that the final result can be created by one huge number making the rest of calculation irrelevant.
  
  The only thing I really like here is comparing to Mr. Average, as I don't want to blame players not to be creative in positions where only one move is serious.
  
  If you have some ideas, link to mathematics page dealing with similar problem, anything, I will be happy to think about it!
  
  **Tags:** opening, programming, mathematics
  
  > **Comments:**
  > **username_1**: Seems you are after some sort of diversity index (https://en.wikipedia.org/wiki/Diversity_index)  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2017-02-02. Score: 3
  
  I don't believe your approach works because you're counting every position as an opening repertiore what you're actually measuring is the degree to which they play openings where theory has prescribed a large number of moves. For example, a Ruy Lopez player might play the first 15 and 20 moves to reach the end of book play. In contrast, someone who plays the Trompowsky or another unusual opening might be out of book after six moves. Therefore, I would define "opening" differently. For example, you could use ECO standard positions as a starting point for defining a person's opening. I believe Eric Schiller also has an list of chess openings.
  
  > **Comments:**
  > **username_0**: I think I understand your point. You mean something like (number of different ECOs) / total games. The bigger the result, the broader the repertoire, right?  
  > **username_2**: Yes exactly.  However, if you use ECO you should run a check to determine if some of the positions are duplicate positions.  That is, they are the same position on the chessboard but arrived at through a different move order.  I believe there a couple of identical positions in ECO.   Still, you need to consider carefully how you define breadth within the ECO codes because if you look through the ECO codes, you'll see a lot of codes dedicated to Sicilians but less under the A class of openings.  you could consider several measures 1 for classes and 1 for specific codes.  
  
  ---
  
  