def _evaluate_log_likelihood(self, event_sequences, control_events=None):
    'Evaluate log likelihood for a list of event sequences of the same length.\n\n    Args:\n      event_sequences: A list of event sequences for which to evaluate the log\n          likelihood.\n      control_events: A sequence of control events upon which to condition the\n          event sequences. If not None, the encoder/decoder should be a\n          ConditionalEventSequenceEncoderDecoder, and the log likelihood of each\n          event sequence will be computed conditional on the control sequence.\n\n    Returns:\n      The log likelihood of each sequence in `event_sequences`.\n\n    Raises:\n      EventSequenceRnnModelError: If the event sequences are not all the\n          same length, or if the control sequence is shorter than the event\n          sequences.\n    '
    num_steps = len(event_sequences[0])
    for events in event_sequences[1:]:
        if (len(events) != num_steps):
            raise EventSequenceRnnModelError('log likelihood evaluation requires all event sequences to have the same length')
    if ((control_events is not None) and (len(control_events) < num_steps)):
        raise EventSequenceRnnModelError('control sequence must be at least as long as the event sequences')
    batch_size = self._batch_size()
    num_full_batches = (len(event_sequences) / batch_size)
    loglik = np.empty(len(event_sequences))
    if (control_events is not None):
        inputs = self._config.encoder_decoder.get_inputs_batch(([control_events] * len(event_sequences)), [events[:(- 1)] for events in event_sequences], full_length=True)
    else:
        inputs = self._config.encoder_decoder.get_inputs_batch([events[:(- 1)] for events in event_sequences], full_length=True)
    graph_initial_state = self._session.graph.get_collection('initial_state')
    initial_state = ([self._session.run(graph_initial_state)] * len(event_sequences))
    offset = 0
    for _ in range(num_full_batches):
        batch_indices = range(offset, (offset + batch_size))
        batch_loglik = self._evaluate_batch_log_likelihood([event_sequences[i] for i in batch_indices], [inputs[i] for i in batch_indices], initial_state[batch_indices])
        loglik[batch_indices] = batch_loglik
        offset += batch_size
    if (offset < len(event_sequences)):
        num_extra = (len(event_sequences) - offset)
        pad_size = (batch_size - num_extra)
        batch_indices = range(offset, len(event_sequences))
        batch_loglik = self._evaluate_batch_log_likelihood(([event_sequences[i] for i in batch_indices] + [copy.deepcopy(event_sequences[(- 1)]) for _ in range(pad_size)]), ([inputs[i] for i in batch_indices] + (inputs[(- 1)] * pad_size)), np.append(initial_state[batch_indices], np.tile(inputs[(- 1), :], (pad_size, 1)), axis=0))
        loglik[batch_indices] = batch_loglik[0:num_extra]
    return loglik
Evaluate log likelihood for a list of event sequences of the same length.

Args:
  event_sequences: A list of event sequences for which to evaluate the log
      likelihood.
  control_events: A sequence of control events upon which to condition the
      event sequences. If not None, the encoder/decoder should be a
      ConditionalEventSequenceEncoderDecoder, and the log likelihood of each
      event sequence will be computed conditional on the control sequence.

Returns:
  The log likelihood of each sequence in `event_sequences`.

Raises:
  EventSequenceRnnModelError: If the event sequences are not all the
      same length, or if the control sequence is shorter than the event
      sequences.
def _evaluate_log_likelihood(self, event_sequences, control_events=None):
    'Evaluate log likelihood for a list of event sequences of the same length.\n\n    Args:\n      event_sequences: A list of event sequences for which to evaluate the log\n          likelihood.\n      control_events: A sequence of control events upon which to condition the\n          event sequences. If not None, the encoder/decoder should be a\n          ConditionalEventSequenceEncoderDecoder, and the log likelihood of each\n          event sequence will be computed conditional on the control sequence.\n\n    Returns:\n      The log likelihood of each sequence in `event_sequences`.\n\n    Raises:\n      EventSequenceRnnModelError: If the event sequences are not all the\n          same length, or if the control sequence is shorter than the event\n          sequences.\n    '
    num_steps = len(event_sequences[0])
    for events in event_sequences[1:]:
        if (len(events) != num_steps):
            raise EventSequenceRnnModelError('log likelihood evaluation requires all event sequences to have the same length')
    if ((control_events is not None) and (len(control_events) < num_steps)):
        raise EventSequenceRnnModelError('control sequence must be at least as long as the event sequences')
    batch_size = self._batch_size()
    num_full_batches = (len(event_sequences) / batch_size)
    loglik = np.empty(len(event_sequences))
    if (control_events is not None):
        inputs = self._config.encoder_decoder.get_inputs_batch(([control_events] * len(event_sequences)), [events[:(- 1)] for events in event_sequences], full_length=True)
    else:
        inputs = self._config.encoder_decoder.get_inputs_batch([events[:(- 1)] for events in event_sequences], full_length=True)
    graph_initial_state = self._session.graph.get_collection('initial_state')
    initial_state = ([self._session.run(graph_initial_state)] * len(event_sequences))
    offset = 0
    for _ in range(num_full_batches):
        batch_indices = range(offset, (offset + batch_size))
        batch_loglik = self._evaluate_batch_log_likelihood([event_sequences[i] for i in batch_indices], [inputs[i] for i in batch_indices], initial_state[batch_indices])
        loglik[batch_indices] = batch_loglik
        offset += batch_size
    if (offset < len(event_sequences)):
        num_extra = (len(event_sequences) - offset)
        pad_size = (batch_size - num_extra)
        batch_indices = range(offset, len(event_sequences))
        batch_loglik = self._evaluate_batch_log_likelihood(([event_sequences[i] for i in batch_indices] + [copy.deepcopy(event_sequences[(- 1)]) for _ in range(pad_size)]), ([inputs[i] for i in batch_indices] + (inputs[(- 1)] * pad_size)), np.append(initial_state[batch_indices], np.tile(inputs[(- 1), :], (pad_size, 1)), axis=0))
        loglik[batch_indices] = batch_loglik[0:num_extra]
    return loglik