2019b3cae62bdb7740e93b0820fb25692c955cd6,src/pytools/metrics.py,weighted_categorical_crossentropy,loss,#weighted_categorical_crossentropy#Any#Any#,69

Before Change


        loss = p*self.weights
        loss =-K.sum(loss,-1)
//         return loss
        return K.mean(loss)

// def nonzero_acc(y_true, y_pred):
//     lab_true = K.argmax(y_true, axis=-1)
//     lab_pred = K.argmax(y_pred, axis=-1)

After Change



    def loss(self, y_true, y_pred):
        """ prepare a loss of the given metric/loss operating on non-bg data """
        yt = y_true.eval()
        ytbg = np.where(yt == 0)
        y_true_fix = K.variable(yt.flat(ytbg))
        y_pred_fix = K.variable(y_pred.eval().flat(ytbg))
        return self.metric(y_true_fix, y_pred_fix)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 5

Non-data size: 4

Instances


Project Name: adalca/neuron
Commit Name: 2019b3cae62bdb7740e93b0820fb25692c955cd6
Time: 2017-03-16
Author: adalca@mit.edu
File Name: src/pytools/metrics.py
Class Name: weighted_categorical_crossentropy
Method Name: loss


Project Name: pyinstaller/pyinstaller
Commit Name: 1c15efa5b82baec2698b8590b94190d72cc294a1
Time: 2015-07-31
Author: codewarrior@hawaii.rr.com
File Name: PyInstaller/utils/misc.py
Class Name:
Method Name: load_py_data_struct


Project Name: tensorlayer/tensorlayer
Commit Name: 88c7602d683a8ed4e008a02e0d645a4bc65ba22c
Time: 2016-08-04
Author: haodong@dyn1227-34.wlan.ic.ac.uk
File Name: tunelayer/layers.py
Class Name:
Method Name: initialize_rnn_state


Project Name: vatlab/SoS
Commit Name: e9bee65a708edc40448a361833d63aefc77fd46c
Time: 2017-05-31
Author: ben.bog@gmail.com
File Name: sos/R/kernel.py
Class Name: sos_R
Method Name: lan_to_sos


Project Name: vatlab/SoS
Commit Name: 557f7e52f816e477195bc12e0db63e374c4de0e7
Time: 2016-10-25
Author: ben.bog@gmail.com
File Name: pysos/kernel.py
Class Name:
Method Name: from_R_repr