Training

Training algorithms for Crocrodile NN.

Basics

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

static array_to_csv(array, csv_path)[source]

Write array in csv_path CSV file.

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

generate() → None[source]

Generate empty networks and save them.

Renvoie

None

Type renvoyé

None

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)

load() → None[source]

Load neural networks from nns/ folder.

Renvoie

None

main(argv)[source]

Start training.

static parse_good_moves(good_moves_file: str) → list[source]

Parse good moves in good_moves_file. good_moves_file is only a file path.

Paramètres

good_moves_file (str) – Path to the good moves file.

Renvoie

The list of FENs + good move.

Type renvoyé

list

save() → None[source]

Save neural networks to nns/ folder.

Renvoie

None

train(new_good_move: str, new_bad_moves: str, param_good_moves: list, param_bad_moves: list) → float[source]

Train neural networks.

Renvoie

Mean performance at end.

Type renvoyé

float

crocrodile.nn.basics_train.main(argv)[source]

Start function called in init.

Paramètres

argv (list) – sys.argv

Renvoie

None

Type renvoyé

None