API 2.1.1. NeuralDualDice - Reinforcement-Learning-TU-Vienna/dice_rl_TU_Vienna GitHub Wiki
NeuralDualDice
estimates the policy value NeuralDice
, but overrides all the necessary base methods.
Unlike NeuralGenDice
and NeuralGradientDice
, NeuralDualDice
only supports the discounted case, i.e.,
Fenchel-Rockefeller duality is applied to the primal DualDICE objective from TabularDualDice
, to yield the dual DualDICE objective:
The loss term
The optimization problem in DualDICE alternates between maximizing
For further details, refer to the original paper: DualDICE: Behavior-Agnostic Estimation of Discounted Stationary Distribution Corrections
def __init__(
self,
gamma, p, seed, batch_size,
learning_rate, hidden_dimensions,
obs_min, obs_max, n_act, obs_shape,
dataset, preprocess_obs=None, preprocess_act=None, preprocess_rew=None,
dir=None, get_recordings=None, other_hyperparameters=None, save_interval=100):
Args:
- All the arguments of
NeuralDice
. -
p
(float): Regularization function exponent$p$ .
def get_loss(self, v_init, v, v_next, w):
Overrides the base class get_loss
to compute the dual DualDICE objective.
from some_module import NeuralDualDice
estimator = NeuralDualDice(
gamma=0.99,
p=2.0,
seed=0,
batch_size=64,
learning_rate=1e-3,
hidden_dimensions=(64, 64),
obs_min=obs_min,
obs_max=obs_max,
n_act=4,
obs_shape=(8,),
dataset=df,
dir="./logs"
)
estimator.evaluate_loop(n_steps=10_000)
rho_hat = estimator.solve_pv(weighted=True)