Answers.Body: <blockquote>
    <p>In deep reinforcement learning for portfolio optimization, many researchers (Xiong at al. for example) use historical market data for model training. The resulting MDP dynamics is of course completely deterministic (if historical prices are used as states) and there's no real sequentiality involved.</p>
  </blockquote>
  
  <p>Whilst I cannot comment on the specific financial model, I think it unlikely that these researchers would apply RL without there being a sequence. </p>
  
  <p>More likely in my opinion, the historic data feed forms a major part of the environment, but that there are still time steps and a state which depends on an agent's actions. For instance, in a trading simulation, provided the values of trades are below levels that would significantly alter the market itself, it may be a reasonable approximation to use the history of prices and other factual information that progress like a recording, plus have state include the agent's current portfolio of investment and working funds. </p>
  
  <blockquote>
    <p>What's the point of using DDPG for variance reduction when the underlying MDP used for training has deterministic dynamics? Why not simply use the Reinforce algorithm?</p>
  </blockquote>
  
  <p>Variance in returns occurs due to stochastic dynamics (if they are present) <em>and</em> the behaviour policy. You cannot use any RL <em>control</em> algorithm with a deterministic behaviour policy*. It would never gain any data that allowed it to assess alternative behaviour.</p>
  
  <p>So in REINFORCE, which is on-policy (the behaviour policy and target policy are the same), and typically starts with near equiprobable action choices, there is high variance. It could be very high when measured over a long episode with many action choices. In basic REINFORCE, the variance is not controlled for, and training uses individual Monte Carlo style returns.</p>
  
  <p>In DDPG, which is off-policy (the target policy is deterministic**, the behaviour policy is stochastic), there is still variance, but it is much reduced with the actor-critic mechanism, plus can be constrained by choice of noise function that relates the behaviour policy to the target policy. In addition, updates to policy and value functions can be made independently of episode ends, which can significantly speed up learning.</p>
  
  <p>To determine what difference this makes for any experiment, you would need to compare the two algorithms on the same task. In practice DDPG will significantly out-perform REINFORCE on many tasks, including those with deterministic environments. However, there might be specific combinations where the simplicity of REINFORCE wins out, if only because there are less hyperparameters to tune.</p>
  
  <p>On one point:</p>
  
  <blockquote>
    <p>under an almost-deterministic policy our variance will be quite small</p>
  </blockquote>
  
  <p>That's true, but how do you get to that stage of training with REINFORCE? It is by testing and working through more stochastic policies, which is what will take time. Your statement only applies to REINFORCE when the control problem is nearly complete, or if you take a short-cut and force the policy function into <em>what you hope</em> is a near-optimal policy. In which case you are engaging in a form of variance reduction - it may even work for some scenarios, but is likely not as general as applying an Actor-Critic algoirthm.</p>
  
  <hr>
  
  <p>* Actually technically you can if the environment is stochastic in the right way so that you effectively explore all state/action combinations. But we are talking about deterministic environments here, and obviously the stochastic environment would introduce variance in returns.</p>
  
  <p>** The target policy changes over time, and this introduces non-stationarity and bias for the critic component to deal with, but not technically variance.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-13T12:36:42.913Z
Answers.Text: "plus have state include the agent's current portfolio of investment and working funds."
  
  Yes, this is a common way of (in my opinion artificially) introducing sequentiality (in a sense that now an action at time t will affect the state at time t+1). However, if we ignore the trading costs (which is commonly done in many papers), the optimal action at time t+1 will clearly NOT depend on the part of the state at time t+1 that represents current portfolio weights (as one should invest in stocks that will grow in the future no matter what the current portfolio weights are).
Answers.UserDisplayName: BGa
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-13T12:39:47.920Z
Answers.Text: @BGa: I cannot really comment further on the stock trading scenario, I don't know it well enough. I hope the rest of my answer explains why DDPG would be preferred over REINFORCE for deterministic environments.
Answers.UserDisplayName: Neil Slater
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-13T12:41:50.940Z
Answers.Text: "That's true, but how do you get to that stage of training with REINFORCE?"
  
  Why can't I simply start out with a stochastic Gaussian policy with a very small variance, and then adjust its mean while learning but keep the variance fixed.
