6d6a32dd677aa6097c4e77b359f81989c3e949af,src/pyscenic/rnkdb.py,,build_rankings,#,439

Before Change


    result = np.full(shape=(n_features, n_identifiers), fill_value=rank_unknown, dtype=INVERTED_DB_DTYPE)
    for row_idx in prange(n_features):
        ranked_identifiers4feature = ranked_identifiers[row_idx, :]  // The values of a row are the identifiers
        ranks = np.array([np.where(ranked_identifiers4feature == elem)[0] for elem in reference_identifiers], dtype=INVERTED_DB_DTYPE)
        col_idxs = np.nonzero(reference_identifiers.isin(ranked_identifiers4feature))
        result[row_idx, col_idxs] = ranks
    return result

After Change


        for col_idx in range(n_identifiers):
            // TODO: Currently doing brute-force linear search at near C-speed. Time complexity could be greatly reduced
            // TODO: if resorting to binary search or something similar [from O(N) to O(log2(N)) where N is 50k, i.e. top N features]
            result[row_idx, col_idx] = find(ranked_identifiers[row_idx, :], reference_identifiers[col_idx], rank_unknown)
    return result

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: aertslab/pySCENIC
Commit Name: 6d6a32dd677aa6097c4e77b359f81989c3e949af
Time: 2018-04-05
Author: vandesande.bram@gmail.com
File Name: src/pyscenic/rnkdb.py
Class Name:
Method Name: build_rankings


Project Name: HazyResearch/fonduer
Commit Name: 1d6771befb95f4ae94f308899633294a003dcfd6
Time: 2020-07-24
Author: hiromu.hota@hal.hitachi.com
File Name: src/fonduer/utils/data_model_utils/structural.py
Class Name:
Method Name: lowest_common_ancestor_depth


Project Name: HazyResearch/fonduer
Commit Name: 1d6771befb95f4ae94f308899633294a003dcfd6
Time: 2020-07-24
Author: hiromu.hota@hal.hitachi.com
File Name: src/fonduer/utils/data_model_utils/structural.py
Class Name:
Method Name: common_ancestor