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

Before Change


        for cid, kid, val in q.all():
            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
        return self.matrix_cls(X, candidate_set=candidate_set, key_set=key_set)

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: 5

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: OpenMined/Grid
Commit Name: 0bce5765b02513a167e454f112a61bd70d47d6ff
Time: 2020-03-02
Author: ionesiojr@gmail.com
File Name: gateway/app/main/processes/controller.py
Class Name: FLController
Method Name: last_participation


Project Name: mlflow/mlflow
Commit Name: f38a634a118fe55d6f98ede2d82624f4cba38fcf
Time: 2019-09-04
Author: 39497902+dbczumar@users.noreply.github.com
File Name: mlflow/store/sqlalchemy_store.py
Class Name: SqlAlchemyStore
Method Name: get_experiment_by_name