Is it possible to delete a move from a Polyglot book?

Discussions about Winboard/Xboard. News about engines or programs to use with these GUIs (e.g. tournament managers or adapters) belong in this sub forum.

Moderator: Andres Valverde

Re: Is it possible to delete a move from a Polyglot book?

Postby K Inuen » 17 May 2011, 19:12

Michel wrote:I looked a bit on the web for ChessBase's handling of book learning. As far as I understand they also modify the original book.
Does anyone know how they deal with copyright? Or is it possible for the original author to write protect a book so that
it cannot be modified?

Considering Fritz's / Chessbase GUI's capability to influence book weights (if set) in relation to the .ctg books, I haven't known this to be a problem pertaining to copy rights on a .ctg book - be it commercial or freeware.

Every .ctg book author is much aware that Fritz's book learning can alter the initial state of the book, hence the need for .ctg book authors to specify the settings of their individual books (and probably for optimal book use). But it's still up to end users to do as they please with their property.
K Inuen
 
Posts: 50
Joined: 27 Apr 2010, 02:25

Re: Is it possible to delete a move from a Polyglot book?

Postby Michel » 17 May 2011, 19:21

But it's still up to end users to do as they please with their property.


Yes but I am concerned if they redistribute the book (assuming it is freely distributable) with modified
weights. Surely this must happen accidentally as the modified book has the same file name as the original.
Or is there some easy way to verify that a book has modified weights
(without checking every individual position)?
Michel
 
Posts: 513
Joined: 01 Oct 2008, 12:15

Re: Is it possible to delete a move from a Polyglot book?

Postby K Inuen » 17 May 2011, 20:58

Michel wrote:
But it's still up to end users to do as they please with their property.


Yes but I am concerned if they redistribute the book (assuming it is freely distributable) with modified
weights. Surely this must happen accidentally as the modified book has the same file name as the original.
Or is there some easy way to verify that a book has modified weights
(without checking every individual position)?

I'm not sure there is a way to verify if a book distributed is modified. At least not to my knowledge. However, authors who release their books often tune their books; either by hand tuning or playing games versus strong opponents and thus tune their books accordingly via Book learn in Fritz GUI before releasing it.

I guess I'm trying to say a tuned book released by an author is not a problem since it's directly from the author. For example, If I buy a commercial .ctg book and decide I no longer like the lines of the book and tune it personally or enable 'influence of learned play' (aka book learn) in Fritz GUI, this is not a copyright issue since it's a private use. On free public .ctg books, I can tune and/or edit as I please and release it to the public, as long as the tuned or edited lines demonstrates stronger lines/play than the original lines. Polyglot bin books are no exception, especially as the .bin books are not commercialized.
K Inuen
 
Posts: 50
Joined: 27 Apr 2010, 02:25

Re: Is it possible to delete a move from a Polyglot book?

Postby H.G.Muller » 17 May 2011, 22:00

Michel wrote:It is better in the sense that you use pgn-extract to select the interesting games after the fact (e.g. using opponent rating and time control). With the current book learning setup you have no way to select the games you want/don't want. So you have to set up
things in such a way that you only get the correct type of games, which is clearly inconvenient.


Yes, this is true. But in the current framework, you could go a long way in the direction of selecting games by paying attention to the rating of your opponent, in addition to the game result. A loss against a 2000-rated opponent could be made to count heavier against the used opening line than a loss against a 3300-rated opponent, which is merely the expected result. Opening lines (and even individual moves in the lines) can be assigned a rating, just like players can be assigned a rating. ("If you play move A here in stead of B, you will on average score 10% less, so move A loses you 70 Elo compared to B.") So similar methods can be applied to update the value of a move based on game result and rating difference, as the incremental methods for updating player Elo.

There definitely are different methods of learning, and the 'off-line' method surely has merit. But the current learn feature is not needed for that. I think it should be used only for a limited purpose, of adapting the move selection of a program in an automatic way, so that it gets a useful sampling of the possible opening lines. Play those that it likes more, to get better stats on continuations for the lines it likes, and to not play the same line again if there is an alternative. You can then always process the games you collect that way through a more sophisticated off-line method.

This is why I proposed the formula I did (bookWeight * (halfPoints+10)/(plays+1)). It tends to discourage replaying a line that has already been played more often than others initially, until significant statistics on all lines have been obtained, and you can start to faor those which give you the best result. I think that both these aspects are likey to improve the usefulness of the collected games for building a good book.
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Is it possible to delete a move from a Polyglot book?

