Leela Nets for Human Training and "Style"

Discussion of anything and everything relating to chess playing software and machines.

Moderator: Ras

chrisw
Posts: 4637
Joined: Tue Apr 03, 2012 4:28 pm
Location: Midi-Pyrénées
Full name: Christopher Whittington

Re: Leela Nets for Human Training and "Style"

Post by chrisw »

Ferdy wrote: Wed Jul 03, 2019 12:21 am
chrisw wrote: Tue Jul 02, 2019 11:09 pm
Ferdy wrote: Tue Jul 02, 2019 9:39 pm
chrisw wrote: Tue Jul 02, 2019 2:43 pmcan you send Mg, Eg for both sides to the model? eg four variables. Could be that a GM is asymmetric
Some test result without norm to [0,1], also added the 4 variables on mobility, i.e WMobilityMgCP, WMobilityEgCP, BMobilityMgCP, BMobilityEgCP.

Regression summary results when each feature has a value of 100cp.

Example
Player: Tal
Feature: PasserCP
PasserCP: 100
ScoreCP prediction: 93 (expected position evaluation according to Stockfish at 1s of search)

Code: Select all

       Feature  Tal  Capablanca  Fischer
      PasserCP   93         199      200
      ThreatCP  125         167      153
  KingSafetyCP  122         171      167
    MobilityCP  212         240      217
 WMobilityMgCP  139         178      168
 WMobilityEgCP  108         147      137
 BMobilityMgCP   79         122      121
 BMobilityEgCP  132         163      156

Looks like overall Capablanca is dangerous, he tops on Threat, KingSafety and Mobility and very close in Passer.
I have to admit to struggling to wrap my head around interpreting this
If you give an advantage of 100cp (static eval) on passed pawn to Tal, Tal's position score is only 93cp (according to Stockfish at 1s), but if you give that 100cp (static eval) to Capablanca, Capablanca's position score is 199cp. This makes Capablanca dangerous to play over Tal. The constant is 100cp passed pawn advantage.

For other feature like Mobility, you give Tal 100cp mobility advantage, Tal's position score is only 212cp. But if you give that 100cp to Capablanca, its position score is 240cp. Capablanca is more dangerous here too.
Ah, yes, I see what you mean. And since the data is only from Capa wins, then he converts the advantage to a win ... is that right?
One clarifier question ... are the value weights above individually calculated by the regressor in separate runs (like you did in the earlier posts)?
Ferdy
Posts: 4848
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Leela Nets for Human Training and "Style"

Post by Ferdy »

chrisw wrote: Wed Jul 03, 2019 1:17 am
Ferdy wrote: Wed Jul 03, 2019 12:21 am
chrisw wrote: Tue Jul 02, 2019 11:09 pm
Ferdy wrote: Tue Jul 02, 2019 9:39 pm
chrisw wrote: Tue Jul 02, 2019 2:43 pmcan you send Mg, Eg for both sides to the model? eg four variables. Could be that a GM is asymmetric
Some test result without norm to [0,1], also added the 4 variables on mobility, i.e WMobilityMgCP, WMobilityEgCP, BMobilityMgCP, BMobilityEgCP.

Regression summary results when each feature has a value of 100cp.

Example
Player: Tal
Feature: PasserCP
PasserCP: 100
ScoreCP prediction: 93 (expected position evaluation according to Stockfish at 1s of search)

Code: Select all

       Feature  Tal  Capablanca  Fischer
      PasserCP   93         199      200
      ThreatCP  125         167      153
  KingSafetyCP  122         171      167
    MobilityCP  212         240      217
 WMobilityMgCP  139         178      168
 WMobilityEgCP  108         147      137
 BMobilityMgCP   79         122      121
 BMobilityEgCP  132         163      156

Looks like overall Capablanca is dangerous, he tops on Threat, KingSafety and Mobility and very close in Passer.
I have to admit to struggling to wrap my head around interpreting this
If you give an advantage of 100cp (static eval) on passed pawn to Tal, Tal's position score is only 93cp (according to Stockfish at 1s), but if you give that 100cp (static eval) to Capablanca, Capablanca's position score is 199cp. This makes Capablanca dangerous to play over Tal. The constant is 100cp passed pawn advantage.

For other feature like Mobility, you give Tal 100cp mobility advantage, Tal's position score is only 212cp. But if you give that 100cp to Capablanca, its position score is 240cp. Capablanca is more dangerous here too.
Ah, yes, I see what you mean. And since the data is only from Capa wins, then he converts the advantage to a win ... is that right?
Yes.
chrisw wrote: Wed Jul 03, 2019 1:17 amOne clarifier question ... are the value weights above individually calculated by the regressor in separate runs (like you did in the earlier posts)?
Yes, I just made a summary table to easily compare the players.

