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.
- Renvoie
Output layer.
- Type renvoyé
numpy.ndarray
-
check_move_with_transpos
(board: str, move: str) → bool[source]¶ Check a move with transposition.
Generate inputs, calculate and return output.
- Paramètres
board (str) – FEN of the board to check.
move (str) – Move who will be played.
- Renvoie
Wether if move is interesting or not.
- Type renvoyé
bool
-
generate_inputs
(board: str, move: str) → bool[source]¶ Generate inputs for move move in board.
- Paramètres
board (str) – FEN of the board.
move (str) – UCI notation of the move to check.
- Renvoie
False if this is a check, True else.
- Type renvoyé
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/.
- Paramètres
nn (int) – NN to load (nns/<nn>-….csv)
- Renvoie
Nothing.
- Type renvoyé
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[source]¶ Test neural network. Used by basics training.
- Paramètres
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> »]
- Renvoie
Tupple (Number of correct answers on good moves, Number of correct answers on bad moves)
- Type renvoyé
tuple[int]
-
test_full
()[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> »]
- Paramètres
list_good_moves (list) – List of good moves at standard format
list_bad_moves (list) – List of bad moves at standard format
- Renvoie
Number of correct answers on good moves, on bad moves
- Type renvoyé
Tuple[int, int]
-
test_full_multiprocesses
()[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> »]
- Paramètres
list_good_moves (list) – List of good moves at standard format
list_bad_moves (list) – List of bad moves at standard format
- Renvoie
Number of correct answers on good moves, on bad moves
- Type renvoyé
Tuple[int, int]
-
test_new
()[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> »
- Paramètres
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
- Renvoie
Total number of correct answers on good moves, on bad moves
- Type renvoyé
Tuple[int, int]
-
train_settings
= None¶ - self.train_good = (
- open(self.genetic_train_settings[« train_good »]).read().split(
«
- « )
) self.train_bad = (
open(self.genetic_train_settings[« train_bad »]).read().split( »
- « )
) self.test_good = (
open(self.genetic_train_settings[« test_good »]).read().split( »
- « )
) self.test_bad = (
open(self.genetic_train_settings[« test_bad »]).read().split( »
- « )
)
-
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.
- Paramètres
self (BasicsTrain) – Current BasicsTrain object.
- Renvoie
Good moves file.
- Type renvoyé
str
-
couple
(matrix1: numpy.ndarray, matrix2: numpy.ndarray) → numpy.ndarray[source]¶ Couple two matrixes.
- Paramètres
matrix1 (numpy.ndarray) – First matrix to couple.
matrix2 (numpy.ndarray) – Second matrix to couple.
- Renvoie
A new matrix.
- Type renvoyé
numpy.ndarray
-
couple_networks
(worst_network: int, network1: int, network2: int) → None[source]¶ Couple two networks.
- Paramètres
network1 (int) – First network indice
network2 (int) – Second network indice.
- Renvoie
Nothing.
- Type renvoyé
None.
-
couple_pawns
(matrix1: numpy.ndarray, matrix2: numpy.ndarray) → numpy.ndarray[source]¶ Couple two pawn matrixes.
- Paramètres
matrix1 (numpy.ndarray) – First matrix to couple.
matrix2 (numpy.ndarray) – Second matrix to couple.
- Renvoie
A new matrix.
- Type renvoyé
numpy.ndarray
-
couple_pieces
(matrix1: numpy.ndarray, matrix2: numpy.ndarray) → numpy.ndarray[source]¶ Couple two pieces matrixes.
- Paramètres
matrix1 (numpy.ndarray) – First matrix to couple.
matrix2 (numpy.ndarray) – Second matrix to couple.
- Renvoie
A new matrix.
- Type renvoyé
numpy.ndarray
-
static
generate_bad_moves
(good_move_pos: str, good_moves_list, bad_moves_list)[source]¶ Generate bad moves for position.
- Paramètres
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.