Postby K Inuen » 23 May 2011, 03:43

Hi there H.G.Muller,

Just a minor concern and I'm not exactly sure if it's significant.

The BookTreshold option in my .ini files is BookTreshold=5.
When using Michel's Polyglot to select Book from Winboard Menu: Engine\Book , this is displayed

Image

Uploaded with ImageShack.us


But when using your Polyglot to view my Book with the same BookTreshold=5, this is displayed

Image

Uploaded with ImageShack.us

But the weight set for these openings are 20% - way above the BookTreshold. Yet it displays that each opening of 20% weight is below treshold 0.50%. Is this suppose to occur with your Polyglot?

Thank you in advance.
K Inuen
 
Posts: 50
Joined: 27 Apr 2010, 02:25

Re: Is it possible to delete a move from a Polyglot book?

Postby H.G.Muller » 23 May 2011, 06:47

Does the book you are viewing contain learn info? What does it say when you open the same position with Edit Book in WinBoard?
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Is it possible to delete a move from a Polyglot book?

Postby K Inuen » 23 May 2011, 06:59

H.G.Muller wrote:Does the book you are viewing contain learn info? What does it say when you open the same position with Edit Book in WinBoard?

The BookLearn feature was enabled; that is BookLearn=true. So yes, I believe my book contains learn info.

I'm not sure if a particular position could have been repeated, so this could be hard to replicate or tell if the learn feature worked here. But when I open Edit Book panel, I get this

Image

Uploaded with ImageShack.us

Unlike the previous caption I showed you, there are no statistics displayed alongside each opening.


EDIT: If it helps, all games played did not repeat itself as per a 'particular position' to determine if Book Learn worked.
K Inuen
 
Posts: 50
Joined: 27 Apr 2010, 02:25

Re: Is it possible to delete a move from a Polyglot book?

Postby H.G.Muller » 23 May 2011, 09:20

OK, it seems this is a simple overflow problem. The learning formula I use when probing is that it multiplies the weights by 10 when all learning stats is at zero, and the book weights are already close to the maximum for a 16-bit quantity. I multiplied the weights by 1000 before summing them, (to minimize rounding effects when multiplying with the learn factor), but the total factor 10000 can easily make the sum of the scaled weights exceed the range of a 32-bit integer. Especially since 'sum' was declared as normal int, rather than unsigned int.

I changed the code to use a 'double' for summing. The corrected version is at http://hgm.nubati.net/polyglot66hgm.zip .
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Is it possible to delete a move from a Polyglot book?

Postby K Inuen » 23 May 2011, 09:40

Thank you so much H.G.Muller.
K Inuen
 
Posts: 50
Joined: 27 Apr 2010, 02:25

Re: Is it possible to delete a move from a Polyglot book?

Postby K Inuen » 23 May 2011, 23:30

H.G.Muller,

I have a proposal regarding book settings and learning.

As or present, Winboard GUI and Polyglot combined have these book features similar to Fritz GUI:

In Winboard GUI:
Use Book
Book Depth ( in Fritz: Up to move)
Book Variation (in Fritz: Variety of play?)


In PolyGlot:
Minimum games (set by default in '-min-game' command line)
Book Depth ('-max-ply' command line)


Currently, Polyglot has fixed settings for book-making. Of concern is the '-min-game' command line.

1. Is it possible to add these within the Winboard GUI's Common Engine Settings panel :

Tournament book, Influence of learn value, Learning strength, Optimize, Normal ?

2. Can you incorporate the -min-game feature (aka Minimum Games in Fritz GUI) in Winboard? This can be used to select number of games one desires to be used in game plays.

To elaborate more on question #2, let's assume you implemented Minimum Game feature in Winboard GUI.
Now I make a bin book with a fixed -min-game 3 from Polyglot. During games, I decided to use games with positions occurring 2 times, that is, -min-game 2 so that in Winboard, Minimum Game can be set to 2. Instead of going through the process of making another bin book with Polyglot's command line -min-game 2, I can simply select (or adjust) from Winboard's Options/Common Engine Setting/Minimum Games the number of games preferred. Since the book used was, by default, made with -min-game 3 which is greater than -min-games 2, the compensation for Minimum Games = 2 that is set in Winboard GUI is guaranteed. Likewise if I decide to use games with positions occurring once, I can adjust this in the GUI.