It would be difficult to understand if I just give the y_intercept and the slope of the regression per feature per player. Higher slope usually indicates a strong player but there is also y_intercept. So what I did is to give a 100cp to a feature and calculate the predicted score. Then we can compare the predicted score among players.

I have tried combining 4 features in the regression instead of 1 feature at a time, so we can get feature coefficients simultaneously. Will try to post this later. Would be interesting to discover their weights and compare it to the weight which was done individually.
User avatar
Ovyron
Posts: 4562
Joined: Tue Jul 03, 2007 4:30 am

Re: Leela Nets for Human Training and "Style"

Post by Ovyron »

This is very cool. Have you considered running through 2 chess engines's games on there and take a look at their numbers? Human players are playing distinctively, I wonder if chess engines would look alike because they'd play the same moves on the same situations. Otherwise, some engine could be found that matches some numbers and we'd already have an engine that plays like Tal, but we didn't know it did until now.
Your beliefs create your reality, so be careful what you wish for.
chrisw
Posts: 4637
Joined: Tue Apr 03, 2012 4:28 pm
Location: Midi-Pyrénées
Full name: Christopher Whittington

Re: Leela Nets for Human Training and "Style"

Post by chrisw »

Ovyron wrote: Wed Jul 03, 2019 7:21 am This is very cool. Have you considered running through 2 chess engines's games on there and take a look at their numbers? Human players are playing distinctively, I wonder if chess engines would look alike because they'd play the same moves on the same situations. Otherwise, some engine could be found that matches some numbers and we'd already have an engine that plays like Tal, but we didn't know it did until now.
We (I say we, but it is Ferdy who is doing it) will be able to do that if this idea works. I guess “we” can automate the process for all and any entity, all it requires is enough games for the regressor to work on. One bottleneck is the requirement to perform an SF evaluation on all positions.
chrisw
Posts: 4637
Joined: Tue Apr 03, 2012 4:28 pm
Location: Midi-Pyrénées
Full name: Christopher Whittington

Re: Leela Nets for Human Training and "Style"

Post by chrisw »

Ferdy wrote: Wed Jul 03, 2019 1:43 am
chrisw wrote: Wed Jul 03, 2019 1:17 am
Ferdy wrote: Wed Jul 03, 2019 12:21 am
chrisw wrote: Tue Jul 02, 2019 11:09 pm
Ferdy wrote: Tue Jul 02, 2019 9:39 pm
chrisw wrote: Tue Jul 02, 2019 2:43 pmcan you send Mg, Eg for both sides to the model? eg four variables. Could be that a GM is asymmetric
Some test result without norm to [0,1], also added the 4 variables on mobility, i.e WMobilityMgCP, WMobilityEgCP, BMobilityMgCP, BMobilityEgCP.

Regression summary results when each feature has a value of 100cp.

Example
Player: Tal
Feature: PasserCP
PasserCP: 100
ScoreCP prediction: 93 (expected position evaluation according to Stockfish at 1s of search)

Code: Select all

       Feature  Tal  Capablanca  Fischer
      PasserCP   93         199      200
      ThreatCP  125         167      153
  KingSafetyCP  122         171      167
    MobilityCP  212         240      217
 WMobilityMgCP  139         178      168
 WMobilityEgCP  108         147      137
 BMobilityMgCP   79         122      121
 BMobilityEgCP  132         163      156

Looks like overall Capablanca is dangerous, he tops on Threat, KingSafety and Mobility and very close in Passer.
I have to admit to struggling to wrap my head around interpreting this
If you give an advantage of 100cp (static eval) on passed pawn to Tal, Tal's position score is only 93cp (according to Stockfish at 1s), but if you give that 100cp (static eval) to Capablanca, Capablanca's position score is 199cp. This makes Capablanca dangerous to play over Tal. The constant is 100cp passed pawn advantage.

For other feature like Mobility, you give Tal 100cp mobility advantage, Tal's position score is only 212cp. But if you give that 100cp to Capablanca, its position score is 240cp. Capablanca is more dangerous here too.
Ah, yes, I see what you mean. And since the data is only from Capa wins, then he converts the advantage to a win ... is that right?
Yes.
chrisw wrote: Wed Jul 03, 2019 1:17 amOne clarifier question ... are the value weights above individually calculated by the regressor in separate runs (like you did in the earlier posts)?
Yes, I just made a summary table to easily compare the players.

It would be difficult to understand if I just give the y_intercept and the slope of the regression per feature per player. Higher slope usually indicates a strong player but there is also y_intercept. So what I did is to give a 100cp to a feature and calculate the predicted score. Then we can compare the predicted score among players.

