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

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 8

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: suavecode/SUAVE
Commit Name: 5678e66aaa00587902c71449bf87270e9d07384f
Time: 2019-03-16
Author: mclarke2@stanford.edu
File Name: trunk/SUAVE/Methods/Aerodynamics/XFOIL/compute_airfoil_polars.py
Class Name:
Method Name: read_airfoil_polars


Project Name: scikit-learn-contrib/DESlib
Commit Name: 1002cfbcc9f8182404fb058f959d625de2eabbfc
Time: 2018-03-22
Author: rafaelmenelau@gmail.com
File Name: deslib/des/knora_e.py
Class Name: KNORAE
Method Name: estimate_competence


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: IndicoDataSolutions/finetune
Commit Name: 04573605a3bef45d29d81302bce154f220bbd7f5
Time: 2019-01-15
Author: matthew.bayer@indico.io
File Name: finetune/target_encoders.py
Class Name: OrdinalRegressionEncoder
Method Name: rank_to_thresholds