Provided implementation is not problematic, these may boost performance in bin books and in game play. Even if this doesn't do much for bin books and game play, I would think these features (if added in Winboard) would provide convenience and preferred book adjustments.


Regards,
K I
K Inuen
 
Posts: 50
Joined: 27 Apr 2010, 02:25

Re: Is it possible to delete a move from a Polyglot book?

Postby H.G.Muller » 24 May 2011, 08:04

The Polyglot command-line optons are book-building options, I think. Not book-probing options. So if you specify min-depth=3, it means that moves played less than three times will not be included in the book. WinBoard cannot play moves based on the number of times theyare not in the book, even when it could be instructed to do so.

I consider Polyglot's book-building algorithm seriously flawed anyway.
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Is it possible to delete a move from a Polyglot book?

Postby K Inuen » 24 May 2011, 09:02

H.G.Muller wrote:The Polyglot command-line optons are book-building options, I think. Not book-probing options.


I understand this very much. I guess my suggestion was not worded effectively, so be patient with me as I try again.

In Fritz GUI, there is a book setting option, "Minimum games", in which a user would put in the appropriate number used to make a Ctg book or as specified by a book author. Can this behaviour be mimicked in Winboard? Of course the difference here would be, with Polyglot, the number of games used at initial book-making aka the "-min-game" command is what would be used by Polyglot. We can specify within Winboard's "Minimum Games" (-min-game via Polyglot) to even use a higher Minimum game i.e, -min-game 3 via the Winboard's Minimum Game option without resorting to making a new bin book with -min-game 3.


H.G.Muller wrote:So if you specify min-depth=3, it means that moves played less than three times will not be included in the book.


This I'm aware of too. Looking at my former post, I realize this is where the mistake was made, in which I stated the proposal backwards, in terms of the "number specified" in Minimum Games option.

Let me correct my error and reword it better now;

The proposal is to make Winboard use and play certain repeated positions stored in the bin book. For example, I make a bin book with positions played twice (-min-game=2). This means the book contains positions played 2 times and up (containing moves played 3x, 4x, etc).

With this in mind, If I decide I want my bin book to play positions played 3 times (-min-game=3 in Polyglot command line) without having to make another book, specifically with -min-game=3 command line via polyglot, I can use the provided Winboard option "Minimum Games" to adjust it to 3, since the initial -min-game=2 command line stores positions played or repeated 2x and upward. The Minimum moves would ,in theory, sort book positions that are played according to '3x' or X times specified; where X = # specified but not less than the -min-game "number" when the book was initially made.

Please say this is possible :wink:
K Inuen
 
Posts: 50
Joined: 27 Apr 2010, 02:25

Re: Is it possible to delete a move from a Polyglot book?

Postby H.G.Muller » 24 May 2011, 09:41

It would be possible to have WinBoard reject moves with too small a weight that are in the book. Problem is that the Polyglot book specs do not really guarantee that the weight stored in the book correspond to the number of plays. In fact it does not even when Polyglot builds the book. In that case it corresponds to the number of half-points scored with the move. (Which does cause all kind of inconsistencies in itself, e.g. that a move that scored 1 out of 100 will be preferred by 2:1 over one that scored 0.5 out of 1.) But in hand-tuned books the weight can be anything. E.g. in the performance.bin book the weights for the opening moves 1. e4, d4 and c4 are each 1, to cause them to be played 33% each, but when you would instruct WinBoard to only play moves with weight 3 or higher, it could no longer open e4, d4 and c4 with that book.

The number of plays itself is not stored in the book. So WinBoard could not take decisions basedon it.

Currently,only the relative value of the weights is used. So it would be possible to store extra information in the sum of the weights. Like how many times a position was played, for instance. That would not help for selecting moves from that position, but it would at least make it possible to probe the position after each move, to sum up their weights, and reconstruct how often they were played. That would make probing many times more inefficient as it is now, though. And it would of course not be very useful unless there was softwarethat cold really build books like that.
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Is it possible to delete a move from a Polyglot book?

Postby K Inuen » 25 May 2011, 05:50

By your explanation, I now understand current book-making algorithms of Polyglot in relation to probing and using a move and not storing a move based on frequency. I see your reason why Polyglot's book making might be flawed in this regard, though I'm not condemning it either.

Do you have a better book-making algorithm for Polyglot or can you implement your own book-making algorithm / idea in your Polyglot branch? Probably a special book-making algorithm that can be in sync with Winboard?

