question about automatic tool to analyze pgn

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

Moderators: hgm, Rebel, chrisw

Uri Blass
Posts: 10282
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

question about automatic tool to analyze pgn

Post by Uri Blass »

I would like to have epd of positions when a player blundered based on pgn of human-human games

My question is if there is an automatic tool to analyze the pgn and generate an epd file of the positions that players blundered based on analysis by some engine like rybka3.

Rybka may analyze every position only to small depth and simply find cases when there is a big difference between the evaluation before the move and evaluation after the move.

Later there should be some automatic checking of the positions to see that the players really blundered based on search to bigger depth.

Note that I do not care about missing part of the blunders that the program need big depth to see but I want at least 99% of the blunders that the program find to be real blunders(of course it is impossible to have 100% because there are positions that programs do not understand like fortress positions so they may consider a move as a blunder regardless of search depth when practically it is not a blunder)

I think that the positions when humans blundered can be used as an exercise for humans who can simply try to find the best move in everyone of the positions when their target is not to blunder.

Uri
genorb

Re: question about automatic tool to analyze pgn

Post by genorb »

With Shredder Classic GUI you can only do that game per game, so it would be long to do it for a large database, since you could not do it overnight (you have to load manually each game). Moreover there is no option to save particular position as epd. I had a look at ChessDB (similar to Scid) but you cannot do that also (at least I didn't find how)...

I know that Arena can save as epd positions where a particular engine made a blunder (when its evaluation drop significantly from a move to the next one) during engine-engine games. But I do not know if you can do it while analysing. I will have a look but I don't think you can do that.

However, it's true that what you ask for would be a very nice tool. I guess it's not that hard to do for programmers... but I am not a programmer...

Regards,

Fabian
genorb

Re: question about automatic tool to analyze pgn

Post by genorb »

I checked that with Arena 1.99 b4, you can analyse a bunch of games in an automatic way. However you cannot set a treshold such as if the difference between the value of the move played and the value of the best move (according to you favorite engine) is larger than this treshold then the program write the variation (or the position etc.). The corrolary of this is then since Arena doesn't work with a treshold, you cannot identify automatically blunders in games. So actually with Arena you can just analyse all moves of a game (or several games), that's it. So Shredder is a sense is better at this but you can do it only game per game...

I guess it would not be difficult at all to implement what you need either in Shredder or in Arena. Perhaps it would be a good idea just to propose this to Stefan Meyer-Kahlen. This is a nice person and it would improve the analysis capabilities of the engine (at least you would get more options). Of course I understand that you need this now and I also understand that perhaps you do not possess Shredder :) [but perhaps Stefan reads this forum...]
Uri Blass
Posts: 10282
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: question about automatic tool to analyze pgn

Post by Uri Blass »

genorb wrote:I checked that with Arena 1.99 b4, you can analyse a bunch of games in an automatic way. However you cannot set a treshold such as if the difference between the value of the move played and the value of the best move (according to you favorite engine) is larger than this treshold then the program write the variation (or the position etc.). The corrolary of this is then since Arena doesn't work with a treshold, you cannot identify automatically blunders in games. So actually with Arena you can just analyse all moves of a game (or several games), that's it. So Shredder is a sense is better at this but you can do it only game per game...

I guess it would not be difficult at all to implement what you need either in Shredder or in Arena. Perhaps it would be a good idea just to propose this to Stefan Meyer-Kahlen. This is a nice person and it would improve the analysis capabilities of the engine (at least you would get more options). Of course I understand that you need this now and I also understand that perhaps you do not possess Shredder :) [but perhaps Stefan reads this forum...]
I have only old version of shredder(shredder9) and I think that it is not something that I specifically needs but something that can be productive for chess players in general.

I think that it is not a good idea to have treshold at specific value of pawns because mistakes that reduce the evaluation from +4.00 pawns to +3.00 pawns are often not important when mistakes that reduce the evaluation from +1.00 pawns to 0.00 pawns are important.

I think that you need to translate pawns to expected results and only save mistakes that change the expected result by at least 20% or something like that.

Uri
genorb

Re: question about automatic tool to analyze pgn

Post by genorb »

Well the GUI could propose both. The GUI could given the line (+evaluation) proposed by the engine whenever the difference between the evaluation of the played move and the one suggested by the engine is larger than a given treshold or could do that only if the evaluation is between given lower and upper value.

So you could choose to report any line (and evaluation) whenever the difference is 50 centipawns for example or report any line whenever the difference is 50 centipawns AND if the evaluation is between -200 and 200 centipawns (+ and - because you can analyse for both colors).
User avatar
Jim Ablett
Posts: 1383
Joined: Fri Jul 14, 2006 7:56 am
Location: London, England
Full name: Jim Ablett

