Fehu_algorithmsSourceReinforcement learning algorithms for Fehu.
This library provides production-ready implementations of standard RL algorithms. Each algorithm follows a consistent interface: create an agent with a policy network and configuration, train with learn, and use the trained policy with predict.
Reinforce: Monte Carlo Policy Gradient (REINFORCE)Dqn: Deep Q-Network (DQN)All algorithms follow this pattern:
open Fehu
(* 1. Create policy network *)
let policy_net = Kaun.Layer.sequential [...] in
(* 2. Initialize algorithm *)
let agent = Algorithm.create
~policy_network:policy_net
~n_actions:n
~rng:(Rune.Rng.key 42)
Algorithm.default_config
in
(* 3. Train *)
let agent = Algorithm.learn agent ~env ~total_timesteps:100_000 () in
(* 4. Use trained policy *)
let action = Algorithm.predict agent obs ~training:false |> fstFuture algorithms: