def compute_mixture_pop_errors()

in src/minmaxML.py [0:0]


def compute_mixture_pop_errors(errors, total_steps=None):
    """
    Compute and return the performance of the aggregate mixture model across all rounds using the errors of the specific
    model computed at each individual round.
    """
    numsteps, numsamples = errors.shape

    # Decrease numsteps if we converged early
    if total_steps is not None:
        numsteps = total_steps

    # Instantiate arrays for aggregate errors
    agg_errors = np.zeros((numsteps, numsamples))
    agg_pop_errors = np.zeros(numsteps)

    for t in range(1, numsteps):
        agg_errors[t] = ((t - 1) / t) * agg_errors[t - 1, :] + errors[t, :] / t
        agg_pop_errors[t] = np.sum(agg_errors[t]) / numsamples

    return agg_pop_errors[1:]  # Remove first index which is a 0 for easier DP code