IRLAgent<T>
Interfaces · AiDotNet.Interfaces
Marker interface for reinforcement learning agents that integrate with AiModelBuilder.
Implements: IFeatureAware, IFullModel<T, Vector<T>, Vector<T>>
Known implementations: ReinforcementLearningAgentBase<T>
For Beginners
An RL agent is just a special kind of model that learns through interaction with an environment. By implementing IFullModel, RL agents work with all of AiDotNet’s existing infrastructure:
- They can be saved and loaded
- They work with the AiModelBuilder pattern
- They support serialization, cloning, etc.
The key difference is how they’re trained:
- Regular models: trained on fixed datasets (x, y)
- RL agents: trained by interacting with environments and getting rewards
How It Works
This interface extends IFullModel to ensure RL agents integrate seamlessly with AiDotNet’s existing architecture. RL agents are models where:
- TInput = Tensor
(state observations, though often flattened to Vector in practice) - TOutput = Vector
(actions)
Methods
| Method | Summary |
|---|---|
Dictionary<string, T> GetMetrics() |
Gets current training metrics. |
T Train() |
Performs one training step using stored experiences. |
Vector<T> SelectAction(Vector<T> state, bool explore) |
Selects an action given the current state observation. |
void ResetEpisode() |
Resets episode-specific state (if any). |
void StoreExperience(Vector<T> state, Vector<T> action, T reward, Vector<T> nextState, bool done) |
Stores an experience tuple for later learning. |
void StoreExperience(Vector<T> state, Vector<T> action, T reward, Vector<T> nextState, bool terminated, bool truncated) |
Stores an experience tuple, telling termination apart from truncation. |