Skip to content
Charlie Ringer edited this page Apr 28, 2017 · 11 revisions

Description:

The model is where a network is train in understand which game state are good and which are bad. To use is fairly straight forward. Create an empty model (using the default settings or your own). Then train it by setting a number of games per training episode, a number of episode and a function which creates an new AIState.

Model model = new Model("DefaultSettings.xml");
model.train(games_per_episode, episodes, () => new CustomAIState());

Then, using the outputted .model file create an Model with that file and pass it to the various AIAgents that require it.

Constructors:

Name Description
Model() Constructs an empty model using the default settings.
Model(string file) If a settings file is passed in (anything that ends in .xml) it constructs an empty model using the supplied settings. If a .model file is passed in it it constructs a model using the weights in the file and the default settings
Model(string modelfile, string settingsFile) Constructs a model using the supplied settings and model file

Methods:

Return Type Name Description
int train(int gamesPerEpisode, int episodes, StateCreator sc)
  • sc must be a function which return an AIState and this AIState should represent the beginning of a game.
  • gamesPerEpisode is the number of games run per episode
  • episodes is the number of episodes run in order to train the network.
Returns -1 if the training failed in someway and 1 if it was successful.

The .model file

When training is complete a .model file will created (named with the same time and date as it's creation). These .model files contain all of the weights that were trained and is then to reconstruct the network when it comes time to use the network to evaluate states during run time.

Clone this wiki locally