I have tried combining 4 features in the regression instead of 1 feature at a time, so we can get feature coefficients simultaneously. Will try to post this later. Would be interesting to discover their weights and compare it to the weight which was done individually.
simultaneous feature coefficients would be better. some will be larger than others, but once there is a good set of coefficients for several GMs/entities, then we can normalise the coefficients to sigmas. eg, once sigma normalised, a simple histogram will be a style graphic, ease of visually comparing the style sets.
Ferdy
Posts: 4848
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Leela Nets for Human Training and "Style"

Post by Ferdy »

Ferdy wrote: Wed Jul 03, 2019 1:43 am I have tried combining 4 features in the regression instead of 1 feature at a time, so we can get feature coefficients simultaneously. Will try to post this later. Would be interesting to discover their weights and compare it to the weight which was done individually.
Sample run with 4 independent variables.

Image


Image


Image

ScoreCP prediction is topped by Capablanca at 302.20 when independent variables are all set to 100cp.

Tal:
Top 1 in mobility at coeff = 1.03

Capablanca:
Top 1 in Threats

Fischer:
Top 1 in Passer
Top 1 in KingSafety

Tal is very strong on mobility. Capablanca is good at mobility and passer. Fischer is well rounded, coefficients are not that high and not that low either and topped the 2 features on Passer and KingSafety.

Again these positions are white to move and player won the game. Static evaluation is from Stockfish eval command, and position score is from Stokfish at 1s of analysis. All positions that has a position score outside the window of [-500, +500] cp are excluded in the regression.
chrisw
Posts: 4637
Joined: Tue Apr 03, 2012 4:28 pm
Location: Midi-Pyrénées
Full name: Christopher Whittington

Re: Leela Nets for Human Training and "Style"

Post by chrisw »

Ferdy wrote: Wed Jul 03, 2019 11:48 am
Ferdy wrote: Wed Jul 03, 2019 1:43 am I have tried combining 4 features in the regression instead of 1 feature at a time, so we can get feature coefficients simultaneously. Will try to post this later. Would be interesting to discover their weights and compare it to the weight which was done individually.
Sample run with 4 independent variables.

Image


Image


Image

ScoreCP prediction is topped by Capablanca at 302.20 when independent variables are all set to 100cp.

Tal:
Top 1 in mobility at coeff = 1.03

Capablanca:
Top 1 in Threats

Fischer:
Top 1 in Passer
Top 1 in KingSafety

Tal is very strong on mobility. Capablanca is good at mobility and passer. Fischer is well rounded, coefficients are not that high and not that low either and topped the 2 features on Passer and KingSafety.

Again these positions are white to move and player won the game. Static evaluation is from Stockfish eval command, and position score is from Stokfish at 1s of analysis. All positions that has a position score outside the window of [-500, +500] cp are excluded in the regression.
cool, the idea seems to be making progress
n4k3dw4ff13s
Posts: 19
Joined: Sat Jan 28, 2023 4:01 am
Full name: Ifti Ram

Re: Leela Nets for Human Training and "Style"

Post by n4k3dw4ff13s »

Have you checked out McIlroy-Young, R., Wang, R., Sen, S., Kleinberg, J., and Anderson, A. Detecting individual decision-making style: Exploring behavioral stylometry in chess.Advances in Neural Information Processing Systems 34 (2021) ?
n4k3dw4ff13s
Posts: 19
Joined: Sat Jan 28, 2023 4:01 am
Full name: Ifti Ram

Re: Leela Nets for Human Training and "Style"

Post by n4k3dw4ff13s »

Also, in this paper they check out whether internal representations (the activations of a neural network) can be related to human chess concepts like material, imbalance, pawns, knights, bishops, rooks, queens, mobility, king_safety, threats, passed_pawns, space, total and more. For a full list see Tables 2,3, and 4 of Appendix A (starts on page 35) With these components, maybe you can compose your own "styles" like speculative and conservative. For speculative and conservative, maybe you look at piece value imbalance, piece mobility, king safety, pawn structure and space.
n4k3dw4ff13s
Posts: 19
Joined: Sat Jan 28, 2023 4:01 am
Full name: Ifti Ram

Re: Leela Nets for Human Training and "Style"

Post by n4k3dw4ff13s »

There's also this [url = https://dl.ucsc.cmb.ac.lk/jspui/bitstre ... MCS033.pdf] paper [/url] that initially looks at 5 styles and compresses it down into 4. The methodology is probably not relevant, but rather the playing styles of aggressive, positional, defensive, solid, and tactical are. In this particular paper, although five were proposed, after games were clustered both solid and tactical styles were merged together. I wonder whether incorporating the extra concepts from table 3 and 4 of appendix A would have created more clusters, deleted some (or one), or kept the original five.

You could piggyback off of this author's work and use their 4/5 play styles, or re-run their analysis with the extra concepts from appendix A and see what you get.