crocrodile.nn - Neural Network
Crocrodile Neural Network.
Base class for Crocrodile NN.
- class crocrodile.nn.NeuralNetwork[source]
Base class for NN.
- calculate() numpy.ndarray[source]
Calculate NN result by using :attr:NeuralNetwork.layers with multiple layers.
- Returns
Output layer.
- Return type
numpy.ndarray
- generate_inputs(board: str, move: str) bool[source]
Generate inputs for move move in board.
- Parameters
board (str) – FEN of the board.
move (str) – UCI notation of the move to check.
- Returns
False if this is a check, True else.
- Return type
bool
- genetic_train()[source]
Genetic training algorithm.
New training algorithm using a real genetic algorithm.
- load_layers(nn: int) None[source]
Load layers with a NN ID from nns/.
- Parameters
nn (int) – NN to load (nns/<nn>-….csv)
- Returns
Nothing.
- Return type
None
- masters_genetic_train(masters_good_moves, masters_bad_moves, config)[source]
Genetic training algorithm.
New training algorithm using a real genetic algorithm.
- test(list_good_moves: list, list_bad_moves: list) tuple[int][source]
Test neural network. Used by basics training.
- Parameters
list_good_moves (list) – List of good moves at format [“<FEN>n<Good move>”, “<FEN>n<Good move>”]
list_bad_moves (list) – List of bad moves at format [“<FEN>n<Bad move>”, “<FEN>n<Bad move>”]
- Returns
Tupple (Number of correct answers on good moves, Number of correct answers on bad moves)
- Return type
tuple[int]
- test_full(list_good_moves: list, list_bad_moves: list, sub=False, good_moves_data=0, bad_moves_data=0) Tuple[int, int][source]
Test neural network on full files. Lists list_good_moves and list_bad_moves can be obtained from training files with open(“<path>”).read().split(”nn”). Standard format is [“<FEN>n<move>”, “<FEN>n<move>”]
- Parameters
list_good_moves (list) – List of good moves at standard format
list_bad_moves (list) – List of bad moves at standard format
- Returns
Number of correct answers on good moves, on bad moves
- Return type
Tuple[int, int]
- test_full_multiprocesses(list_good_moves: list, list_bad_moves: list) Tuple[int, int][source]
Test neural network on full files with multi-processing. Lists list_good_moves and list_bad_moves can be obtained from training files with open(“<path>”).read().split(”nn”). Standard format is [“<FEN>n<move>”, “<FEN>n<move>”]
- Parameters
list_good_moves (list) – List of good moves at standard format
list_bad_moves (list) – List of bad moves at standard format
- Returns
Number of correct answers on good moves, on bad moves
- Return type
Tuple[int, int]
- test_new(new_good_move: str, new_bad_moves: list) Tuple[int, int][source]
Test neural network on new moves new_good_move and new_bad_moves. Standard format is [“<FEN>n<move>”, “<FEN>n<move>”] Standard format for new_good_move is “<FEN>n<move>”
- Parameters
list_good_moves (list) – The new good move to test at standard format
list_bad_moves (list) – The new bad moves to test at standard format
- Returns
Total number of correct answers on good moves, on bad moves
- Return type
Tuple[int, int]
crocrodile.nn.basics_train - Basics Training
Crocrodile Training.
Back to basics.
- author
Virinas-code and ZeBox
- class crocrodile.nn.basics_train.BasicsTrain[source]
Basics train - class for training Crocrodile.
- Author
@ZeBox and Virinas-code
- ask() dict[source]
Ask for inputs.
- Parameters
self (BasicsTrain) – Current BasicsTrain object.
- Returns
Good moves file.
- Return type
str
- couple(matrix1: numpy.ndarray, matrix2: numpy.ndarray) numpy.ndarray[source]
Couple two matrixes.
- Parameters
matrix1 (numpy.ndarray) – First matrix to couple.
matrix2 (numpy.ndarray) – Second matrix to couple.
- Returns
A new matrix.
- Return type
numpy.ndarray
- couple_networks(worst_network: int, network1: int, network2: int) None[source]
Couple two networks.
- Parameters
network1 (int) – First network indice
network2 (int) – Second network indice.
- Returns
Nothing.
- Return type
None.
- couple_pawns(matrix1: numpy.ndarray, matrix2: numpy.ndarray) numpy.ndarray[source]
Couple two pawn matrixes.
- Parameters
matrix1 (numpy.ndarray) – First matrix to couple.
matrix2 (numpy.ndarray) – Second matrix to couple.
- Returns
A new matrix.
- Return type
numpy.ndarray
- couple_pieces(matrix1: numpy.ndarray, matrix2: numpy.ndarray) numpy.ndarray[source]
Couple two pieces matrixes.
- Parameters
matrix1 (numpy.ndarray) – First matrix to couple.
matrix2 (numpy.ndarray) – Second matrix to couple.
- Returns
A new matrix.
- Return type
numpy.ndarray
- static generate_bad_moves(good_move_pos: str, good_moves_list, bad_moves_list)[source]
Generate bad moves for position.
- Parameters
good_move_pos (str) – Good move in position (FEN + good move)
crocrodile.nn.load_network - Load Network
Crocrodile NNs.
Load network: Load network to use it with the client.
crocrodile.nn.masters_train - Masters Training
crocrodile.nn.nn_auto - Auto Neural Network Training
NN Auto.
Simple tool to create Crocrodile NN Training files.