Skip to content

Latest commit

 

History

History
55 lines (47 loc) · 2.02 KB

README.md

File metadata and controls

55 lines (47 loc) · 2.02 KB

Machine Learning

Creating an AI to play Blackjack.

Setup

This requires an older version of XGBoost (version 0.90). Make sure to uninstall any existing version of XGBoost, then:

pip install xgboost==0.90

Creating training data

Flags:

  • -generate-training-data: Add to generate training data.
  • -training-data-file: Add to specify a training data output file.

This script will generate a large set of training data using AI players:

./machine/scripts/generate_training_data.sh

Training model

This script will use the converted training data to train a model:

./machine/scripts/train_model.sh

Running simulation

This script will run several iterations of the blackjack game with the machine ai:

./machine/scripts/run_simulation.sh

Results

Not too shabby for a first pass. Marvin is the player using the trained model.

Larry (*ai.Random)
  Win: 313 (%31.3) | Loss: 641 (%64.1) | Tie: 46 (%4.6) | $-4497.50
Joe (*ai.Standard)
  Win: 439 (%42.8) | Loss: 507 (%49.5) | Tie: 79 (%7.7) | $-65.00
Marvin (*ai.Machine)
  Win: 429 (%41.6) | Loss: 534 (%51.8) | Tie: 68 (%6.6) | $-1100.00

Training model with AWS SageMaker

Go packages