GithubHelp home page GithubHelp logo

asdfjkl / neural_network_chess Goto Github PK

View Code? Open in Web Editor NEW
266.0 12.0 27.0 1.97 MB

Free Book about Deep-Learning approaches for Chess (like AlphaZero, Leela Chess Zero and Stockfish NNUE)

Python 100.00%
deep-learning chess nnue alphazero

neural_network_chess's People

Contributors

asdfjkl avatar creedflan738 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

neural_network_chess's Issues

Invalid Reduction Key auto.

Thank you for the source code of Chapter 5.
I executed python mnx_generateTrainingData.py - OK
Then python sup_network.py - OK

Then I executed python sup_eval.py and got the error :

Traceback (most recent call last):
File "sup_eval.py", line 6, in
model = keras.models.load_model("supervised_model.keras")
File "/home/barvinog/anaconda3/lib/python3.7/site-packages/keras/engine/saving.py", line 492, in load_wrapper
return load_function(*args, **kwargs)
File "/home/barvinog/anaconda3/lib/python3.7/site-packages/keras/engine/saving.py", line 584, in load_model
model = _deserialize_model(h5dict, custom_objects, compile)
File "/home/barvinog/anaconda3/lib/python3.7/site-packages/keras/engine/saving.py", line 369, in _deserialize_model
sample_weight_mode=sample_weight_mode)
File "/home/barvinog/anaconda3/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py", line 75, in symbolic_fn_wrapper
return func(*args, **kwargs)
File "/home/barvinog/anaconda3/lib/python3.7/site-packages/keras/engine/training.py", line 229, in compile
self.total_loss = self._prepare_total_loss(masks)
File "/home/barvinog/anaconda3/lib/python3.7/site-packages/keras/engine/training.py", line 692, in _prepare_total_loss
y_true, y_pred, sample_weight=sample_weight)
File "/home/barvinog/anaconda3/lib/python3.7/site-packages/keras/losses.py", line 73, in call
losses, sample_weight, reduction=self.reduction)
File "/home/barvinog/anaconda3/lib/python3.7/site-packages/keras/utils/losses_utils.py", line 156, in compute_weighted_loss
Reduction.validate(reduction)
File "/home/barvinog/anaconda3/lib/python3.7/site-packages/keras/utils/losses_utils.py", line 35, in validate
raise ValueError('Invalid Reduction Key %s.' % key)
ValueError: Invalid Reduction Key auto.

'Board' object has no attribute 'outcome'

I just executed python mcts.py and received an error message:
34
0
Traceback (most recent call last):
File "mcts.py", line 134, in
payout = simulate(node)
File "mcts.py", line 63, in simulate
while(board.outcome(claim_draw = True) == None):
AttributeError: 'Board' object has no attribute 'outcome'

Errata

If you spot mistakes, please leave a note as a reply to this issue.

Chapter 2 convolution.py

Hello Dominik,
I'm a Python novice, but an experienced chess player and long ago a developer of software for infinite dimensional optimization.
I've installed the latest Python on a 64 cores Ryzen Threadripper with two NVIDIA 3090 graphic cards.
I study your very helpful overview of modern chess engine programming and started with Chapter 2 where except convolution.py
all examples work fine.
I have installed module scikit-image as skimage doesn't load correctly.
Then (without changing the source of convolution.py) I get the following warning

PS C:\Users\diete\Downloads\neural_network_chess-1.3\chapter_02> python.exe .\convolution.py
(640, 480)
Lossy conversion from float64 to uint8. Range [-377.0, 433.0]. Convert image to uint8 prior to saving to suppress this warning.
PS C:\Users\diete\Downloads\neural_network_chess-1.3\chapter_02>

and after some seconds python exits without any more output.
Help with this problem is kindly appreciated.
Dieter

pieceSquareTables need to be improved for every material

// pawn
 0,  0,  0,  0,  0,  0,  0,  0,
50, 50, 50, 50, 50, 50, 50, 50,
10, 10, 20, 30, 30, 20, 10, 10,
 5,  5, 10, 25, 25, 10,  5,  5,
 0,  0,  0, 20, 20,  0,  0,  0,
 5, -5,-10,  0,  0,-10, -5,  5,
 5, 10, 10,-20,-20, 10, 10,  5,
 0,  0,  0,  0,  0,  0,  0,  0
