Page 1 of 1

BrainLearn Presentation.

Posted: Thu Aug 18, 2022 7:30 pm
by massimilianogoi
BrainLearn is a free, powerful UCI chess engine by Kelly Kinyama and Andrea Manzo derived from BrainFish with the ability to use "learned" patterns stored in an "experience" file. The "learning" algorhitms simulates somewhat the neural networks learning functions. BrainLearn can also use an online Live Book.

UCI parameters
BrainLearn hash the same options as BrainFish, but it implements a persisted learning algorithm, managing a file named experience.bin.

It is a collection of one or more positions stored with the following format (similar to in memory Stockfish Transposition Table):

best move
board signature (hash key)
best move depth
best move score
best move performance , a new parameter you can calculate with any learning application supporting this specification. An example is the private one, kernel of SaaS part of Alpha-Chess AI portal. The idea is to calculate it based on pattern recognition concept. In the portal, you can also exploit the reports of another NLG (virtual trainer) application and buy the products in the digishop based on all this. This open-source part has the performance default. So, it doesn't use it. Clearly, even if already strong, this private learning algorithm is a lot stronger as demostrate here: Graphical result
This file is loaded in an hashtable at the engine load and updated each time the engine receive quit or stop uci command. When BrainLearn starts a new game or when we have max 8 pieces on the chessboard, the learning is activated and the hash table updated each time the engine has a best score at a depth >= 4 PLIES, according to Stockfish aspiration window.

At the engine loading, there is an automatic merge to experience.bin files, if we put the other ones, based on the following convention:

<fileType><qualityIndex>.bin

where

fileType="experience"/"bin"
qualityIndex , an integer, incrementally from 0 on based on the file's quality assigned by the user (0 best quality and so on)
N.B.

Because of disk access, to be effective, the learning must be made at no bullet time controls (less than 5 minutes/game).

Contempt
The default value is 0 and keep it for analysis purpose. For game playing, you can use the default stockfish value 24

Dynamic contempt
Boolean, Default: True For match play, activate it and the engine uses the dynamic contempt. For analysis purpose; keep it at its default, to completely avoid, with contempt settled to 0, the well known rollercoaster effect and align so the engine's score to the gui's informator symbols

Read only learning
Boolean, Default: False If activated, the learning file is only read.

Self Q-learning
Boolean, Default: False If activated, the learning algorithm is the Q-learning, optimized for self play. Some GUIs don't write the experience file in some game's modes because the uci protocol is differently implemented

MonteCarlo Tree Search section (experimental: thanks to original Stephan Nicolet work)
MCTS (checkbox)
Boolean, Default: False If activated, the engine uses the MonteCarlo Tree Search in the manner specified by the following parameters.

MCTSThreads
Integer, Default: 0, Min: 0, Max: 512 The number of settled threads to use for MCTS search except the first (main) one always for alpha-beta search. In particular, if the number is greater than threads number, they will all do a montecarlo tree search, always except the first (main) for alpha-beta search.

Multi Strategy
Integer, Default: 20, Min: 0, Max: 100 Only in multi mcts mode, for tree policy.

Multi MinVisits
Integer, Default: 5, Min: 0, Max: 1000 Only in multi mcts mode, for Upper Confidence Bound.

Live Book section (thanks to Eman's author Khalid Omar for windows builds)
Live Book (checkbox)
Boolean, Default: False If activated, the engine uses the livebook as primary choice.

Live Book URL
The default is the online chessdb, a wonderful project by noobpwnftw (thanks to him!)

https://github.com/noobpwnftw/chessdb

http://talkchess.com/forum3/viewtopic.p ... it=chessdb

The private application can also learn from this live db.

Live Book Timeout
Default 5000, min 0, max 10000 Only for bullet games, use a lower value, for example, 1500.

Live Book Retry
Default 3, min 1, max 100 Max times the engine tries to contribute (if the corresponding option is activated: see below) to the live book. If 0, the engine doesn't use the livebook.

Live Book Diversity
Boolean, Default: False If activated, the engine varies its play, reducing conversely its strength because already the live chessdb is very large.

Live Book Contribute
Boolean, Default: False If activated, the engine sends a move, not in live chessdb, in its queue to be analysed. In this manner, we have a kind of learning cloud.

Live Book Depth
Default 100, min 1, max 100 Depth of live book moves.

Opening variety
Integer, Default: 0, Min: 0, Max: 40 To play different opening lines from default (0), if not from book (see below). Higher variety -> more probable loss of ELO

Concurrent Experience
Boolean, Default: False Set this option to true when running under CuteChess and you experiences problems with concurrency > 1 When this option is true, the saved experience file name will be modified to something like experience-64a4c665c57504a4.bin (64a4c665c57504a4 is random). Each concurrent instance of BrainLearn will have its own experience file name, however, all the concurrent instances will read "experience.bin" at start up.

pgn_to_bl_converter
Converting pgn to brainlearn format is really simple.

Requirements

Download cuteChess gui
Download brainlearn
Download stockfish or equivalent
Download the pgn files you want to convert
In Cute Chess, set a tournament according to the photo in this link: CuteChess Settings

Add the 2 engines (One should be brainlearn)
-start a tournament with brainlearn and any other engine. It will convert all the games in the pgn file and save them to game.bin