class_docstr: Implements a recurrent DQN designed to produce melody sequences.
class_docstr_tok: ["Implements","a","recurrent","DQN","designed","to","produce","melody","sequences","."]
docstr: Modifies reward by a small random values s to pull it towards the mean.
  
  If reward is above the mean, s is subtracted; if reward is below the mean,
  s is added. The random value is in the range 0-0.2. This function is helpful
  to ensure that the model does not become too certain about playing a
  particular note.
  
  Args:
    reward: A reward value that has already been computed by another reward
      function.
  Returns:
    Original float reward value modified by scaler.
docstr_tok: ["Modifies","reward","by","a","small","random","values","s","to","pull","it","towards","the","mean",".","If","reward","is","above","the","mean",",","s","is","subtracted",";","if","reward","is","below","the","mean",",","s","is","added",".","The","random","value","is","in","the","range","0-0.2",".","This","function","is","helpful","to","ensure","that","the","model","does","not","become","too","certain","about","playing","a","particular","note",".","Args",":","reward",":","A","reward","value","that","has","already","been","computed","by","another","reward","function",".","Returns",":","Original","float","reward","value","modified","by","scaler","."]
code: def random_reward_shift_to_mean(self, reward):
      """Modifies reward by a small random values s to pull it towards the mean.
  
      If reward is above the mean, s is subtracted; if reward is below the mean,
      s is added. The random value is in the range 0-0.2. This function is helpful
      to ensure that the model does not become too certain about playing a
      particular note.
  
      Args:
        reward: A reward value that has already been computed by another reward
          function.
      Returns:
        Original float reward value modified by scaler.
      """
      s = np.random.randint(0, 2) * 0.1
      if reward > 0.5:
          reward -= s
      else:
          reward += s
      return reward
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  import os
  import random
  import urllib
  from magenta.models.rl_tuner import note_rnn_loader
  from magenta.models.rl_tuner import rl_tuner_eval_metrics
  from magenta.models.rl_tuner import rl_tuner_ops
  import matplotlib.pyplot
  from note_seq import melodies_lib
  from note_seq import midi_io
  import numpy
  import scipy.special
  from six.moves import range
  from six.moves import reload_module
  from six.moves import urllib
  import tensorflow.compat.v1
label_desc: Use image node_id 17 for calling the RLTuner obj's underlying member method code with example usage: obj.random_reward_shift_to_mean(reward) and returns: reward