chipiron.players.boardevaluators.neural_networks.output_converters package
Submodules
chipiron.players.boardevaluators.neural_networks.output_converters.factory module
- chipiron.players.boardevaluators.neural_networks.output_converters.factory.create_output_converter(model_output_type: ModelOutputType) OutputValueConverter[source]
chipiron.players.boardevaluators.neural_networks.output_converters.model_output_type module
- class chipiron.players.boardevaluators.neural_networks.output_converters.model_output_type.ModelOutputType(point_of_view: chipiron.players.boardevaluators.board_evaluation.board_evaluation.PointOfView)[source]
Bases:
object- point_of_view: PointOfView
chipiron.players.boardevaluators.neural_networks.output_converters.output_value_converter module
Module for converting the output of the neural network to a board evaluation
- class chipiron.players.boardevaluators.neural_networks.output_converters.output_value_converter.IdentityConverter[source]
Bases:
OutputValueConverterConverting from a NN that outputs a 1D value from the point of view of the player to move
- from_value_white_to_model_output(board_value_white: float, board: IBoard) Tensor[source]
This functions takes the value white and converts to the corresponding value from the NN model output. Remember some NN models output value_from_mover for instance This function is used in training where the value white is compared to taget value from datasets that are float.
- to_board_evaluation(output_nn: Tensor, color_to_play: bool) FloatyBoardEvaluation[source]
Convert the output of the neural network to a board evaluation.
- Parameters:
output_nn (torch.Tensor) – The output of the neural network.
color_to_play (chess.Color) – The color of the player to move.
- Returns:
The converted board evaluation.
- Return type:
- class chipiron.players.boardevaluators.neural_networks.output_converters.output_value_converter.OutputValueConverter[source]
Bases:
ABCConverting an output of the neural network to a board evaluation and conversely converting a board evaluation to an output of the neural network
- abstract from_value_white_to_model_output(board_value_white: float, board: IBoard) Tensor[source]
This functions takes the value white and converts to the corresponding value from the NN model output. Remember some NN models output value_from_mover for instance This function is used in training where the value white is compared to taget value from datasets that are float.
- abstract to_board_evaluation(output_nn: Tensor, color_to_play: bool) FloatyBoardEvaluation[source]
Convert the output of the neural network to a board evaluation.
- Parameters:
output_nn (torch.Tensor) – The output of the neural network.
color_to_play (chess.Color) – The color of the player to move.
- Returns:
The converted board evaluation.
- Return type:
- class chipiron.players.boardevaluators.neural_networks.output_converters.output_value_converter.PlayerToMoveValueToValueWhiteConverter[source]
Bases:
OutputValueConverterConverting from a NN that outputs a 1D value from the point of view of the player to move
- convert_value_from_mover_viewpoint_to_value_white(turn: bool, value_from_mover_view_point: float) float[source]
Convert the value from the mover’s viewpoint to the value from the white player’s viewpoint.
- Parameters:
turn (chess.Color) – The color of the player to move.
value_from_mover_view_point (float) – The value from the mover’s viewpoint.
- Returns:
The value from the white player’s viewpoint.
- Return type:
float
- from_value_white_to_model_output(board_value_white: float, board: IBoard) Tensor[source]
This functions takes the value white and converts to the corresponding value from the NN model output. Remember some NN models output value_from_mover for instance This function is used in training where the value white is compared to taget value from datasets that are float.
- to_board_evaluation(output_nn: Tensor, color_to_play: bool) FloatyBoardEvaluation[source]
Convert the output of the neural network to a board evaluation.
- Parameters:
output_nn (torch.Tensor) – The output of the neural network.
color_to_play (chess.Color) – The color of the player to move.
- Returns:
The converted board evaluation.
- Return type: