I am making a fighting game AI that can predict the player's next move using a N gram predictor. Once I have the prediction, when do I use it ? Do I wait till player makes a move and then use the prediction ? What about distance from the player ? How do I make the use of my prediction look realistic ?
In that type of game the time frame is an important variable to consider, because the attacks/defenses must be well synchronized to be effective. I bet that is indeed one reason you've chosen to use that kind of predictor (i.e. based on continuous sequences). Even more, the decision about taking one countermeasure must be done based on the chances of the opponent taking a particular measure, and thus eventual errors (i.e. the NPC tried to block a strike that the opponent DIDN'T perform) make the result to look more realistic. Therefore, your prediction should be performed at the NPC's own agenda and in a time-based fashion (i.e. inside the game loop, whenever possible to avoid consuming too much processing power).
Just like the "moment" to take an action, the distance between NPC and opponent and the fighter's abilities are important variables. The predictor needs to consider the minimum distance in which either (NPC or opponent) can strike a punch or a special power, and the type of action taken also depend upon that. For instance, close blows usually require blocking and ranged shots can be avoided bu jumping over or counter attacking with a similar power/weapon.
In my experience, in game domains - and depending on the complexity desired, simple state machines or decision trees are useful and usually allow to achieve very good results without consuming too much computing resources.