class_docstr: Implements a recurrent DQN designed to produce melody sequences.
class_docstr_tok: ["Implements","a","recurrent","DQN","designed","to","produce","melody","sequences","."]
docstr: Detects whether the note played is repeating previous notes excessively.
  
  Args:
    action_note: An integer representing the note just played.
  Returns:
    True if the note just played is excessively repeated, False otherwise.
docstr_tok: ["Detects","whether","the","note","played","is","repeating","previous","notes","excessively",".","Args",":","action_note",":","An","integer","representing","the","note","just","played",".","Returns",":","True","if","the","note","just","played","is","excessively","repeated",",","False","otherwise","."]
code: def detect_repeating_notes(self, action_note):
      """Detects whether the note played is repeating previous notes excessively.
  
      Args:
        action_note: An integer representing the note just played.
      Returns:
        True if the note just played is excessively repeated, False otherwise.
      """
      num_repeated = 0
      contains_held_notes = False
      contains_breaks = False
  
      # Note that the current action yas not yet been added to the composition
      for i in range(len(self.composition) - 1, -1, -1):
          if self.composition[i] == action_note:
              num_repeated += 1
          elif self.composition[i] == NOTE_OFF:
              contains_breaks = True
          elif self.composition[i] == NO_EVENT:
              contains_held_notes = True
          else:
              break
  
      if action_note == NOTE_OFF and num_repeated > 1:
          return True
      elif not contains_held_notes and not contains_breaks:
          if num_repeated > 4:
              return True
      elif contains_held_notes or contains_breaks:
          if num_repeated > 6:
              return True
      else:
          if num_repeated > 8:
              return True
  
      return False
  
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 23 for calling the RLTuner obj's underlying member method code with example usage: obj.detect_repeating_notes(action_note) and returns: False, True, True, True, True