Answers.UserDisplayName: BGa
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-13T12:44:18.150Z
Answers.Text: @BGa: You can, and this is also a form of variance reduction (I just added a sentence to that effect). However, you may limit exploration too much by doing so, and the more complex algorithms have more general mechanisms to cope.
Answers.UserDisplayName: Neil Slater
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-13T12:51:27.597Z
Answers.Text: OK, clear now, thanks. But another thing just crossed my mind. Let's forget about REINFORCE for a moment. Why is DDPG preferred over simply having a NN (which represents a policy) output a deterministic action, calculating the loss function for this policy  (say negative Sharpe ratio or whatever) and simply using the gradient descent to find optimal parameters of the NN? This way we don't have to deal with either stochastic policies or the intricacies of actor-critic approaches.
Answers.UserDisplayName: BGa
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-13T12:57:31.483Z
Answers.Text: @BGa: In brief because you have no ground truth of the correctness of the action. Actually many RL algorithms can be viewed as "wrappers" around NNs that generate training data as you suggest - very easy to see in something like DQN. Alternatively, you can think of the NN as the simple part of this, and the RL design as more critical. A really simple RL-ish algorithm that does what you suggest and is quite good in deterministic environments is Cross Entropy Method (CEM) which collects its data from "elite" episodes for training
Answers.UserDisplayName: Neil Slater
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-13T12:18:24.023Z
Answers.LastActivityDate: 2019-11-13T12:42:27.143Z
Answers.LastEditDate: 2019-11-13T12:42:27.143Z
Answers.UserDisplayName: Neil Slater
Body: <p>One of the main disadvantages of the MC Policy Gradient algorithm (REINFORCE) as described say <a href="http://www0.cs.ucl.ac.uk/staff/d.silver/web/Teaching_files/pg.pdf" rel="nofollow noreferrer">here</a> is the fact that it has high variance (returns, which we sample, will significantly vary from episode to episode). Therefore it is perfectly reasonable to use a critic to reduce variance and this is what for example Deep Deterministic Policy Gradient (<a href="https://arxiv.org/abs/1509.02971" rel="nofollow noreferrer">DDPG)</a> does.</p>
  
  <p>Now, let's assume that we're given an MDP with completely deterministic dynamics. In that case, if we start from a specific state and follow a certain deterministic policy we will always obtain the exact same return (therefore we have zero bias and zero variance). If we follow a certain stochastic policy the return will vary depending on how much we explore, but under an almost-deterministic policy our variance will be quite small. In any case, there's no contribution to the variance from the deterministic MDP dynamics.</p>
  
  <p>In deep reinforcement learning for portfolio optimization, many researchers (<a href="https://arxiv.org/pdf/1811.07522.pdf" rel="nofollow noreferrer">Xiong at al. for example</a>) use historical market data for model training. The resulting MDP dynamics is of course completely deterministic (if historical prices are used as states) and there's no real sequentiality involved. Consequently, all return variance stems from the stochasticity of the policy itself. However, most researchers still use DDPG as a variance reduction mechanism. </p>
  
  <p><strong>What's the point of using DDPG for variance reduction when the underlying MDP used for training has deterministic dynamics? Why not simply use the Reinforce algorithm?</strong></p>
  
