Answers.Body: <p>generally the approach is to have a separate head. For example, imagine you have latent vector <span class="math-container">$z_k$</span>, you would output two values: <span class="math-container">$h(z_k)$</span> and <span class="math-container">$f(z_k)$</span> where <span class="math-container">$0 \leq h \leq 1$</span> and <span class="math-container">$b_0 \leq f \leq b_1$</span> where <span class="math-container">$b_0$</span> and <span class="math-container">$b_1$</span> are your bounds.</p>
  <p>In thios setup, during inference you would check <span class="math-container">$h_k$</span> and if its greater than some threshold (usually .5), youd evaluate/output <span class="math-container">$f_k$</span>.</p>
  <p>In this case your loss would look something like <span class="math-container">$L_i = L_i^{(1)}(h_i, y_i)+y_i*L_i^{(2)}(f_i,v_i)$</span> where <span class="math-container">$(y,v)$</span> are your labels, and the <span class="math-container">$L$</span>'s are your loss of choice.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-22T03:13:16.987Z
Answers.LastActivityDate: 2021-03-22T03:13:16.987Z
Answers.UserDisplayName: mshlis
Body: <p>I want to implement a DDPG method and obviously, the action space will be continuous. I have three outputs. The first output should be zero or a value between 200 and 400, and the other outputs have similar conditions. I don't know how can I implement this condition in the layers and activation functions. Should I use a binary activation before the scaled sigmoid function? How can I scale the activation function for this example?</p>
  <blockquote>
  <p>(a1 = 0) or (200 &lt; a1 &lt; 400)<br />
  (a2 = 0) or (100 &lt; a2 &lt; 500)<br />
  (a3 = 0) or (200 &lt; a3 &lt; 1000)</p>
  </blockquote>
  
Tags: <reinforcement-learning><deep-learning><policy-gradients><ddpg><continuous-action-spaces>
Title: How to have zero value or a value between 200 and 400 in the output of a deep learning model?
UserDisplayName: Jacksss
ThreadText: # How to have zero value or a value between 200 and 400 in the output of a deep learning model?
  
  (Asked by: username_0 on 2021-03-21)
  
  I want to implement a DDPG method and obviously, the action space will be continuous. I have three outputs. The first output should be zero or a value between 200 and 400, and the other outputs have similar conditions. I don't know how can I implement this condition in the layers and activation functions. Should I use a binary activation before the scaled sigmoid function? How can I scale the activation function for this example?
  
  > (a1 = 0) or (200 < a1 < 400)  
  > (a2 = 0) or (100 < a2 < 500)  
  > (a3 = 0) or (200 < a3 < 1000)
  
  **Tags:** reinforcement-learning, deep-learning, policy-gradients, ddpg, continuous-action-spaces
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-03-22. Score: 2
  
  generally the approach is to have a separate head. For example, imagine you have latent vector $z\_k$, you would output two values: $h(z\_k)$ and $f(z\_k)$ where $0 \leq h \leq 1$ and $b\_0 \leq f \leq b\_1$ where $b\_0$ and $b\_1$ are your bounds.
  
  In thios setup, during inference you would check $h\_k$ and if its greater than some threshold (usually .5), youd evaluate/output $f\_k$.
  
  In this case your loss would look something like $L\_i = L\_i^{(1)}(h\_i, y\_i)+y\_i\*L\_i^{(2)}(f\_i,v\_i)$ where $(y,v)$ are your labels, and the $L$'s are your loss of choice.
  
  
  ---
  
  