One such algorithm, known as REINFORCE [1]}, estimates the gradient as follows.
Given a \(T\) -turn dialog generated by \(\pi (\cdot ;\theta )\) . That is, the system action at every \(t\)  is sampled as \(a_t \sim \pi (s_t;\theta )\)  . Then, a stochastic gradient based on this single dialog is given by
\(\nabla _\theta J(\theta ) = \sum _{t=1}^{T-1} \gamma ^{t-1} \left(\nabla _\theta \log \pi (a_t|s_t;\theta ) \sum _{h=t}^T \gamma ^{h-t}r_h\right)\,.\) 