Tags: <reinforcement-learning><deep-rl><policy-gradients><reinforce><ddpg>
Title: Purpose of using actor-critic algorithms under deterministic MDP dynamics?
UserDisplayName: BGa
ThreadText: # Purpose of using actor-critic algorithms under deterministic MDP dynamics?
  
  (Asked by: username_0 on 2019-11-12)
  
  One of the main disadvantages of the MC Policy Gradient algorithm (REINFORCE) as described say [here](http://www0.cs.ucl.ac.uk/staff/d.silver/web/Teaching_files/pg.pdf) is the fact that it has high variance (returns, which we sample, will significantly vary from episode to episode). Therefore it is perfectly reasonable to use a critic to reduce variance and this is what for example Deep Deterministic Policy Gradient ([DDPG)](https://arxiv.org/abs/1509.02971) does.
  
  Now, let's assume that we're given an MDP with completely deterministic dynamics. In that case, if we start from a specific state and follow a certain deterministic policy we will always obtain the exact same return (therefore we have zero bias and zero variance). If we follow a certain stochastic policy the return will vary depending on how much we explore, but under an almost-deterministic policy our variance will be quite small. In any case, there's no contribution to the variance from the deterministic MDP dynamics.
  
  In deep reinforcement learning for portfolio optimization, many researchers ([Xiong at al. for example](https://arxiv.org/pdf/1811.07522.pdf)) use historical market data for model training. The resulting MDP dynamics is of course completely deterministic (if historical prices are used as states) and there's no real sequentiality involved. Consequently, all return variance stems from the stochasticity of the policy itself. However, most researchers still use DDPG as a variance reduction mechanism.
  
  **What's the point of using DDPG for variance reduction when the underlying MDP used for training has deterministic dynamics? Why not simply use the Reinforce algorithm?**
  
  **Tags:** reinforcement-learning, deep-rl, policy-gradients, reinforce, ddpg
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-11-13. Score: 1
  
  > In deep reinforcement learning for portfolio optimization, many researchers (Xiong at al. for example) use historical market data for model training. The resulting MDP dynamics is of course completely deterministic (if historical prices are used as states) and there's no real sequentiality involved.
  
  Whilst I cannot comment on the specific financial model, I think it unlikely that these researchers would apply RL without there being a sequence.
  
  More likely in my opinion, the historic data feed forms a major part of the environment, but that there are still time steps and a state which depends on an agent's actions. For instance, in a trading simulation, provided the values of trades are below levels that would significantly alter the market itself, it may be a reasonable approximation to use the history of prices and other factual information that progress like a recording, plus have state include the agent's current portfolio of investment and working funds.
  
  > What's the point of using DDPG for variance reduction when the underlying MDP used for training has deterministic dynamics? Why not simply use the Reinforce algorithm?
  
  Variance in returns occurs due to stochastic dynamics (if they are present) *and* the behaviour policy. You cannot use any RL *control* algorithm with a deterministic behaviour policy\*. It would never gain any data that allowed it to assess alternative behaviour.
  
  So in REINFORCE, which is on-policy (the behaviour policy and target policy are the same), and typically starts with near equiprobable action choices, there is high variance. It could be very high when measured over a long episode with many action choices. In basic REINFORCE, the variance is not controlled for, and training uses individual Monte Carlo style returns.
  
  In DDPG, which is off-policy (the target policy is deterministic\*\*, the behaviour policy is stochastic), there is still variance, but it is much reduced with the actor-critic mechanism, plus can be constrained by choice of noise function that relates the behaviour policy to the target policy. In addition, updates to policy and value functions can be made independently of episode ends, which can significantly speed up learning.
  
  To determine what difference this makes for any experiment, you would need to compare the two algorithms on the same task. In practice DDPG will significantly out-perform REINFORCE on many tasks, including those with deterministic environments. However, there might be specific combinations where the simplicity of REINFORCE wins out, if only because there are less hyperparameters to tune.
  
  On one point:
  
  > under an almost-deterministic policy our variance will be quite small
  
  That's true, but how do you get to that stage of training with REINFORCE? It is by testing and working through more stochastic policies, which is what will take time. Your statement only applies to REINFORCE when the control problem is nearly complete, or if you take a short-cut and force the policy function into *what you hope* is a near-optimal policy. In which case you are engaging in a form of variance reduction - it may even work for some scenarios, but is likely not as general as applying an Actor-Critic algoirthm.
  
  ---
  
  \* Actually technically you can if the environment is stochastic in the right way so that you effectively explore all state/action combinations. But we are talking about deterministic environments here, and obviously the stochastic environment would introduce variance in returns.
  
  \*\* The target policy changes over time, and this introduces non-stationarity and bias for the critic component to deal with, but not technically variance.
  
  > **Comments:**
  > **username_0**: "plus have state include the agent's current portfolio of investment and working funds."  Yes, this is a common way of (in my opinion artificially) introducing sequentiality (in a sense that now an action at time t will affect the state at time t+1). However, if we ignore the trading costs (which is commonly done in many papers), the optimal action at time t+1 will clearly NOT depend on the part of the state at time t+1 that represents current portfolio weights (as one should invest in stocks that will grow in the future no matter what the current portfolio weights are).  
  > **username_1**: @username_0: I cannot really comment further on the stock trading scenario, I don't know it well enough. I hope the rest of my answer explains why DDPG would be preferred over REINFORCE for deterministic environments.  
  > **username_0**: "That's true, but how do you get to that stage of training with REINFORCE?"  Why can't I simply start out with a stochastic Gaussian policy with a very small variance, and then adjust its mean while learning but keep the variance fixed.  
  > **username_1**: @username_0: You can, and this is also a form of variance reduction (I just added a sentence to that effect). However, you may limit exploration too much by doing so, and the more complex algorithms have more general mechanisms to cope.  
  > **username_0**: OK, clear now, thanks. But another thing just crossed my mind. Let's forget about REINFORCE for a moment. Why is DDPG preferred over simply having a NN (which represents a policy) output a deterministic action, calculating the loss function for this policy  (say negative Sharpe ratio or whatever) and simply using the gradient descent to find optimal parameters of the NN? This way we don't have to deal with either stochastic policies or the intricacies of actor-critic approaches.  
  > **username_1**: @username_0: In brief because you have no ground truth of the correctness of the action. Actually many RL algorithms can be viewed as "wrappers" around NNs that generate training data as you suggest - very easy to see in something like DQN. Alternatively, you can think of the NN as the simple part of this, and the RL design as more critical. A really simple RL-ish algorithm that does what you suggest and is quite good in deterministic environments is Cross Entropy Method (CEM) which collects its data from "elite" episodes for training  
  
  ---
  
  