// knight
-50,-40,-30,-30,-30,-30,-40,-50,
-40,-20,  0,  0,  0,  0,-20,-40,
-30,  0, 10, 15, 15, 10,  0,-30,
-30,  5, 15, 20, 20, 15,  5,-30,
-30,  0, 15, 20, 20, 15,  0,-30,
-30,  5, 10, 15, 15, 10,  5,-30,
-40,-20,  0,  5,  5,  0,-20,-40,
-50,-40,-30,-30,-30,-30,-40,-50,
// bishop
-20,-10,-10,-10,-10,-10,-10,-20,
-10,  0,  0,  0,  0,  0,  0,-10,
-10,  0,  5, 10, 10,  5,  0,-10,
-10,  5,  5, 10, 10,  5,  5,-10,
-10,  0, 10, 10, 10, 10,  0,-10,
-10, 10, 10, 10, 10, 10, 10,-10,
-10,  5,  0,  0,  0,  0,  5,-10,
-20,-10,-10,-10,-10,-10,-10,-20,
rook
  0,  0,  0,  0,  0,  0,  0,  0,
  5, 10, 10, 10, 10, 10, 10,  5,
 -5,  0,  0,  0,  0,  0,  0, -5,
 -5,  0,  0,  0,  0,  0,  0, -5,
 -5,  0,  0,  0,  0,  0,  0, -5,
 -5,  0,  0,  0,  0,  0,  0, -5,
 -5,  0,  0,  0,  0,  0,  0, -5,
  0,  0,  0,  5,  5,  0,  0,  0
//queen
-20,-10,-10, -5, -5,-10,-10,-20,
-10,  0,  0,  0,  0,  0,  0,-10,
-10,  0,  5,  5,  5,  5,  0,-10,
 -5,  0,  5,  5,  5,  5,  0, -5,
  0,  0,  5,  5,  5,  5,  0, -5,
-10,  5,  5,  5,  5,  5,  0,-10,
-10,  0,  5,  0,  0,  0,  0,-10,
-20,-10,-10, -5, -5,-10,-10,-20
king middle game
-30,-40,-40,-50,-50,-40,-40,-30,
-30,-40,-40,-50,-50,-40,-40,-30,
-30,-40,-40,-50,-50,-40,-40,-30,
-30,-40,-40,-50,-50,-40,-40,-30,
-20,-30,-30,-40,-40,-30,-30,-20,
-10,-20,-20,-20,-20,-20,-20,-10,
 20, 20,  0,  0,  0,  0, 20, 20,
 20, 30, 10,  0,  0, 10, 30, 20
// king end game
-50,-40,-30,-20,-20,-30,-40,-50,
-30,-20,-10,  0,  0,-10,-20,-30,
-30,-10, 20, 30, 30, 20,-10,-30,
-30,-10, 30, 40, 40, 30,-10,-30,
-30,-10, 30, 40, 40, 30,-10,-30,
-30,-10, 20, 30, 30, 20,-10,-30,
-30,-30,  0,  0,  0,  0,-30,-30,
-50,-30,-30,-30,-30,-30,-30,-50

# Tabula Rasa Learning Approach Proposal

Tabula Rasa Learning Approach Proposal

Summary

I propose implementing a "Tabula Rasa" (clean slate) learning approach for our project, where the system starts with minimal prior knowledge and learns from scratch through self-play or self-improvement mechanisms. This approach aims to allow the system to develop its own understanding and strategies organically.

Background

In many AI systems, predefined heuristics, rule-based algorithms, or human-designed features are used to guide the learning or decision-making process. However, alternative approaches, such as "Tabula Rasa," offer the opportunity to build intelligence without initial biases or predefined rules.

Proposal

The idea is to:

  • Create a framework where the system begins with minimal or no initial knowledge.
  • Develop mechanisms for self-play, exploration, or learning from experience.
  • Allow the system to adapt, optimize, and evolve its strategies over time.
  • Potentially discover novel approaches, solutions, or insights that may not be apparent with traditional methods.

Potential Benefits

  • Innovation: This approach may lead to the discovery of unconventional solutions or strategies.
  • Adaptability: The system can adapt to changing conditions or tasks without the need for human intervention.
  • Learning Efficiency: It can potentially learn more efficiently and effectively from experience.

Discussion Points

  • Feasibility: How feasible is it to implement the Tabula Rasa approach within our project's domain?
  • Resource Requirements: What computational resources, data, or infrastructure would be needed?
  • Evaluation Metrics: How do we measure the success and progress of the Tabula Rasa learning process?
  • Use Cases: In what scenarios or domains could this approach be most beneficial?
  • Long-Term Goals: What are the long-term objectives and expected outcomes of implementing Tabula Rasa learning?

Let's discuss the feasibility and potential implementation strategies for this approach in our project.

Where is HexapawnZero code

"from HexapawnZero.common.game import Board"

I've searched for the code and cannot find it.

Thank you for your great work.

Chapter 5

I would like to see the code for Chapter 5. Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.