If this is possible on your end, I'll be willing to test it and give feedback. Thanks for the explanation and your time.
K Inuen
 
Posts: 50
Joined: 27 Apr 2010, 02:25

Re: Is it possible to delete a move from a Polyglot book?

Postby H.G.Muller » 29 May 2011, 20:01

I have an idea for a more fundamentally correct book-building algorithm, but it is not very simple to implement, as it would require a two-pass building process. First the WDL statistics should be derived from the PGN set, and stored in a temporary book for each move, so that it becomes easy to probe for the statistics of daughter positions. Then the second pass should replace the WDL statistics by weights, based on the weights of the daughter positions in a minimax-like way, through a tree-walk through the book positions.

I am not sure if it makes sense to implement that in Polyglot, though. It is sufficiently different from what Polyglot does now, that the existing infra-structure is not much help. And Polyglot has one very big disadvantage: it can only handle Chess...
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Is it possible to delete a move from a Polyglot book?

Postby matematiko » 29 May 2011, 21:33

H.G.Muller wrote:I have an idea for a more fundamentally correct book-building algorithm, but it is not very simple to implement, as it would require a two-pass building process. First the WDL statistics should be derived from the PGN set, and stored in a temporary book for each move, so that it becomes easy to probe for the statistics of daughter positions. Then the second pass should replace the WDL statistics by weights, based on the weights of the daughter positions in a minimax-like way, through a tree-walk through the book positions.

I am not sure if it makes sense to implement that in Polyglot, though. It is sufficiently different from what Polyglot does now, that the existing infra-structure is not much help. And Polyglot has one very big disadvantage: it can only handle Chess...


Whatever you do regarding this book making algorithm, assuming you decide to go ahead and do it, please please, keep in mind the ability to hand tuning.

Thank you,
One that does not live to serve, does not deserve to live.
matematiko
 
Posts: 219
Joined: 07 Dec 2008, 17:11
Location: Texas

Re: Is it possible to delete a move from a Polyglot book?

Postby K Inuen » 30 May 2011, 07:33

H.G.Muller wrote:I have an idea for a more fundamentally correct book-building algorithm, but it is not very simple to implement, as it would require a two-pass building process. First the WDL statistics should be derived from the PGN set, and stored in a temporary book for each move, so that it becomes easy to probe for the statistics of daughter positions. Then the second pass should replace the WDL statistics by weights, based on the weights of the daughter positions in a minimax-like way, through a tree-walk through the book positions.

I am not sure if it makes sense to implement that in Polyglot, though. It is sufficiently different from what Polyglot does now, that the existing infra-structure is not much help. And Polyglot has one very big disadvantage: it can only handle Chess...


As per Polyglot's current coding or infrastructure, I think one of the best persons to discuss this would be Fabien Letouzey. Maybe it may still be possible to contact him on this through Tord Romstad? Of course this is your prerogative, if you decide to pursue it or not.

Anyway, thanks for all you've done so far on Winboard and your Polyglot. Things have improved significantly. I appreciate these.
K Inuen
 
Posts: 50
Joined: 27 Apr 2010, 02:25

Re: Is it possible to delete a move from a Polyglot book?

Postby H.G.Muller » 30 May 2011, 19:05

matematiko wrote:Whatever you do regarding this book making algorithm, assuming you decide to go ahead and do it, please please, keep in mind the ability to hand tuning.


The WinBoard book editing function is completely independent from the building process. It will workk as long as the book format will not change, and I had no intention to change that. It is just that the weights of the various moves are not derived by Polyglot in a very clever or even rational way. The way I proposed to build a book from a PGN collection is to use the relative playing frequencies of each move (weighted in some way in relation to the Elo rating of the one playing the move) as prior indication for their relative strength. And then use the empirical strength (game results in the leave nodes) together with that prior to estimate the strength of the preceeding move.

What I would do (if I ever get to do anything) is make a separate program to convert a PGN collection into a Polyglot book.
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Is it possible to delete a move from a Polyglot book?

Postby matematiko » 30 May 2011, 22:55

Thanks for the explanation.

In a different but much related note, will you be taking maintainership of Michel's Polyglot fork? Or the whole thing will be "embedded" in WinBoard? Or none of the above?

Regards,
One that does not live to serve, does not deserve to live.
matematiko
 
Posts: 219
Joined: 07 Dec 2008, 17:11
Location: Texas

Previous

Return to Winboard and related Topics

Who is online

Users browsing this forum: No registered users and 25 guests