def expanding_mean(new_value, old_value, time):
    """
    Args:
        new_value: this time step's value
        old_value: aggregate from last time step
        time: current time, zero-indexed
    Returns:
        mean from t = 0 : time
    """
    time_1plus = time + 1
    return (1. / time_1plus) * new_value + (time_1plus - 1.) / time_1plus * old_value