<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _update_probabilities(pr, membership_matrix):
 """Updates the probability vector for each iteration of the expectation maximum algorithm in maximum impact estimation. Parameters pr : numpy.array(float), shape = [k] The current vector of probabilities. An element at index j, where j is between 0 and k - 1, corresponds to the probability that, given a gene g_i, g_i has the greatest impact in pathway j. membership_matrix : numpy.array(float), shape = [n, k] The observed gene-to-pathway membership matrix, where n is the number of genes and k is the number of pathways we are interested in. Returns numpy.array(float), shape = [k], a vector of updated probabilities """

    n, k = membership_matrix.shape
    pathway_col_sums = np.sum(membership_matrix, axis=0)

    weighted_pathway_col_sums = np.multiply(pathway_col_sums, pr)
    sum_of_col_sums = np.sum(weighted_pathway_col_sums)
    try:
        new_pr = weighted_pathway_col_sums / sum_of_col_sums
    except FloatingPointError:
        # In the event that we encounter underflow or overflow issues,
        # apply this approximation.
        cutoff = 1e-150 / k
        log_cutoff = np.log(cutoff)

        weighted_pathway_col_sums = _replace_zeros(
            weighted_pathway_col_sums, cutoff)
        log_weighted_col_sums = np.log(weighted_pathway_col_sums)
        log_weighted_col_sums -= np.max(log_weighted_col_sums)

        below_cutoff = log_weighted_col_sums < log_cutoff
        geq_cutoff = log_weighted_col_sums >= log_cutoff

        print("{1} adjustments made to a vector of length {0}"
              " containing the raw weight values"
              " in a call to 'update_probabilities'".format(
                  k, len(log_weighted_col_sums[below_cutoff])))

        new_pr = np.zeros(k)
        new_pr[below_cutoff] = cutoff
        col_sums_geq_cutoff = log_weighted_col_sums[geq_cutoff]
        new_pr[geq_cutoff] = np.exp(
            col_sums_geq_cutoff) / np.sum(np.exp(sorted(col_sums_geq_cutoff)))

    difference = np.abs(1. - np.sum(new_pr))
    assert difference < 1e-12, "Probabilities sum to {0}.".format(
           np.sum(new_pr))
    return new_pr