5dd5b8652f28426322309c4e983c94a3caa8fa8e,libact/query_strategies/variance_reduction.py,VarianceReduction,A,#VarianceReduction#Any#Any#Any#Any#Any#,19

Before Change



    def A(self, pi, c, x, label_count, feature_count):
        grad = pi[c] *  np.ones((feature_count*label_count))
        for i in range(feature_count):
            for j in range(label_count):
                if c == j:
                    grad[i*label_count+j] *= (1-pi[c]) * x[i]
                    //grad.append(pi[c] * (1-pi[c]) * x[i])
                else:
                    grad[i*label_count+j] *= (-pi[j]) * x[i]
                    //grad.append(-pi[c] * pi[j] * x[i])
        //grad = np.array(grad)
        //print(np.shape(grad))

        return np.dot(grad.T, grad)

    def Fisher(self, pi, x, label_count, feature_count):
        fisher = np.ones((label_count*feature_count, label_count*feature_count))

After Change


        
        _pi = -1 * np.array(pi)
        _pi[c] += 1
        grad = pi[c] * np.tile(np.array([x]).T, (1, label_count)) *\
                        np.tile(np.array([_pi]), (feature_count, 1))
        grad = grad.reshape((feature_count*label_count))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: ntucllab/libact
Commit Name: 5dd5b8652f28426322309c4e983c94a3caa8fa8e
Time: 2014-12-19
Author: yangarbiter@gmail.com
File Name: libact/query_strategies/variance_reduction.py
Class Name: VarianceReduction
Method Name: A


Project Name: ntucllab/libact
Commit Name: c57ce7f891a91592354b1685d37f2aee39f193f2
Time: 2015-10-07
Author: yangarbiter@gmail.com
File Name: libact/query_strategies/active_learning_by_learning.py
Class Name: Exp4P
Method Name: exp4p


Project Name: fgnt/pb_bss
Commit Name: f9ead8dbcf9737b9740c5ed89c4c5843a707274d
Time: 2019-08-01
Author: cbj@mail.uni-paderborn.de
File Name: pb_bss/evaluation/wrapper.py
Class Name: InputMetrics
Method Name: stoi