bba1901f835525551dde9ec1537d041abc88d293,deslib/static/oracle.py,Oracle,predict,#Oracle#Any#Any#,77

Before Change


        y = self.enc_.transform(y)
        predicted_labels = -np.ones(y.size, dtype=int)
        // TODO: Vectorize Oracle code.
        for sample_index, x in enumerate(X):
            for idx, clf in enumerate(self.pool_classifiers_):
                // If one base classifier predicts the correct answer, consider
                // as a correct prediction
                x_feat = x[self.estimator_features_[idx]].reshape(1, -1)
                predicted = clf.predict(x_feat)[0]
                if predicted == y[sample_index]:
                    predicted = int(predicted)
                    predicted_labels[sample_index] = predicted
                    break
                predicted_labels[sample_index] = predicted

        return self.classes_.take(predicted_labels)

    def predict_proba(self, X, y):

After Change



        y = self.enc_.transform(y)
        preds = [clf.predict(X[:, self.estimator_features_[idx]])
                 for idx, clf in enumerate(self.pool_classifiers_)]
        preds = np.asarray(preds).T
        hit_miss = np.asarray(preds) == y.reshape(-1, 1)
        idx_sel_classifier = hit_miss.argmax(axis=1)
        predicted_labels = preds[np.arange(preds.shape[0]), idx_sel_classifier]

        return self.classes_.take(predicted_labels.astype(int))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: scikit-learn-contrib/DESlib
Commit Name: bba1901f835525551dde9ec1537d041abc88d293
Time: 2021-04-08
Author: rafaelmenelau@gmail.com
File Name: deslib/static/oracle.py
Class Name: Oracle
Method Name: predict


Project Name: RaRe-Technologies/gensim
Commit Name: c55d1b295cb6717ba6494917b88183e8d3f284a9
Time: 2010-09-05
Author: piskvorky@92d0401f-a546-4972-9173-107b360ed7e5
File Name: src/gensim/matutils.py
Class Name:
Method Name: corpus2csc


Project Name: RaRe-Technologies/gensim
Commit Name: cac5f014c09193f7a5ad6b71e4012defa0a96baa
Time: 2010-09-05
Author: radimrehurek@seznam.cz
File Name: src/gensim/matutils.py
Class Name:
Method Name: corpus2csc