Git Product home page Git Product logo

alphazero's Introduction

Board Game Reinforcement Learning ที่อ้างอิงจาก AlphaZero ของ Deepmind

เกม

  • หมากฮอส (Makhos / Thai Checkers)
  • โอเทลโล่ (Othello / Reversi)
  • Connect Four
  • โอ-เอ็กซ์ (Tic-tac-toe)

วิธีใช้งาน

ความต้องการ

  • Python 2.7+ หรือ Python 3.6+
  • Keras 2.1+
  • Tensorflow

Setup

pip install -r requirements.txt

ลองเล่นกับ pretrained model

python run.py arena makhos human mcts,data/makhos/model-45k.h5,1000

สร้าง Model

python run.py newmodel <game> model.h5

Self-play

เล่นกับตัวเอง 5,000 เกม โดยแต่ละตาที่เดินมีการซิมมูเลชั่น 100 ครั้ง และเซฟข้อมูลเกมลงไฟล์ selfplay.txt

python run.py generate <game> --model model.h5 --simulation 100 -n 5000 --file selfplay.txt --progress

Training

ทำการเทรนโมเดล model.h5 ด้วยไฟล์ข้อมูล selfplay.txt จำนวน 3 epochs และเซฟใส่ newmodel.h5

python run.py train <game> selfplay.txt model.h5 newmodel.h5 --epoch 3 --progress

ทดสอบ

python run.py arena <game> <player1> <player2>

โดยที่

  • game มีค่าเป็น makhos, othello, c4, ox
  • player1 และ player2 มีค่าเป็น
    • human เลือกตาเดินจากคีย์บอร์ด
    • mcts,model.h5,1000 เลือกตาเดนถัดไปโดยใช้ policy network + value network จาก model.h5 และใช้ MCTS ที่มีจำนวนซิมมูเลชั่น 1,000 ครั้ง
    • policy,model.h5 เลือกตาเดินโดยใช้แต่ policy network ของ model.h5

alphazero's People

Contributors

witchu avatar

Watchers

James Cloos avatar

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.