Re: question about automatic tool to analyze pgn

Post by Jim Ablett »

Pgnscanner may be useful to you.

http://www.transversale.fr/pgnscanner/p ... er_eng.htm

Jim.
jdart
Posts: 4366
Joined: Fri Mar 10, 2006 5:23 am
Location: http://www.arasanchess.org

Re: question about automatic tool to analyze pgn

Post by jdart »

I wrote such a tool a while back but it's based on Arasan's search code so it's not pluggable to other engines. I thought about doing a driver for Winboard or UCI but it was too much work, so I shelved it for now.

Also I wasn't really happy with the results. The problem is, you can't analyze every move deeply for a lot of games in reasonable time unless you have some huge compute cluster. So you have to try to minimize search time as you look for critical moves.

I think the most reasonable algorithm would be :
1. skip "book" moves.
2. search shallowly over the remaining moves (but stop when you hit tablebases).
3. if you see eval differ a lot comparing the current position with one a few moves ago (say, 4-5 moves), back up and consider alternatives for that side more deeply, over that move window.

That's not really hard and it would make a nice programming project. I may still do it if I get time. But it is a little complex if you are "arms length" from the search engine (say, through a UCI interface) because I don't think you directly get info like, am I in book or am I in a tablebase win or draw. You could make the driver (analyzer) look that up maybe.
Uri Blass
Posts: 10282
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: question about automatic tool to analyze pgn

Post by Uri Blass »

jdart wrote:I wrote such a tool a while back but it's based on Arasan's search code so it's not pluggable to other engines. I thought about doing a driver for Winboard or UCI but it was too much work, so I shelved it for now.

Also I wasn't really happy with the results. The problem is, you can't analyze every move deeply for a lot of games in reasonable time unless you have some huge compute cluster. So you have to try to minimize search time as you look for critical moves.

I think the most reasonable algorithm would be :
1. skip "book" moves.
2. search shallowly over the remaining moves (but stop when you hit tablebases).
3. if you see eval differ a lot comparing the current position with one a few moves ago (say, 4-5 moves), back up and consider alternatives for that side more deeply, over that move window.

That's not really hard and it would make a nice programming project. I may still do it if I get time. But it is a little complex if you are "arms length" from the search engine (say, through a UCI interface) because I don't think you directly get info like, am I in book or am I in a tablebase win or draw. You could make the driver (analyzer) look that up maybe.
3 in the algorithm suggest that you simply miss the target of my idea.

The target is not to detect deep blunders that happen in comp-comp games but to detect blunder in human-human games.

If the computer does not see the blunder at depth 6 or 7 then I am not interested in the blunder because the target is to give exercises to humans and blunders that the computer detect only at big depth may be often too hard for humans and my target is to train humans to see short tactics fast.

if you need to go 4-5 moves to detect big difference in evaluation and going back a single ply is not enough then I prefer not to have the position in the list of blunders.

Here are few examples
The following positions happened in games between humans who have fide rating above 2100 so I am not talking about blunders of weak human players.

They can be part of an exercise with some hundreds of positions when the target is simply to avoid blunders and I believe that humans who repeat
the exercises again and again may later see better tactics in games.



[D]2k4r/pb1r1pp1/1q2p3/2b3N1/1p4Q1/4P3/PP3PPP/R1B2RK1 w - - 0 19
White played 19.e4?

[D]2R5/pp4k1/3p1Np1/7p/7P/1P1n4/P3q1P1/5R1K w - - 0 43
White played 43.Rg8+?
[D]6R1/pp3k2/3p1Np1/7p/7P/1P1nq3/P5PK/5R2 b - - 0 45
black played 45...Nf2?

Uri
jdart
Posts: 4366
Joined: Fri Mar 10, 2006 5:23 am
Location: http://www.arasanchess.org

Re: question about automatic tool to analyze pgn

Post by jdart »

Shallow blunders are easy and human games are full of them, even IM/GM games.

For this I think you want a different algorithm: move looks good at really shallow ply (maybe 1-2) but is bad at later depths. That removes moves that just drop material immediately.

--Jon
jwes
Posts: 778
Joined: Sat Jul 01, 2006 7:11 am

Re: question about automatic tool to analyze pgn

Post by jwes »

I wrote something like this for crafty. It analyses the position for a short time, and if the eval is significantly worse for the current move than the best move, it analyses for a longer time and if the eval is never better than the margin, it outputs an epd of the position. The two times and the margin are input parameters.