cd000fd96342d660c4f7d2d21eab9888fbab3526,deslib/util/prob_functions.py,,min_difference,#Any#Any#,205

Before Change


    
    n_samples = len(idx_correct_label)
    C_src = np.zeros(n_samples)
    for index in range(n_samples):
        supports_correct = supports[index][idx_correct_label[index]]
        // removing index of the correct class
        difference = supports_correct - supports[index, :]
        difference = np.delete(difference, idx_correct_label[index])
        C_src[index] = np.sort(difference)[0]
    return C_src


def softmax(w, theta=1.0):

After Change


    
    n_samples = len(idx_correct_label)
    // Boolean mask for the correct class
    mask = np.zeros(supports.shape, dtype=np.bool)
    mask[np.arange(n_samples), idx_correct_label] = True
    // Get supports for the correct class
    supports_correct = supports[mask]
    // Get supports for the other classes
    supports_others = supports[~mask]
    difference = supports_correct.reshape(-1, 1) - supports_others.reshape(supports_correct.size, -1)
    C_src = np.sort(difference, axis=1)[:, 0]
    return C_src


def softmax(w, theta=1.0):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: scikit-learn-contrib/DESlib
Commit Name: cd000fd96342d660c4f7d2d21eab9888fbab3526
Time: 2018-04-23
Author: rafaelmenelau@gmail.com
File Name: deslib/util/prob_functions.py
Class Name:
Method Name: min_difference


Project Name: scikit-learn-contrib/DESlib
Commit Name: cd000fd96342d660c4f7d2d21eab9888fbab3526
Time: 2018-04-23
Author: rafaelmenelau@gmail.com
File Name: deslib/util/prob_functions.py
Class Name:
Method Name: min_difference


Project Name: PIQuIL/QuCumber
Commit Name: e822a02daa1cd1c42f6d2bf309d5996a21979ef1
Time: 2018-07-31
Author: gtorlai@uwaterloo.ca
File Name: qucumber/tests/test_grads_positive.py
Class Name:
Method Name: algorithmic_gradKL


Project Name: scikit-learn-contrib/lightning
Commit Name: 1c1b85686b9744f988d05ecdbaca20c198488e7b
Time: 2014-06-20
Author: mathieu@mblondel.org
File Name: lightning/impl/prank.py
Class Name: PRank
Method Name: predict