def METHOD_NAME(y_true, y_pred, num_intervals):
    """Returns survival likelihood loss.
    Calculates the negative of the log likelihood function for a
    discrete-time statistical survival analysis model. The conditional hazard
    probability for each interval is the probability of failure in the
    interval, given survival until that interval.
    P(surviving interval) = likelihood = product(1 - hazard) for earlier (and
        current) intervals = (current hazard)*product(1- earlier hazards)
    log_likelihood = ln(current hazard) + sum(ln(1- earlier hazards))
    We want to maximize the likelihood, or minimize negative log likehood
    Contribution of each time interval to the loss:
        ln(hazard) for each
    Based off of: https://peerj.com/articles/6257.pdf
    """
    loss_survival = 1. + y_true[:, 0:num_intervals] * (y_pred - 1.)
    loss_death = 1. - y_true[:, num_intervals:2*num_intervals] * y_pred
    loss = tf.concat([loss_survival, loss_death], axis=-1)
    log_loss = tf.reduce_mean(-tf.math.log(tf.clip_by_value(
        loss, 1e-07, 1e32)))
    return log_loss