NRN Agents Docs
  • Overview
    • Introduction
    • Installation & Setup
  • Admin
    • Overview
    • Model Architectures
    • Register
    • Unregister
  • Getting Started
    • Basic Integration
    • State Space
    • Action Space
    • Data Collection
    • Model Initialization
    • Inference
Powered by GitBook
On this page
Export as PDF
  1. Getting Started

Inference

PreviousModel Initialization

Last updated 5 months ago

In order to actually use the model in game, we need to perform inference. This means that we give the model a state matrix, and have it output an action.

For most use cases, it is appropriate to use the "select action" method. This will create a mapping which can then be used, via the action space conversion mention in , to execute the action in-game.

Alternatively, we allow game studios to access the "raw output", which is the probabilities of taking each of the actions in that state. The NRN Agents SDK comes with a Probabilistic Agent Wrapper that handles the distribution, but if game studios want more flexibility in building a custom wrapper, they are able to do this as well.

// Sample from the distribution to select an action
const action = agent.selectAction(state);

// Get the probability distribution over actions
const probabilities = agent.getProbabilities(state);
// Sample from the distribution to select an action
Dictionary<string, bool> action = Agent.SelectAction(state);

// Sample from the distribution to select an action
Dictionary<string, Matrix> probabilities = Agent.GetProbabilities(state);
this section