45aa2015b2941adaa9b47a058fd6f4caf2e13f34,snorkel/features.py,SessionFeaturizer,load,#SessionFeaturizer#Any#Any#,68

Before Change


        for f in self.load_feats(session, candidate_set):

            // Map the Candidate.id -> row index i
            cid = f.candidate_id
            if not c_index.has_key(cid):
                c_index[cid] = len(c_index)
            i = c_index[cid]

            // Add to matrix
            if self.feat_index.has_key(f.name):
                F[i,self.feat_index[f.name]] = 1

After Change


        where F[i,j] \in {0,1} indicates whether the ith candidate has the jth feature.
        
        // First, we need a mapping from cid -> row number
        c_index = self.get_cid_map(session, candidate_set)

        // Next, fit the candidate set to the existing feature space in self.feat_index
        F = sparse.lil_matrix((len(candidate_set), len(self.feat_index.keys())))
        for f in self.load_feats(session, candidate_set):
            if self.feat_index.has_key(f.name):
                F[c_index[f.candidate_id], self.feat_index[f.name]] = 1
        return F.tocsr()

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 10

Instances


Project Name: snorkel-team/snorkel
Commit Name: 45aa2015b2941adaa9b47a058fd6f4caf2e13f34
Time: 2016-08-14
Author: ajratner@gmail.com
File Name: snorkel/features.py
Class Name: SessionFeaturizer
Method Name: load


Project Name: CellProfiler/CellProfiler
Commit Name: c65430b778f645fb8bc5ff81f08d8cf8c547a52d
Time: 2009-10-16
Author: thouis@1fc53939-2000-0410-845c-e8453a809027
File Name: pyCellProfiler/cellprofiler/modules/measureimagequality.py
Class Name: MeasureImageQuality
Method Name: test_valid


Project Name: snorkel-team/snorkel
Commit Name: 45aa2015b2941adaa9b47a058fd6f4caf2e13f34
Time: 2016-08-14
Author: ajratner@gmail.com
File Name: snorkel/features.py
Class Name: SessionFeaturizer
Method Name: load_and_fit