(self, action)
return reward
Computes cumulative reward for all music theory functions.

    Args:
      action: A one-hot encoding of the chosen action.
    Returns:
      Float reward value.
Computes cumulative reward for all music theory functions.
Computes cumulative reward for all music theory functions .
def reward_music_theory(self, action):
    """Computes cumulative reward for all music theory functions.

    Args:
      action: A one-hot encoding of the chosen action.
    Returns:
      Float reward value.
    """
    reward = self.reward_key(action)
    tf.logging.debug('Key: %s', reward)
    prev_reward = reward

    reward += self.reward_tonic(action)
    if reward != prev_reward:
      tf.logging.debug('Tonic: %s', reward)
    prev_reward = reward

    reward += self.reward_penalize_repeating(action)
    if reward != prev_reward:
      tf.logging.debug('Penalize repeating: %s', reward)
    prev_reward = reward

    reward += self.reward_penalize_autocorrelation(action)
    if reward != prev_reward:
      tf.logging.debug('Penalize autocorr: %s', reward)
    prev_reward = reward

    reward += self.reward_motif(action)
    if reward != prev_reward:
      tf.logging.debug('Reward motif: %s', reward)
    prev_reward = reward

    reward += self.reward_repeated_motif(action)
    if reward != prev_reward:
      tf.logging.debug('Reward repeated motif: %s', reward)
    prev_reward = reward

    # New rewards based on Gauldin's book, "A Practical Approach to Eighteenth
    # Century Counterpoint"
    reward += self.reward_preferred_intervals(action)
    if reward != prev_reward:
      tf.logging.debug('Reward preferred_intervals: %s', reward)
    prev_reward = reward

    reward += self.reward_leap_up_back(action)
    if reward != prev_reward:
      tf.logging.debug('Reward leap up back: %s', reward)
    prev_reward = reward

    reward += self.reward_high_low_unique(action)
    if reward != prev_reward:
      tf.logging.debug('Reward high low unique: %s', reward)

    return reward
def reward_music_theory ( self , action ) : reward = self . reward_key ( action ) tf . logging . debug ( 'Key: %s' , reward ) prev_reward = reward reward += self . reward_tonic ( action ) if reward != prev_reward : tf . logging . debug ( 'Tonic: %s' , reward ) prev_reward = reward reward += self . reward_penalize_repeating ( action ) if reward != prev_reward : tf . logging . debug ( 'Penalize repeating: %s' , reward ) prev_reward = reward reward += self . reward_penalize_autocorrelation ( action ) if reward != prev_reward : tf . logging . debug ( 'Penalize autocorr: %s' , reward ) prev_reward = reward reward += self . reward_motif ( action ) if reward != prev_reward : tf . logging . debug ( 'Reward motif: %s' , reward ) prev_reward = reward reward += self . reward_repeated_motif ( action ) if reward != prev_reward : tf . logging . debug ( 'Reward repeated motif: %s' , reward ) prev_reward = reward # New rewards based on Gauldin's book, "A Practical Approach to Eighteenth # Century Counterpoint" reward += self . reward_preferred_intervals ( action ) if reward != prev_reward : tf . logging . debug ( 'Reward preferred_intervals: %s' , reward ) prev_reward = reward reward += self . reward_leap_up_back ( action ) if reward != prev_reward : tf . logging . debug ( 'Reward leap up back: %s' , reward ) prev_reward = reward reward += self . reward_high_low_unique ( action ) if reward != prev_reward : tf . logging . debug ( 'Reward high low unique: %s' , reward ) return reward