6ff86e4186328eecc9197710a12981d143b1100b,mir_eval/structure.py,,nce,#Any#Any#Any#Any#Any#Any#,265

Before Change


                                        estimated_labels, 
                                        sample_size=frame_size)[-1]

    y_est, est_id_to_label = util.index_labels(y_est)

    // Make the contingency table: shape = (n_ref, n_est)
    contingency = metrics.contingency_matrix(y_ref, y_est).astype(float)

After Change


                                        estimated_labels, 
                                        sample_size=frame_size)[-1]

    y_est = util.index_labels(y_est)[0]

    // Make the contingency table: shape = (n_ref, n_est)
    contingency = metrics.contingency_matrix(y_ref, y_est).astype(float)

    // Normalize by the number of frames
    contingency = contingency / len(y_ref)

    // Compute the marginals
    p_est = contingency.sum(axis=0)
    p_ref = contingency.sum(axis=1)

    // H(true | prediction) = sum_j P[estimated = j] * sum_i P[true = i | estimated = j] log P[true = i | estimated = j]
    // entropy sums over axis=0, which is true labels
    true_given_est = p_est.dot(scipy.stats.entropy(contingency,   base=2))
    pred_given_ref = p_ref.dot(scipy.stats.entropy(contingency.T, base=2))

    score_under = np.nan
    if contingency.shape[0] > 1:
        score_under = 1. - true_given_est / np.log2(contingency.shape[0])

    score_over = np.nan
    if contingency.shape[1] > 1:
        score_over  = 1. - pred_given_ref / np.log2(contingency.shape[1])

    f_measure = util.f_measure(score_over, score_under, beta=beta)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 5

Instances


Project Name: craffel/mir_eval
Commit Name: 6ff86e4186328eecc9197710a12981d143b1100b
Time: 2014-04-16
Author: brm2132@columbia.edu
File Name: mir_eval/structure.py
Class Name:
Method Name: nce


Project Name: craffel/mir_eval
Commit Name: 6ff86e4186328eecc9197710a12981d143b1100b
Time: 2014-04-16
Author: brm2132@columbia.edu
File Name: mir_eval/structure.py
Class Name:
Method Name: mutual_information


Project Name: craffel/mir_eval
Commit Name: 6ff86e4186328eecc9197710a12981d143b1100b
Time: 2014-04-16
Author: brm2132@columbia.edu
File Name: mir_eval/structure.py
Class Name:
Method Name: ari


Project Name: craffel/mir_eval
Commit Name: 6ff86e4186328eecc9197710a12981d143b1100b
Time: 2014-04-16
Author: brm2132@columbia.edu
File Name: mir_eval/structure.py
Class Name:
Method Name: pairwise