0d78d2a33bb152be3ba5d49dad3433472b0cf9f1,mir_eval/boundary.py,,detection,#,46

Before Change


    precision   = np.mean(dist.max(axis=0))

    // Recall: how many of the intervals did we catch?
    recall      = np.mean(dist.max(axis=1))

    // And the f-measure
    f_measure   = util.f_measure(precision, recall, beta=beta)

After Change



    n_ref, n_est = len(reference_boundaries), len(estimated_boundaries)
    
    skew_adjacency  = np.zeros((n_ref + n_est, n_ref + n_est), dtype=np.int32)
    window_match    = np.abs(np.subtract.outer(reference_boundaries, estimated_boundaries)) <= window
    window_match    = window_match.astype(int)
    
    // L. Lovasz On determinants, matchings and random algorithms. 
    // In L. Budach, editor, Fundamentals of Computation Theory, pages 565-574. Akademie-Verlag, 1979.
    //
    // If we build the skew-symmetric adjacency matrix 
    // D[i, n_ref+j] = 1 <=> ref[i] within window of est[j]
    // D[n_ref + j, i] = -1 <=> same
    //
    // then rank(D) = 2 * maximum matching
    //
    skew_adjacency[:n_ref, n_ref:] = window_match
    skew_adjacency[n_ref:, :n_ref] = -window_match.T
    
    matching_size = np.linalg.matrix_rank(skew_adjacency) / 2.0
    
    // Precision = |matching| / |// predictions|
    // Recall    = |matching| / |// annotations|
    
    precision   = matching_size / len(estimated_boundaries)
    recall      = matching_size / len(reference_boundaries)
    
    f_measure   = util.f_measure(precision, recall)
    
    return precision, recall, f_measure
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: craffel/mir_eval
Commit Name: 0d78d2a33bb152be3ba5d49dad3433472b0cf9f1
Time: 2014-04-15
Author: brm2132@columbia.edu
File Name: mir_eval/boundary.py
Class Name:
Method Name: detection


Project Name: layumi/Person_reID_baseline_pytorch
Commit Name: e9d5373461b0a037716722a461cb12416aa5d1bc
Time: 2018-01-01
Author: zzheng@joo-ml1-dev.j.cinglevue.com
File Name: evaluate.py
Class Name:
Method Name:


Project Name: HyperGAN/HyperGAN
Commit Name: 1b199c1e7f3cf4cf7066ffbd3db407b7aa151742
Time: 2020-12-24
Author: martyn@255bits.com
File Name: hypergan/train_hooks/adversarial_norm_train_hook.py
Class Name: AdversarialNormTrainHook
Method Name: forward