21678f424e8a7b0734e2dcc31d0a2ee2e10af097,snorkel/annotations.py,AnnotationManager,load,#AnnotationManager#,152

Before Change


            if cid not in row_index:
                row_index[cid] = len(row_index)
            if kid not in col_index:
                col_index[kid] = len(col_index)
            X[row_index[cid], col_index[kid]] = val

        // Return as an AnnotationMatrix

After Change


        // First, we query to construct the column index map
        kid_to_col = {}
        col_to_kid = {}
        q = session.query(AnnotationKey.id).filter(AnnotationKey.sets.contains(key_set)).order_by(AnnotationKey.id)
        for kid, in q.all():
            if kid not in kid_to_col:
                j = len(kid_to_col)

                // Create both mappings
                kid_to_col[kid] = j
                col_to_kid[j]   = kid

        // Construct the query
        q = session.query(self.annotation_cls.candidate_id, self.annotation_cls.key_id, self.annotation_cls.value)
        q = q.join(Candidate, AnnotationKey)
        q = q.filter(Candidate.sets.contains(candidate_set)).filter(AnnotationKey.sets.contains(key_set))
        q = q.order_by(self.annotation_cls.candidate_id).yield_per(1000)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: snorkel-team/snorkel
Commit Name: 21678f424e8a7b0734e2dcc31d0a2ee2e10af097
Time: 2016-09-04
Author: ajratner@gmail.com
File Name: snorkel/annotations.py
Class Name: AnnotationManager
Method Name: load


Project Name: CyberReboot/NetworkML
Commit Name: cd83fed56a184063215f932ef768f8834328654c
Time: 2020-04-01
Author: josh@vandervecken.com
File Name: networkml/featurizers/funcs/host.py
Class Name: HostBase
Method Name: _get_flags


Project Name: comic/grand-challenge.org
Commit Name: 928eca284d5fba7d0551a77b32c656a265a35878
Time: 2018-08-27
Author: jamesmeakin@gmail.com
File Name: app/grandchallenge/core/management/commands/convertsubmissions.py
Class Name: Command
Method Name: handle