This chapter applied DTs to learn weapon selection. We actually had the luxury of being able to apply DTs to this problem in many different ways:
Classification trees can learn the most appropriate weapon in each situation.
Regression trees can estimate the fitness of weapons as a whole.
Regression trees can estimate the different properties of weapons in practice.
Regression trees can predict the weight of the votes for each feature depending on the situation.
We opted for the second option: estimating the overall fitness of the weapon, because it provides more challenges and reduces the need for external code. Then we drafted the interfaces for a modular DT, both runtime and initialization:
The data used for initialization is left high level, only describing the variables types and ranges used during the prediction.
The runtime interfaces are very similar to those used for the perceptron, with functionality for simulation and both varieties of training. The main difference is that any types of input variables are accepted.
The implementation itself is quite challenging to handle when multiple attributes types are possible:
Three data types are required: attributes, decisions, and nodes. Each class depends on the one before.
The implementation for incremental learning is done by storing the samples and updating the tree only if necessary.
In the application phase, we identified some key tasks:
Gathering the information from the fight episode takes the most time for the implementation.
When analyzing the data gathered, some trends arise as expected. However, the errors in the aiming need to be made even more dependent on the context (for instance, subject to movement, direction of travel) for the weapon decisions to be humanlike.
Because the DT is supervised, the result must be computed to train the DT. This involves using a very simple function to compute the weapon's desired fitness.
The system performs well enough, and imposing timing restrictions (as with the voting system) also helps reduce idiosyncrasies. The advantage of the DTs is that the performance of the weapon in the game is learned, subject to individual skill and preferences—rather than objective statistics. On the down side, there is a lot of work needed to set up the DT, notably gathering the data and computing an example that the algorithm can learn.
Part V moves away from supervised techniques. Techniques such as genetic algorithms have the advantage of being directed by a very high-level fitness function, rather than individual examples. Before the next part, however, there's a lesson in the next chapter about understanding AI solutions in general, which provides guidance for the design of all AI systems.